V4L2文件翻譯(二)

2021-06-22 18:49:04 字數 2514 閱讀 3491



所定義的標準中,許多都是一些主要標準的變種。實際上,硬體不必去區分他們,或者在內部做自動切換。因此,列舉出來的標準也包含了乙個或多個標準位。

假設乙個調諧器能夠解調b/pal,g/pal和i/pal訊號。首先列舉出來的是b和g/pal標準,根據uhf或vhf波段的無線頻率實現自動切換。列舉給出pal-b/g或pal-i的選擇。像一些復合輸入會使標準崩潰,如pal-b/g/h/i,ntsc-m和secam-d/k。

這些驅動應該將v4l2_input或v4l2_output結構體中的std成員設為0,且vidioc_g_std,vidioc_s_std,vidioc_querystd,vidioc_enumstd ioctl應返回enotty或einval錯誤碼。

table a.38. input capabilities

v4l2_in_cap_dv_timings    0x00000002    this input supports setting video timings by using vidioc_s_dv_timings.

v4l2_in_cap_std 0x00000004 this input supports setting the tv standard by using vidioc_s_std.

table a.41. output capabilities

v4l2_out_cap_dv_timings    0x00000002    this output supports setting video timings by using vidioc_s_dv_timings.

v4l2_out_cap_std 0x00000004 this output supports setting the tv standard by using vidioc_s_std.

v4l2_std_id std_id;

struct v4l2_standard standard;

if (-1 == ioctl(fd, vidioc_g_std, &std_id))

memset(&standard, 0, sizeof(standard));

standard.index = 0;

while (0 == ioctl(fd, vidioc_enumstd, &standard))

standard.index++;

}/* einval indicates the end of the enumeration, which cannot be

empty unless this device falls under the usb exception. */

if (errno == einval || standard.index == 0)

struct v4l2_input input;

struct v4l2_standard standard;

memset(&input, 0, sizeof(input));

if (-1 == ioctl(fd, vidioc_g_input, &input.index))

if (-1 == ioctl(fd, vidioc_enuminput, &input))

printf("current input %s supports:\n", input.name);

memset(&standard, 0, sizeof(standard));

standard.index = 0;

while (0 == ioctl(fd, vidioc_enumstd, &standard))

/* einval indicates the end of the enumeration, which cannot be

empty unless this device falls under the usb exception. */

if (errno != einval || standard.index == 0)

struct v4l2_input input;

v4l2_std_id std_id;

memset(&input, 0, sizeof(input));

if (-1 == ioctl(fd, vidioc_g_input, &input.index))

if (-1 == ioctl(fd, vidioc_enuminput, &input))

if (0 == (input.std & v4l2_std_pal_bg))

/* note this is also supposed to work when only b

or g/pal is supported. */

std_id = v4l2_std_pal_bg;

if (-1 == ioctl(fd, vidioc_s_std, &std_id))

V4L2文件翻譯(一)

相關資料 裝置命名 每乙個驅動註冊乙個或多個裝置節點後他們的主裝置號都是81,而子裝置號在0 255之間。除非通過config video fixed minor ranges編譯選項編譯核心,否則子裝置號是動態分配的。而且,子裝置號分配範圍與裝置節點型別有關 video radio等 很多驅動支援...

V4L2文件翻譯(八)

struct v4l2 pix format型別 成員名描述 u32 width 寬度 畫素 u32 height 高度 畫素 若field是v4l2 field top v4l2 field bottom v4l2 field alternate之一那麼高度指的是此區域的行數,否則的話指的是此幀的...

V4L2文件翻譯(三)

裝置通常有一些使用者可設定的控制器,如亮度和飽和度等等一些會展示在圖形使用者介面的東西。但不同裝置會有不同的可用設定,而且此外其可設定值範圍 預設值在不同裝置上也不盡相同。控制ioctl提供創造乙個良好使用者介面的資訊和機制,這會讓這些控制器在任何裝置上都能正確的工作。所有控制器都需通過id值進行訪...