diff options
24 files changed, 476 insertions, 284 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index 408c3b638..e180cdf53 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -1171,7 +1171,7 @@ static void wq_set_multicast_list (struct work_struct *work) dvb_net_feed_stop(dev); priv->rx_mode = RX_MODE_UNI; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ spin_lock_bh(&dev->xmit_lock); #else netif_tx_lock_bh(dev); @@ -1200,7 +1200,7 @@ static void wq_set_multicast_list (struct work_struct *work) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ spin_unlock_bh(&dev->xmit_lock); #else netif_tx_unlock_bh(dev); diff --git a/linux/drivers/media/dvb/frontends/tda10023.c b/linux/drivers/media/dvb/frontends/tda10023.c index 5452526ff..017748593 100644 --- a/linux/drivers/media/dvb/frontends/tda10023.c +++ b/linux/drivers/media/dvb/frontends/tda10023.c @@ -482,7 +482,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config, state->i2c = i2c; memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops)); state->pwm = pwm; - for (i=0; i < sizeof(tda10023_inittab)/sizeof(*tda10023_inittab);i+=3) { + for (i=0; i < ARRAY_SIZE(tda10023_inittab);i+=3) { if (tda10023_inittab[i] == 0x00) { state->reg0 = tda10023_inittab[i+2]; break; diff --git a/linux/drivers/media/video/cpia2/cpia2_v4l.c b/linux/drivers/media/video/cpia2/cpia2_v4l.c index 1bda7ad9d..92778cd1d 100644 --- a/linux/drivers/media/video/cpia2/cpia2_v4l.c +++ b/linux/drivers/media/video/cpia2/cpia2_v4l.c @@ -105,7 +105,7 @@ static struct control_menu_info framerate_controls[] = { CPIA2_VP_FRAMERATE_25, "25 fps" }, { CPIA2_VP_FRAMERATE_30, "30 fps" }, }; -#define NUM_FRAMERATE_CONTROLS (sizeof(framerate_controls)/sizeof(framerate_controls[0])) +#define NUM_FRAMERATE_CONTROLS (ARRAY_SIZE(framerate_controls)) static struct control_menu_info flicker_controls[] = { @@ -113,7 +113,7 @@ static struct control_menu_info flicker_controls[] = { FLICKER_50, "50 Hz" }, { FLICKER_60, "60 Hz" }, }; -#define NUM_FLICKER_CONTROLS (sizeof(flicker_controls)/sizeof(flicker_controls[0])) +#define NUM_FLICKER_CONTROLS (ARRAY_SIZE(flicker_controls)) static struct control_menu_info lights_controls[] = { @@ -122,7 +122,7 @@ static struct control_menu_info lights_controls[] = { 128, "Bottom" }, { 192, "Both" }, }; -#define NUM_LIGHTS_CONTROLS (sizeof(lights_controls)/sizeof(lights_controls[0])) +#define NUM_LIGHTS_CONTROLS (ARRAY_SIZE(lights_controls)) #define GPIO_LIGHTS_MASK 192 static struct v4l2_queryctrl controls[] = { @@ -235,7 +235,7 @@ static struct v4l2_queryctrl controls[] = { .default_value = 0, }, }; -#define NUM_CONTROLS (sizeof(controls)/sizeof(controls[0])) +#define NUM_CONTROLS (ARRAY_SIZE(controls)) /****************************************************************************** diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 3eb6c8e28..9103d9567 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -59,8 +59,7 @@ MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); /* ------------------------------------------------------------------ */ -#define OLD_BLACKBIRD_FIRM_IMAGE_SIZE 262144 -#define BLACKBIRD_FIRM_IMAGE_SIZE 376836 +#define BLACKBIRD_FIRM_IMAGE_SIZE 376836 /* defines below are from ivtv-driver.h */ @@ -411,7 +410,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev) u32 value; int i; - for (i = 0; i < dev->fw_size; i++) { + for (i = 0; i < BLACKBIRD_FIRM_IMAGE_SIZE; i++) { memory_read(dev->core, i, &value); if (value == signature[signaturecnt]) signaturecnt++; @@ -464,15 +463,12 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) return -1; } - if ((firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) && - (firmware->size != OLD_BLACKBIRD_FIRM_IMAGE_SIZE)) { - dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d or %d)\n", - firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE, - OLD_BLACKBIRD_FIRM_IMAGE_SIZE); + if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { + dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", + firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); release_firmware(firmware); return -1; } - dev->fw_size = firmware->size; if (0 != memcmp(firmware->data, magic, 8)) { dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 144c40410..63371fa9b 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -495,7 +495,6 @@ struct cx8802_dev { u32 mailbox; int width; int height; - int fw_size; #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) /* for dvb only */ diff --git a/linux/drivers/media/video/ivtv/ivtv-cards.h b/linux/drivers/media/video/ivtv/ivtv-cards.h index 15012f88b..91e9e90c1 100644 --- a/linux/drivers/media/video/ivtv/ivtv-cards.h +++ b/linux/drivers/media/video/ivtv/ivtv-cards.h @@ -86,7 +86,7 @@ V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ V4L2_CAP_SLICED_VBI_CAPTURE) #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ - V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_POS) + V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) struct ivtv_card_video_input { u8 video_type; /* video input type */ diff --git a/linux/drivers/media/video/ivtv/ivtv-firmware.c b/linux/drivers/media/video/ivtv/ivtv-firmware.c index d4c910b78..2b6208a6a 100644 --- a/linux/drivers/media/video/ivtv/ivtv-firmware.c +++ b/linux/drivers/media/video/ivtv/ivtv-firmware.c @@ -56,9 +56,7 @@ retry: volatile u32 __iomem *dst = (volatile u32 __iomem *)mem; const u32 *src = (const u32 *)fw->data; - /* temporarily allow 256 KB encoding firmwares as well for - compatibility with blackbird cards */ - if (fw->size != size && fw->size != 256 * 1024) { + if (fw->size != size) { /* Due to race conditions in firmware loading (esp. with udev <0.95) the wrong file was sometimes loaded. So we check filesizes to see if at least the right-sized file was loaded. If not, then we diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c index 5b799f016..8e7bd439c 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c @@ -362,12 +362,6 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return -EINVAL; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.left = itv->main_rect.left; - fmt->fmt.pix.top = itv->main_rect.top; -#endif fmt->fmt.pix.width = itv->main_rect.width; fmt->fmt.pix.height = itv->main_rect.height; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; @@ -406,12 +400,6 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm break; case V4L2_BUF_TYPE_VIDEO_CAPTURE: -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.left = 0; - fmt->fmt.pix.top = 0; -#endif fmt->fmt.pix.width = itv->params.width; fmt->fmt.pix.height = itv->params.height; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; @@ -506,26 +494,13 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return -EINVAL; field = fmt->fmt.pix.field; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - r.top = fmt->fmt.pix.top; - r.left = fmt->fmt.pix.left; -#else r.top = 0; r.left = 0; -#endif r.width = fmt->fmt.pix.width; r.height = fmt->fmt.pix.height; ivtv_get_fmt(itv, streamtype, fmt); if (itv->output_mode != OUT_UDMA_YUV) { /* TODO: would setting the rect also be valid for this mode? */ -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.top = r.top; - fmt->fmt.pix.left = r.left; -#endif fmt->fmt.pix.width = r.width; fmt->fmt.pix.height = r.height; } @@ -557,11 +532,6 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, itv->yuv_info.yuv_forced_update = 1; return 0; } - if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, - r.width, r.height, r.left, r.top)) - itv->main_rect = r; - else - return -EINVAL; } return 0; } @@ -830,9 +800,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void return ivtv_get_fmt(itv, id->type, fmt); } + case VIDIOC_CROPCAP: { + struct v4l2_cropcap *cropcap = arg; + + if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + cropcap->bounds.top = cropcap->bounds.left = 0; + cropcap->bounds.width = 720; + if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { + cropcap->bounds.height = itv->is_50hz ? 576 : 480; + cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10; + cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11; + } else { + cropcap->bounds.height = itv->is_out_50hz ? 576 : 480; + cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10; + cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11; + } + cropcap->defrect = cropcap->bounds; + return 0; + } + case VIDIOC_S_CROP: { struct v4l2_crop *crop = arg; + if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && + (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { + if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, + crop->c.width, crop->c.height, crop->c.left, crop->c.top)) { + itv->main_rect = crop->c; + return 0; + } + return -EINVAL; + } if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); @@ -841,6 +841,11 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void case VIDIOC_G_CROP: { struct v4l2_crop *crop = arg; + if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && + (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { + crop->c = itv->main_rect; + return 0; + } if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); @@ -1172,12 +1177,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void fb->fmt.pixelformat = itv->osd_pixelformat; fb->fmt.width = itv->osd_rect.width; fb->fmt.height = itv->osd_rect.height; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fb->fmt.left = itv->osd_rect.left; - fb->fmt.top = itv->osd_rect.top; -#endif fb->base = (void *)itv->osd_video_pbase; if (itv->osd_global_alpha_state) fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA; @@ -1498,6 +1497,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, case VIDIOC_S_FMT: case VIDIOC_TRY_FMT: case VIDIOC_ENUM_FMT: + case VIDIOC_CROPCAP: case VIDIOC_G_CROP: case VIDIOC_S_CROP: case VIDIOC_G_FREQUENCY: diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index dcba098aa..4c5813969 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -639,7 +639,7 @@ static struct ov7670_win_size { }, }; -#define N_WIN_SIZES (sizeof(ov7670_win_sizes)/sizeof(ov7670_win_sizes[0])) +#define N_WIN_SIZES (ARRAY_SIZE(ov7670_win_sizes)) /* @@ -1227,7 +1227,7 @@ static struct ov7670_control { .query = ov7670_q_hflip, }, }; -#define N_CONTROLS (sizeof(ov7670_controls)/sizeof(ov7670_controls[0])) +#define N_CONTROLS (ARRAY_SIZE(ov7670_controls)) static struct ov7670_control *ov7670_find_control(__u32 id) { diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c index 3a7c2b019..b4d741aef 100644 --- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -25,6 +25,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/slab.h> #include <linux/delay.h> #include <asm/div64.h> @@ -342,10 +343,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev, static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) { - DECLARE_WAITQUEUE(wait, current); - - add_wait_queue(&dev->thread.wq, &wait); - if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) { + if (dev->thread.scan1 == dev->thread.scan2 && + !kthread_should_stop()) { if (timeout < 0) { set_current_state(TASK_INTERRUPTIBLE); schedule(); @@ -354,7 +353,6 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) (msecs_to_jiffies(timeout)); } } - remove_wait_queue(&dev->thread.wq, &wait); return dev->thread.scan1 != dev->thread.scan2; } @@ -530,12 +528,11 @@ static int tvaudio_thread(void *data) sprintf(current->comm, "%s", dev->name); unlock_kernel(); #else - daemonize("%s", dev->name); allow_signal(SIGTERM); #endif for (;;) { tvaudio_sleep(dev,-1); - if (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) goto done; restart: @@ -644,7 +641,7 @@ static int tvaudio_thread(void *data) for (;;) { if (tvaudio_sleep(dev,5000)) goto restart; - if (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) break; if (UNSET == dev->thread.mode) { rx = tvaudio_getstereo(dev,&tvaudio[i]); @@ -660,7 +657,6 @@ static int tvaudio_thread(void *data) } done: - complete_and_exit(&dev->thread.exit, 0); return 0; } @@ -833,7 +829,6 @@ static int tvaudio_thread_ddep(void *data) sprintf(current->comm, "%s", dev->name); unlock_kernel(); #else - daemonize("%s", dev->name); allow_signal(SIGTERM); #endif @@ -848,7 +843,7 @@ static int tvaudio_thread_ddep(void *data) for (;;) { tvaudio_sleep(dev,-1); - if (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) goto done; restart: @@ -928,7 +923,6 @@ static int tvaudio_thread_ddep(void *data) } done: - complete_and_exit(&dev->thread.exit, 0); return 0; } @@ -1025,7 +1019,6 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev) int saa7134_tvaudio_init2(struct saa7134_dev *dev) { - DECLARE_MUTEX_LOCKED(sem); int (*my_thread)(void *data) = NULL; switch (dev->pci->device) { @@ -1038,15 +1031,15 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) break; } - dev->thread.pid = -1; + dev->thread.thread = NULL; if (my_thread) { /* start tvaudio thread */ - init_waitqueue_head(&dev->thread.wq); - init_completion(&dev->thread.exit); - dev->thread.pid = kernel_thread(my_thread,dev,0); - if (dev->thread.pid < 0) + dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); + if (IS_ERR(dev->thread.thread)) { printk(KERN_WARNING "%s: kernel_thread() failed\n", dev->name); + /* XXX: missing error handling here */ + } saa7134_tvaudio_do_scan(dev); } @@ -1057,11 +1050,9 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) int saa7134_tvaudio_fini(struct saa7134_dev *dev) { /* shutdown tvaudio thread */ - if (dev->thread.pid >= 0) { - dev->thread.shutdown = 1; - wake_up_interruptible(&dev->thread.wq); - wait_for_completion(&dev->thread.exit); - } + if (dev->thread.thread) + kthread_stop(dev->thread.thread); + saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */ return 0; } @@ -1072,10 +1063,10 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) dprintk("sound IF not in use, skipping scan\n"); dev->automute = 0; saa7134_tvaudio_setmute(dev); - } else if (dev->thread.pid >= 0) { + } else if (dev->thread.thread) { dev->thread.mode = UNSET; dev->thread.scan2++; - wake_up_interruptible(&dev->thread.wq); + wake_up_process(dev->thread.thread); } else { dev->automute = 0; saa7134_tvaudio_setmute(dev); @@ -1092,4 +1083,3 @@ EXPORT_SYMBOL(saa7134_tvaudio_setmute); * c-basic-offset: 8 * End: */ - diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index d6f4bd0b4..f1b4de448 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -335,10 +335,7 @@ struct saa7134_pgtable { /* tvaudio thread status */ struct saa7134_thread { - pid_t pid; - struct completion exit; - wait_queue_head_t wq; - unsigned int shutdown; + struct task_struct *thread; unsigned int scan1; unsigned int scan2; unsigned int mode; diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index e00c59873..b85d415ed 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -29,7 +29,7 @@ /* standard i2c insmod options */ static unsigned short normal_i2c[] = { -#ifdef CONFIG_TUNER_5761 +#ifdef CONFIG_TUNER_TEA5761 0x10, #endif 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ @@ -227,12 +227,12 @@ static void set_type(struct i2c_client *c, unsigned int type, } t->mode_mask = T_RADIO; break; -#ifdef CONFIG_TUNER_5761 +#ifdef CONFIG_TUNER_TEA5761 case TUNER_TEA5761: if (tea5761_tuner_init(c) == EINVAL) { t->type = TUNER_ABSENT; t->mode_mask = T_UNINITIALIZED; - return -ENODEV; + return; } t->mode_mask = T_RADIO; break; @@ -526,7 +526,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, /* autodetection code based on the i2c addr */ if (!no_autodetect) { switch (addr) { -#ifdef CONFIG_TUNER_5761 +#ifdef CONFIG_TUNER_TEA5761 case 0x10: if (tea5761_autodetection(&t->i2c) != EINVAL) { t->type = TUNER_TEA5761; diff --git a/linux/drivers/media/video/tveeprom.c b/linux/drivers/media/video/tveeprom.c index f7f046ebb..e97f666c7 100644 --- a/linux/drivers/media/video/tveeprom.c +++ b/linux/drivers/media/video/tveeprom.c @@ -494,7 +494,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, to indicate 4052 mux was removed in favor of using MSP inputs directly. */ audioic = eeprom_data[i+2] & 0x7f; - if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + if (audioic < ARRAY_SIZE(audioIC)) tvee->audio_processor = audioIC[audioic].id; else tvee->audio_processor = AUDIO_CHIP_UNKNOWN; @@ -527,7 +527,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, to indicate 4052 mux was removed in favor of using MSP inputs directly. */ audioic = eeprom_data[i+1] & 0x7f; - if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + if (audioic < ARRAY_SIZE(audioIC)) tvee->audio_processor = audioIC[audioic].id; else tvee->audio_processor = AUDIO_CHIP_UNKNOWN; @@ -682,7 +682,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, tveeprom_info("audio processor is unknown (no idx)\n"); tvee->audio_processor=AUDIO_CHIP_UNKNOWN; } else { - if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + if (audioic < ARRAY_SIZE(audioIC)) tveeprom_info("audio processor is %s (idx %d)\n", audioIC[audioic].name,audioic); else diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index 1e7c25ba0..d0a73d297 100644 --- a/linux/drivers/media/video/tvp5150.c +++ b/linux/drivers/media/video/tvp5150.c @@ -1102,7 +1102,7 @@ static int tvp5150_command(struct i2c_client *c, { struct v4l2_control *ctrl = arg; u8 i, n; - n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); + n = ARRAY_SIZE(tvp5150_qctrl); for (i = 0; i < n; i++) if (ctrl->id == tvp5150_qctrl[i].id) { if (ctrl->value < diff --git a/linux/drivers/media/video/usbvideo/quickcam_messenger.c b/linux/drivers/media/video/usbvideo/quickcam_messenger.c index 9593c8aa3..349d1ba02 100644 --- a/linux/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/linux/drivers/media/video/usbvideo/quickcam_messenger.c @@ -456,7 +456,7 @@ static int qcm_sensor_init(struct uvd *uvd) int ret; int i; - for (i=0; i < sizeof(regval_table)/sizeof(regval_table[0]) ; i++) { + for (i=0; i < ARRAY_SIZE(regval_table) ; i++) { CHECK_RET(ret, qcm_stv_setb(uvd->dev, regval_table[i].reg, regval_table[i].val)); diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index 536c6c767..a6afa78bf 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -1459,6 +1459,11 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs) if (!USBVISION_IS_OPERATIONAL(usbvision)) return; + /* any urb with wrong status is ignored without acknowledgement */ + if (urb->status == -ENOENT) { + return; + } + f = &usbvision->curFrame; /* Manage streaming interruption */ @@ -1481,18 +1486,21 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs) if (usbvision->streaming == Stream_On) { /* If we collected enough data let's parse! */ - if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH) { /* 12 == header_length */ - /*If we don't have a frame we're current working on, complain */ - if(!list_empty(&(usbvision->inqueue))) { - if (!(*f)) { - (*f) = list_entry(usbvision->inqueue.next,struct usbvision_frame, frame); - } - usbvision_parse_data(usbvision); - } - else { - PDEBUG(DBG_IRQ, "received data, but no one needs it"); - scratch_reset(usbvision); + if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) && + (!list_empty(&(usbvision->inqueue))) ) { + if (!(*f)) { + (*f) = list_entry(usbvision->inqueue.next, + struct usbvision_frame, + frame); } + usbvision_parse_data(usbvision); + } + else { + /*If we don't have a frame + we're current working on, complain */ + PDEBUG(DBG_IRQ, + "received data, but no one needs it"); + scratch_reset(usbvision); } } else { @@ -1512,10 +1520,10 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs) urb->dev = usbvision->dev; errCode = usb_submit_urb (urb, GFP_ATOMIC); - /* Disable this warning. By design of the driver. */ - // if(errCode) { - // err("%s: usb_submit_urb failed: error %d", __FUNCTION__, errCode); - // } + if(errCode) { + err("%s: usb_submit_urb failed: error %d", + __FUNCTION__, errCode); + } #endif return; @@ -2474,7 +2482,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) { struct usb_device *dev = usbvision->dev; int bufIdx, errCode, regValue; - const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; + int sb_size; if (!USBVISION_IS_OPERATIONAL(usbvision)) return -EFAULT; @@ -2488,11 +2496,14 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) usbvision->last_error = errCode; return -EBUSY; } + sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; - regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; + regValue = (16 - usbvision_read_reg(usbvision, + USBVISION_ALTER_REG)) & 0x0F; usbvision->usb_bandwidth = regValue >> 1; - PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); + PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", + usbvision->usb_bandwidth); @@ -2512,7 +2523,11 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) return -ENOMEM; } usbvision->sbuf[bufIdx].urb = urb; - usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma); + usbvision->sbuf[bufIdx].data = + usb_buffer_alloc(usbvision->dev, + sb_size, + GFP_KERNEL, + &urb->transfer_dma); urb->dev = dev; urb->context = usbvision; urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); @@ -2530,7 +2545,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) for (j = k = 0; j < USBVISION_URB_FRAMES; j++, k += usbvision->isocPacketSize) { urb->iso_frame_desc[j].offset = k; - urb->iso_frame_desc[j].length = usbvision->isocPacketSize; + urb->iso_frame_desc[j].length = + usbvision->isocPacketSize; } } @@ -2538,10 +2554,12 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) /* Link URBs into a ring so that they invoke each other infinitely */ for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { if ((bufIdx + 1) < USBVISION_NUMSBUF) { - usbvision->sbuf[bufIdx].urb->next = usbvision->sbuf[bufIdx + 1].urb; + usbvision->sbuf[bufIdx].urb->next = + usbvision->sbuf[bufIdx + 1].urb; } else { - usbvision->sbuf[bufIdx].urb->next = usbvision->sbuf[0].urb; + usbvision->sbuf[bufIdx].urb->next = + usbvision->sbuf[0].urb; } } #endif @@ -2551,15 +2569,19 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb); #else - errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, GFP_KERNEL); + errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, + GFP_KERNEL); #endif if (errCode) { - err("%s: usb_submit_urb(%d) failed: error %d", __FUNCTION__, bufIdx, errCode); + err("%s: usb_submit_urb(%d) failed: error %d", + __FUNCTION__, bufIdx, errCode); } } usbvision->streaming = Stream_Idle; - PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", __FUNCTION__, usbvision->video_endp); + PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", + __FUNCTION__, + usbvision->video_endp); return 0; } @@ -2573,7 +2595,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) void usbvision_stop_isoc(struct usb_usbvision *usbvision) { int bufIdx, errCode, regValue; - const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; + int sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) return; @@ -2595,12 +2617,13 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { errCode = usb_unlink_urb(usbvision->sbuf[bufIdx].urb); if (errCode < 0) - err("%s: usb_unlink_urb() failed: error %d", __FUNCTION__, errCode); + err("%s: usb_unlink_urb() failed: error %d", + __FUNCTION__, errCode); } if (usbvision->sbuf[bufIdx].data){ usb_buffer_free(usbvision->dev, - (EM28XX_NUM_PACKETS*usbvision->max_pkt_size), + sb_size, usbvision->sbuf[bufIdx].data, usbvision->sbuf[bufIdx].urb->transfer_dma); } @@ -2620,15 +2643,19 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) errCode = usb_set_interface(usbvision->dev, usbvision->iface, usbvision->ifaceAlt); if (errCode < 0) { - err("%s: usb_set_interface() failed: error %d", __FUNCTION__, errCode); + err("%s: usb_set_interface() failed: error %d", + __FUNCTION__, errCode); usbvision->last_error = errCode; } - regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; - usbvision->isocPacketSize = (regValue == 0) ? 0 : (regValue * 64) - 1; - PDEBUG(DBG_ISOC, "ISO Packet Length:%d", usbvision->isocPacketSize); + regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; + usbvision->isocPacketSize = + (regValue == 0) ? 0 : (regValue * 64) - 1; + PDEBUG(DBG_ISOC, "ISO Packet Length:%d", + usbvision->isocPacketSize); usbvision->usb_bandwidth = regValue >> 1; - PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); + PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", + usbvision->usb_bandwidth); } } diff --git a/linux/drivers/media/video/usbvision/usbvision.h b/linux/drivers/media/video/usbvision/usbvision.h index 29971a0a1..31964faed 100644 --- a/linux/drivers/media/video/usbvision/usbvision.h +++ b/linux/drivers/media/video/usbvision/usbvision.h @@ -146,7 +146,6 @@ #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask #define USBVISION_URB_FRAMES 32 -#define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 #define USBVISION_NUM_HEADERMARKER 20 #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h index 8e46a2029..dc4fb4588 100644 --- a/linux/include/linux/videodev2.h +++ b/linux/include/linux/videodev2.h @@ -243,8 +243,7 @@ struct v4l2_capability #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ -#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */ +#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ @@ -616,12 +615,16 @@ struct v4l2_framebuffer #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 +#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 +#define V4L2_FBUF_CAP_GLOBAL_INV_ALPHA 0x0080 /* Flags for the 'flags' field. */ #define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 +#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 +#define V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA 0x0040 struct v4l2_clip { diff --git a/v4l/Makefile b/v4l/Makefile index ad499751d..954d5227e 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -238,21 +238,8 @@ links:: oss: ln -sf . oss -config-compat.h:: .myconfig - @perl \ - -e 'print "#ifndef __CONFIG_COMPAT_H__\n";' \ - -e 'print "#define __CONFIG_COMPAT_H__\n\n";' \ - -e 'print "#include <linux/autoconf.h>\n\n";' \ - -e 'while(<>) {' \ - -e ' next unless /^(\S+)\s*:= (\S+)$$/;' \ - -e ' print "#undef $$1\n";' \ - -e ' print "#undef $$1_MODULE\n";' \ - -e ' if($$2 eq "n") { next; }' \ - -e ' elsif($$2 eq "m") { print "#define $$1_MODULE 1\n"; }' \ - -e ' elsif($$2 eq "y") { print "#define $$1 1\n"; }' \ - -e ' else { print "#define $$1 $$2\n"; }' \ - -e '} print "\n#endif\n";' \ - < .myconfig > config-compat.h +config-compat.h:: $(obj)/.version .myconfig + perl scripts/make_config_compat.pl $(KDIR) $(obj)/.myconfig $(obj)/config-compat.h kernel-links makelinks:: cd ..; v4l/scripts/makelinks.sh $(KDIR) diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl index f9f56bd7c..08969dab3 100755 --- a/v4l/scripts/gentree.pl +++ b/v4l/scripts/gentree.pl @@ -64,7 +64,10 @@ my %defs = ( 'CONFIG_XC3028' => 0, 'CONFIG_TUNER_TEA5761' => 0, 'I2C_CLASS_TV_ANALOG' => 1, - 'I2C_CLASS_TV_DIGITAL' => 1); + 'I2C_CLASS_TV_DIGITAL' => 1, + 'OLD_XMIT_LOCK' => 0, + 'CONFIG_VIVI_SCATTER' => 0, +); ################################################################# # helpers diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl new file mode 100644 index 000000000..be577d247 --- /dev/null +++ b/v4l/scripts/make_config_compat.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl +use strict; + +my $kdir=shift or die "should specify a kernel dir"; +my $infile=shift or die "should specify an input config file"; +my $outfile=shift or die "should specify an output config file"; + +my $out; + +sub check_spin_lock() +{ + my $file = "$kdir/include/linux/netdevice.h"; + my $old_syntax = 1; + + open INNET, "<$file" or die "File not found: $file"; + while (<INNET>) { + if (m/netif_tx_lock_bh/) { + $old_syntax = 0; + last; + } + } + + if ($old_syntax) { + $out.= "\n#define OLD_XMIT_LOCK 1\n"; + } + close INNET; +} + +sub check_other_dependencies() +{ + check_spin_lock(); +} + +# Do the basic rules +open IN, "<$infile" or die "File not found: $infile"; + +$out.= "#ifndef __CONFIG_COMPAT_H__\n"; +$out.= "#define __CONFIG_COMPAT_H__\n\n"; +$out.= "#include <linux/autoconf.h>\n\n"; +while(<IN>) { + next unless /^(\S+)\s*:= (\S+)$/; + $out.= "#undef $1\n"; + $out.= "#undef $1_MODULE\n"; + if($2 eq "n") { + next; + } elsif($2 eq "m") { + $out.= "#define $1_MODULE 1\n"; + } elsif($2 eq "y") { + $out.= "#define $1 1\n"; + } else { + $out.= "#define $1 $2\n"; + } +} +close IN; + +check_other_dependencies(); + +open OUT, ">$outfile" or die 'Unable to write $outfile'; +print OUT "$out\n#endif\n"; +close OUT diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 8711cc5a8..8a31c025c 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -129,16 +129,23 @@ open_makefile('../linux/drivers/media/Makefile'); # Creating Install rule print OUT "media-install::\n"; -print OUT "\t\@echo \"Stripping debug info from files:\"\n"; +print OUT "\t\@echo \"Stripping debug info from files\"\n"; print OUT "\t\@strip --strip-debug \$(inst-m)\n\n"; +print OUT "\t\@echo \"Installing kernel modules under \$(DESTDIR)\$(KDIR26)/:\"\n"; while (my ($dir, $files) = each %instdir) { - print OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$dir files:\"\n"; - print OUT "\t\@install -d \$(DESTDIR)\$(KDIR26)/$dir\n"; - print OUT "\t\@for i in ", join(' ', keys %$files), ";do "; - print OUT "if [ -e \"\$\$i\" ]; then echo -n \"\$\$i \";"; - print OUT " install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; echo;\n\n"; + print OUT "\t\@n=0;for i in ", join(' ', keys %$files), ";do "; + print OUT "if [ -e \"\$\$i\" ]; then "; + print OUT "if [ \$\$n -eq 0 ]; then "; + print OUT "echo -n \"\t$dir/: \"; "; + print OUT "install -d \$(DESTDIR)\$(KDIR26)/$dir; fi; "; + print OUT "n=\$\$\(\(\$\$n+1\)\); "; + print OUT "if [ \$\$n -eq 4 ]; then echo; echo -n \"\t\t\"; n=1; fi; "; + print OUT "echo -n \"\$\$i \"; "; + print OUT "install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; "; + print OUT "if [ \$\$n -ne 0 ]; then echo; fi;\n\n"; } +print OUT "\t@echo\n"; print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n"; # Creating Remove rule diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index 35d9f466b..cc6819971 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -99,14 +99,24 @@ enum Option { OptGetSlicedVbiOutCap, OptGetFBuf, OptSetFBuf, - OptGetVideoCrop, - OptSetVideoCrop, + OptGetCrop, + OptSetCrop, + OptGetOutputCrop, + OptSetOutputCrop, + OptGetOverlayCrop, + OptSetOverlayCrop, + OptGetOutputOverlayCrop, + OptSetOutputOverlayCrop, OptGetAudioInput, OptSetAudioInput, OptGetAudioOutput, OptSetAudioOutput, OptListAudioOutputs, OptListAudioInputs, + OptGetCropCap, + OptGetOutputCropCap, + OptGetOverlayCropCap, + OptGetOutputOverlayCropCap, OptLast = 256 }; @@ -143,12 +153,10 @@ static const flag_def service_def[] = { }; /* fmts specified */ -#define FmtTop (1L<<0) -#define FmtLeft (1L<<1) -#define FmtWidth (1L<<2) -#define FmtHeight (1L<<3) -#define FmtChromaKey (1L<<4) -#define FmtGlobalAlpha (1L<<5) +#define FmtWidth (1L<<0) +#define FmtHeight (1L<<1) +#define FmtChromaKey (1L<<2) +#define FmtGlobalAlpha (1L<<3) /* crop specified */ #define CropWidth (1L<<0) @@ -206,8 +214,18 @@ static struct option long_options[] = { {"get-sliced-vbi-out-cap", no_argument, 0, OptGetSlicedVbiOutCap}, {"get-fbuf", no_argument, 0, OptGetFBuf}, {"set-fbuf", required_argument, 0, OptSetFBuf}, - {"get-crop-video", no_argument, 0, OptGetVideoCrop}, - {"set-crop-video", required_argument, 0, OptSetVideoCrop}, + {"get-cropcap", no_argument, 0, OptGetCropCap}, + {"get-crop", no_argument, 0, OptGetCrop}, + {"set-crop", required_argument, 0, OptSetCrop}, + {"get-cropcap-output", no_argument, 0, OptGetOutputCropCap}, + {"get-crop-output", no_argument, 0, OptGetOutputCrop}, + {"set-crop-output", required_argument, 0, OptSetOutputCrop}, + {"get-cropcap-overlay", no_argument, 0, OptGetOverlayCropCap}, + {"get-crop-overlay", no_argument, 0, OptGetOverlayCrop}, + {"set-crop-overlay", required_argument, 0, OptSetOverlayCrop}, + {"get-cropcap-output-overlay", no_argument, 0, OptGetOutputOverlayCropCap}, + {"get-crop-output-overlay", no_argument, 0, OptGetOutputOverlayCrop}, + {"set-crop-output-overlay", required_argument, 0, OptSetOutputOverlayCrop}, {0, 0, 0, 0} }; @@ -275,7 +293,7 @@ static void usage(void) printf("Uncommon options:\n"); printf(" --get-fmt-video-out\n"); printf(" query the video output format [VIDIOC_G_FMT]\n"); - printf(" --set-fmt-video-out=left=<x>,top=<y>,width=<w>,height=<h>\n"); + printf(" --set-fmt-video-out=width=<w>,height=<h>\n"); printf(" set the video output format [VIDIOC_S_FMT]\n"); printf(" --get-fmt-overlay\n"); printf(" query the video overlay format [VIDIOC_G_FMT]\n"); @@ -300,12 +318,29 @@ static void usage(void) printf(" --get-fmt-vbi query the VBI capture format [VIDIOC_G_FMT]\n"); printf(" --get-fmt-vbi-out query the VBI output format [VIDIOC_G_FMT]\n"); printf(" --get-fbuf query the overlay framebuffer data [VIDIOC_G_FBUF]\n"); - printf(" --set-fbuf=chromakey=<0/1>,global_alpha=<0/1>,local_alpha=<0/1>\n"); + printf(" --set-fbuf=chromakey=<0/1>,global_alpha=<0/1>,local_alpha=<0/1>,\n"); + printf(" global_inv_alpha=<0/1>,local_inv_alpha=<0/1>\n"); printf(" set the overlay framebuffer [VIDIOC_S_FBUF]\n"); - printf(" --get-crop-video\n"); - printf(" query the video capture crop window [VIDIOC_G_CROP]\n"); - printf(" --set-crop-video=top=<x>,left=<y>,width=<w>,height=<h>\n"); + printf(" --get-cropcap query the crop capabilities [VIDIOC_CROPCAP]\n"); + printf(" --get-crop query the video capture crop window [VIDIOC_G_CROP]\n"); + printf(" --set-crop=top=<x>,left=<y>,width=<w>,height=<h>\n"); printf(" set the video capture crop window [VIDIOC_S_CROP]\n"); + printf(" --get-cropcap-output\n"); + printf(" query the crop capabilities for video output [VIDIOC_CROPCAP]\n"); + printf(" --get-crop-output query the video output crop window [VIDIOC_G_CROP]\n"); + printf(" --set-crop-output=top=<x>,left=<y>,width=<w>,height=<h>\n"); + printf(" set the video output crop window [VIDIOC_S_CROP]\n"); + printf(" --get-cropcap-overlay\n"); + printf(" query the crop capabilities for video overlay [VIDIOC_CROPCAP]\n"); + printf(" --get-crop-overlay query the video overlay crop window [VIDIOC_G_CROP]\n"); + printf(" --set-crop-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n"); + printf(" set the video overlay crop window [VIDIOC_S_CROP]\n"); + printf(" --get-cropcap-output-overlay\n"); + printf(" query the crop capabilities for video output overlays [VIDIOC_CROPCAP]\n"); + printf(" --get-crop-output-overlay\n"); + printf(" query the video output overlay crop window [VIDIOC_G_CROP]\n"); + printf(" --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n"); + printf(" set the video output overlay crop window [VIDIOC_S_CROP]\n"); printf(" --get-audio-input query the audio input [VIDIOC_G_AUDIO]\n"); printf(" --set-audio-input=<num>\n"); printf(" set the audio input to <num> [VIDIOC_S_AUDIO]\n"); @@ -608,18 +643,22 @@ static std::string fbufcap2s(unsigned cap) std::string s; if (cap & V4L2_FBUF_CAP_EXTERNOVERLAY) - s += "\t\tExtern Overlay\n"; + s += "\t\t\tExtern Overlay\n"; if (cap & V4L2_FBUF_CAP_CHROMAKEY) - s += "\t\tChromakey\n"; + s += "\t\t\tChromakey\n"; if (cap & V4L2_FBUF_CAP_GLOBAL_ALPHA) - s += "\t\tGlobal Alpha\n"; + s += "\t\t\tGlobal Alpha\n"; if (cap & V4L2_FBUF_CAP_LOCAL_ALPHA) - s += "\t\tLocal Alpha\n"; + s += "\t\t\tLocal Alpha\n"; + if (cap & V4L2_FBUF_CAP_GLOBAL_INV_ALPHA) + s += "\t\t\tGlobal Inverted Alpha\n"; + if (cap & V4L2_FBUF_CAP_LOCAL_INV_ALPHA) + s += "\t\t\tLocal Inverted Alpha\n"; if (cap & V4L2_FBUF_CAP_LIST_CLIPPING) - s += "\t\tClipping List\n"; + s += "\t\t\tClipping List\n"; if (cap & V4L2_FBUF_CAP_BITMAP_CLIPPING) - s += "\t\tClipping Bitmap\n"; - if (s.empty()) s += "\t\t\n"; + s += "\t\t\tClipping Bitmap\n"; + if (s.empty()) s += "\t\t\t\n"; return s; } @@ -628,16 +667,20 @@ static std::string fbufflags2s(unsigned fl) std::string s; if (fl & V4L2_FBUF_FLAG_PRIMARY) - s += "\t\tPrimary Graphics Surface\n"; + s += "\t\t\tPrimary Graphics Surface\n"; if (fl & V4L2_FBUF_FLAG_OVERLAY) - s += "\t\tOverlay Matches Capture/Output Size\n"; + s += "\t\t\tOverlay Matches Capture/Output Size\n"; if (fl & V4L2_FBUF_FLAG_CHROMAKEY) - s += "\t\tChromakey\n"; + s += "\t\t\tChromakey\n"; if (fl & V4L2_FBUF_FLAG_GLOBAL_ALPHA) - s += "\t\tGlobal Alpha\n"; + s += "\t\t\tGlobal Alpha\n"; if (fl & V4L2_FBUF_FLAG_LOCAL_ALPHA) - s += "\t\tLocal Alpha\n"; - if (s.empty()) s += "\t\t\n"; + s += "\t\t\tLocal Alpha\n"; + if (fl & V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA) + s += "\t\t\tGlobal Inverted Alpha\n"; + if (fl & V4L2_FBUF_FLAG_LOCAL_INV_ALPHA) + s += "\t\t\tLocal Inverted Alpha\n"; + if (s.empty()) s += "\t\t\t\n"; return s; } @@ -645,19 +688,20 @@ static void printfbuf(const struct v4l2_framebuffer &fb) { int is_ext = fb.capability & V4L2_FBUF_CAP_EXTERNOVERLAY; - printf("Capability : %s", fbufcap2s(fb.capability).c_str() + 2); - printf("Flags : %s", fbufflags2s(fb.flags).c_str() + 2); + printf("Framebuffer Format:\n"); + printf("\tCapability : %s", fbufcap2s(fb.capability).c_str() + 3); + printf("\tFlags : %s", fbufflags2s(fb.flags).c_str() + 3); if (fb.base) - printf("Base : 0x%p\n", fb.base); - printf("Width : %d\n", fb.fmt.width); - printf("Height : %d\n", fb.fmt.height); - printf("Pixel Format : %s\n", fcc2s(fb.fmt.pixelformat).c_str()); + printf("\tBase : 0x%p\n", fb.base); + printf("\tWidth : %d\n", fb.fmt.width); + printf("\tHeight : %d\n", fb.fmt.height); + printf("\tPixel Format : %s\n", fcc2s(fb.fmt.pixelformat).c_str()); if (!is_ext) { - printf("Bytes per Line: %d\n", fb.fmt.bytesperline); - printf("Size image : %d\n", fb.fmt.sizeimage); - printf("Colorspace : %s\n", colorspace2s(fb.fmt.colorspace).c_str()); + printf("\tBytes per Line: %d\n", fb.fmt.bytesperline); + printf("\tSize image : %d\n", fb.fmt.sizeimage); + printf("\tColorspace : %s\n", colorspace2s(fb.fmt.colorspace).c_str()); if (fb.fmt.priv) - printf("Custom Info : %08x\n", fb.fmt.priv); + printf("\tCustom Info : %08x\n", fb.fmt.priv); } } @@ -667,6 +711,16 @@ static void printcrop(const struct v4l2_crop &crop) crop.c.left, crop.c.top, crop.c.width, crop.c.height); } +static void printcropcap(const struct v4l2_cropcap &cropcap) +{ + printf("Crop Capability %s:\n", buftype2s(cropcap.type).c_str()); + printf("\tBounds : Left %d, Top %d, Width %d, Height %d\n", + cropcap.bounds.left, cropcap.bounds.top, cropcap.bounds.width, cropcap.bounds.height); + printf("\tDefault : Left %d, Top %d, Width %d, Height %d\n", + cropcap.defrect.left, cropcap.defrect.top, cropcap.defrect.width, cropcap.defrect.height); + printf("\tPixel Aspect: %u/%u\n", cropcap.pixelaspect.numerator, cropcap.pixelaspect.denominator); +} + static int printfmt(struct v4l2_format vfmt) { const flag_def vbi_def[] = { @@ -674,32 +728,22 @@ static int printfmt(struct v4l2_format vfmt) { V4L2_VBI_INTERLACED, "interlaced" }, { 0, NULL } }; - printf("Format:\n"); + printf("Format %s:\n", buftype2s(vfmt.type).c_str()); switch (vfmt.type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: - printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); printf("\tWidth/Height : %u/%u\n", vfmt.fmt.pix.width, vfmt.fmt.pix.height); printf("\tPixel Format : %s\n", fcc2s(vfmt.fmt.pix.pixelformat).c_str()); printf("\tField : %s\n", field2s(vfmt.fmt.pix.field).c_str()); printf("\tBytes per Line: %u\n", vfmt.fmt.pix.bytesperline); printf("\tSize Image : %u\n", vfmt.fmt.pix.sizeimage); printf("\tColorspace : %s\n", colorspace2s(vfmt.fmt.pix.colorspace).c_str()); -#if 0 - /* Comment out until ABI breakage is resolved */ - if (vfmt.type == V4L2_BUF_TYPE_VIDEO_OUTPUT && - (capabilities & V4L2_CAP_VIDEO_OUTPUT_POS)) { - printf("\tLeft/Top : %d/%d\n", - vfmt.fmt.pix.left, vfmt.fmt.pix.top); - } -#endif if (vfmt.fmt.pix.priv) printf("\tCustom Info : %08x\n", vfmt.fmt.pix.priv); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY: - printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); printf("\tLeft/Top : %d/%d\n", vfmt.fmt.win.w.left, vfmt.fmt.win.w.top); printf("\tWidth/Height: %d/%d\n", @@ -712,7 +756,6 @@ static int printfmt(struct v4l2_format vfmt) break; case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_OUTPUT: - printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); printf("\tSampling Rate : %u Hz\n", vfmt.fmt.vbi.sampling_rate); printf("\tOffset : %u samples (%g secs after leading edge)\n", vfmt.fmt.vbi.offset, @@ -728,7 +771,6 @@ static int printfmt(struct v4l2_format vfmt) break; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: - printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); printf("\tService Set : %s\n", flags2s(vfmt.fmt.sliced.service_set, service_def).c_str()); for (int i = 0; i < 24; i++) { @@ -739,10 +781,8 @@ static int printfmt(struct v4l2_format vfmt) printf("\tI/O Size : %u\n", vfmt.fmt.sliced.io_size); break; case V4L2_BUF_TYPE_PRIVATE: - printf("\tType: %s\n", buftype2s(vfmt.type).c_str()); break; default: - printf("\tType: %s\n", buftype2s(vfmt.type).c_str()); return -1; } return 0; @@ -860,8 +900,6 @@ static std::string cap2s(unsigned cap) s += "\t\tSliced VBI Output\n"; if (cap & V4L2_CAP_RDS_CAPTURE) s += "\t\tRDS Capture\n"; - if (cap & V4L2_CAP_VIDEO_OUTPUT_POS) - s += "\t\tVideo Output Position\n"; if (cap & V4L2_CAP_TUNER) s += "\t\tTuner\n"; if (cap & V4L2_CAP_AUDIO) @@ -1031,6 +1069,62 @@ static void print_std(const char *prefix, const char *stds[], unsigned long long printf("\n"); } +static void do_crop(int fd, unsigned int set_crop, struct v4l2_rect &vcrop, v4l2_buf_type type) +{ + struct v4l2_crop in_crop; + + in_crop.type = type; + if (ioctl(fd, VIDIOC_G_CROP, &in_crop) < 0) + fprintf(stderr, "ioctl: VIDIOC_G_CROP failed\n"); + else { + if (set_crop & CropWidth) + in_crop.c.width = vcrop.width; + if (set_crop & CropHeight) + in_crop.c.height = vcrop.height; + if (set_crop & CropLeft) + in_crop.c.left = vcrop.left; + if (set_crop & CropTop) + in_crop.c.top = vcrop.top; + if (ioctl(fd, VIDIOC_S_CROP, &in_crop) < 0) + fprintf(stderr, "ioctl: VIDIOC_S_CROP failed\n"); + } +} + +static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop) +{ + char *value; + char *subs = optarg; + + while (*subs != '\0') { + static char *const subopts[] = { + "left", + "top", + "width", + "height", + NULL + }; + + switch (parse_subopt(&subs, subopts, &value)) { + case 0: + vcrop.left = strtol(value, 0L, 0); + set_crop |= CropLeft; + break; + case 1: + vcrop.top = strtol(value, 0L, 0); + set_crop |= CropTop; + break; + case 2: + vcrop.width = strtol(value, 0L, 0); + set_crop |= CropWidth; + break; + case 3: + vcrop.height = strtol(value, 0L, 0); + set_crop |= CropHeight; + break; + } + } +} + int main(int argc, char **argv) { char *value, *subs; @@ -1042,6 +1136,9 @@ int main(int argc, char **argv) unsigned int set_fmts = 0; unsigned int set_fmts_out = 0; unsigned int set_crop = 0; + unsigned int set_crop_out = 0; + unsigned int set_crop_overlay = 0; + unsigned int set_crop_out_overlay = 0; unsigned int set_fbuf = 0; unsigned int set_overlay_fmt_out = 0; @@ -1064,6 +1161,9 @@ int main(int argc, char **argv) struct v4l2_audio vaudio; /* list audio inputs */ struct v4l2_audioout vaudout; /* audio outputs */ struct v4l2_rect vcrop; /* crop rect */ + struct v4l2_rect vcrop_out; /* crop rect */ + struct v4l2_rect vcrop_overlay; /* crop rect */ + struct v4l2_rect vcrop_out_overlay; /* crop rect */ struct v4l2_framebuffer fbuf; /* fbuf */ int input; /* set_input/get_input */ int output; /* set_output/get_output */ @@ -1088,6 +1188,9 @@ int main(int argc, char **argv) memset(&vaudio, 0, sizeof(vaudio)); memset(&vaudout, 0, sizeof(vaudout)); memset(&vcrop, 0, sizeof(vcrop)); + memset(&vcrop_out, 0, sizeof(vcrop_out)); + memset(&vcrop_overlay, 0, sizeof(vcrop_overlay)); + memset(&vcrop_out_overlay, 0, sizeof(vcrop_out_overlay)); memset(&vf, 0, sizeof(vf)); memset(&vs, 0, sizeof(vs)); memset(&fbuf, 0, sizeof(fbuf)); @@ -1150,30 +1253,17 @@ int main(int argc, char **argv) subs = optarg; while (*subs != '\0') { static char *const subopts[] = { - "top", - "left", "width", "height", NULL }; switch (parse_subopt(&subs, subopts, &value)) { -#if 0 - /* Comment out until ABI breakage is resolved */ case 0: - vfmt_out.fmt.pix.top = strtol(value, 0L, 0); - set_fmts_out |= FmtTop; - break; - case 1: - vfmt_out.fmt.pix.left = strtol(value, 0L, 0); - set_fmts_out |= FmtLeft; - break; -#endif - case 2: vfmt_out.fmt.pix.width = strtol(value, 0L, 0); set_fmts_out |= FmtWidth; break; - case 3: + case 1: vfmt_out.fmt.pix.height = strtol(value, 0L, 0); set_fmts_out |= FmtHeight; break; @@ -1208,6 +1298,8 @@ int main(int argc, char **argv) "chromakey", "global_alpha", "local_alpha", + "global_inv_alpha", + "local_inv_alpha", NULL }; @@ -1224,40 +1316,29 @@ int main(int argc, char **argv) fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_ALPHA : 0; set_fbuf |= V4L2_FBUF_FLAG_LOCAL_ALPHA; break; - } - } - break; - case OptSetVideoCrop: - subs = optarg; - while (*subs != '\0') { - static char *const subopts[] = { - "left", - "top", - "width", - "height", - NULL - }; - - switch (parse_subopt(&subs, subopts, &value)) { - case 0: - vcrop.left = strtol(value, 0L, 0); - set_crop |= CropLeft; - break; - case 1: - vcrop.top = strtol(value, 0L, 0); - set_crop |= CropTop; - break; - case 2: - vcrop.width = strtol(value, 0L, 0); - set_crop |= CropWidth; - break; case 3: - vcrop.height = strtol(value, 0L, 0); - set_crop |= CropHeight; + fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA : 0; + set_fbuf |= V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA; + break; + case 4: + fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_INV_ALPHA : 0; + set_fbuf |= V4L2_FBUF_FLAG_LOCAL_INV_ALPHA; break; } } break; + case OptSetCrop: + parse_crop(optarg, set_crop, vcrop); + break; + case OptSetOutputCrop: + parse_crop(optarg, set_crop_out, vcrop_out); + break; + case OptSetOverlayCrop: + parse_crop(optarg, set_crop_overlay, vcrop_overlay); + break; + case OptSetOutputOverlayCrop: + parse_crop(optarg, set_crop_out_overlay, vcrop_out_overlay); + break; case OptSetInput: input = strtol(optarg, 0L, 0); break; @@ -1434,7 +1515,7 @@ int main(int argc, char **argv) if (options[OptAll]) { options[OptGetVideoFormat] = 1; - options[OptGetVideoCrop] = 1; + options[OptGetCrop] = 1; options[OptGetVideoOutFormat] = 1; options[OptGetDriverInfo] = 1; options[OptGetInput] = 1; @@ -1451,12 +1532,14 @@ int main(int argc, char **argv) options[OptGetSlicedVbiFormat] = 1; options[OptGetSlicedVbiOutFormat] = 1; options[OptGetFBuf] = 1; + options[OptGetCropCap] = 1; + options[OptGetOutputCropCap] = 1; } /* Information Opts */ if (options[OptGetDriverInfo]) { - printf("Driver info:\n"); + printf("Driver Info:\n"); printf("\tDriver name : %s\n", vcap.driver); printf("\tCard type : %s\n", vcap.card); printf("\tBus info : %s\n", vcap.bus_info); @@ -1558,13 +1641,6 @@ int main(int argc, char **argv) if (ioctl(fd, VIDIOC_G_FMT, &in_vfmt) < 0) fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n"); else { -#if 0 - /* Comment out until ABI breakage is resolved */ - if (set_fmts_out & FmtTop) - in_vfmt.fmt.pix.top = vfmt_out.fmt.pix.top; - if (set_fmts_out & FmtLeft) - in_vfmt.fmt.pix.left = vfmt_out.fmt.pix.left; -#endif if (set_fmts_out & FmtWidth) in_vfmt.fmt.pix.width = vfmt_out.fmt.pix.width; if (set_fmts_out & FmtHeight) @@ -1626,24 +1702,20 @@ int main(int argc, char **argv) } } - if (options[OptSetVideoCrop]) { - struct v4l2_crop in_crop; + if (options[OptSetCrop]) { + do_crop(fd, set_crop, vcrop, V4L2_BUF_TYPE_VIDEO_CAPTURE); + } - in_crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (ioctl(fd, VIDIOC_G_CROP, &in_crop) < 0) - fprintf(stderr, "ioctl: VIDIOC_G_CROP failed\n"); - else { - if (set_crop & CropWidth) - in_crop.c.width = vcrop.width; - if (set_crop & CropHeight) - in_crop.c.height = vcrop.height; - if (set_crop & CropLeft) - in_crop.c.left = vcrop.left; - if (set_crop & CropTop) - in_crop.c.top = vcrop.top; - if (ioctl(fd, VIDIOC_S_CROP, &in_crop) < 0) - fprintf(stderr, "ioctl: VIDIOC_S_CROP failed\n"); - } + if (options[OptSetOutputCrop]) { + do_crop(fd, set_crop_out, vcrop_out, V4L2_BUF_TYPE_VIDEO_OUTPUT); + } + + if (options[OptSetOverlayCrop]) { + do_crop(fd, set_crop_overlay, vcrop_overlay, V4L2_BUF_TYPE_VIDEO_OVERLAY); + } + + if (options[OptSetOutputOverlayCrop]) { + do_crop(fd, set_crop_out_overlay, vcrop_out_overlay, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY); } if (options[OptSetCtrl] && !set_ctrls.empty()) { @@ -1765,7 +1837,39 @@ int main(int argc, char **argv) printfbuf(fb); } - if (options[OptGetVideoCrop]) { + if (options[OptGetCropCap]) { + struct v4l2_cropcap cropcap; + + cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (doioctl(fd, VIDIOC_CROPCAP, &cropcap, "VIDIOC_CROPCAP") == 0) + printcropcap(cropcap); + } + + if (options[OptGetOutputCropCap]) { + struct v4l2_cropcap cropcap; + + cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + if (doioctl(fd, VIDIOC_CROPCAP, &cropcap, "VIDIOC_CROPCAP") == 0) + printcropcap(cropcap); + } + + if (options[OptGetOverlayCropCap]) { + struct v4l2_cropcap cropcap; + + cropcap.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + if (doioctl(fd, VIDIOC_CROPCAP, &cropcap, "VIDIOC_CROPCAP") == 0) + printcropcap(cropcap); + } + + if (options[OptGetOutputOverlayCropCap]) { + struct v4l2_cropcap cropcap; + + cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; + if (doioctl(fd, VIDIOC_CROPCAP, &cropcap, "VIDIOC_CROPCAP") == 0) + printcropcap(cropcap); + } + + if (options[OptGetCrop]) { struct v4l2_crop crop; crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -1773,6 +1877,30 @@ int main(int argc, char **argv) printcrop(crop); } + if (options[OptGetOutputCrop]) { + struct v4l2_crop crop; + + crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + if (doioctl(fd, VIDIOC_G_CROP, &crop, "VIDIOC_G_CROP") == 0) + printcrop(crop); + } + + if (options[OptGetOverlayCrop]) { + struct v4l2_crop crop; + + crop.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + if (doioctl(fd, VIDIOC_G_CROP, &crop, "VIDIOC_G_CROP") == 0) + printcrop(crop); + } + + if (options[OptGetOutputOverlayCrop]) { + struct v4l2_crop crop; + + crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; + if (doioctl(fd, VIDIOC_G_CROP, &crop, "VIDIOC_G_CROP") == 0) + printcrop(crop); + } + if (options[OptGetInput]) { if (doioctl(fd, VIDIOC_G_INPUT, &input, "VIDIOC_G_INPUT") == 0) { printf("Video input : %d", input); @@ -1836,7 +1964,7 @@ int main(int argc, char **argv) NULL }; - printf("Video standard = 0x%08llx\n", (unsigned long long)std); + printf("Video Standard = 0x%08llx\n", (unsigned long long)std); if (std & 0xfff) { print_std("PAL", pal, std); } diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 6f373281e..10c9a8927 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -160,8 +160,6 @@ static std::string cap2s(unsigned cap) s += "\t\tSliced VBI Output\n"; if (cap & V4L2_CAP_RDS_CAPTURE) s += "\t\tRDS Capture\n"; - if (cap & V4L2_CAP_VIDEO_OUTPUT_POS) - s += "\t\tVideo Output Position\n"; if (cap & V4L2_CAP_TUNER) s += "\t\tTuner\n"; if (cap & V4L2_CAP_AUDIO) |