[FFmpeg-devel] [PATCH] lavd/qtkit: Support choosing the input device by index or by name.

Michael Niedermayer michaelni at gmx.at
Wed Apr 2 22:42:11 CEST 2014


On Wed, Apr 02, 2014 at 10:28:01PM +0200, Thilo Borgmann wrote:
> Am 31.03.14 00:29, schrieb Thilo Borgmann:
> > Am 30.03.14 21:54, schrieb Lukasz Marek:
> >> On 30.03.2014 21:17, Thilo Borgmann wrote:
> >>>> From a44489698c7237988817a63e55058e0d49b120dc Mon Sep 17 00:00:00 2001
> >>> From: Thilo Borgmann<thilo.borgmann at mail.de>
> >>> Date: Sun, 30 Mar 2014 21:13:04 +0200
> >>> Subject: [PATCH 1/2] lavd/qtkit: Support choosing the input device by index or
> >>>   by name.
> >>>
> >>> ---
> >>>   doc/indevs.texi     |  8 +++++++-
> >>>   libavdevice/qtkit.m | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--
> >>>   2 files changed, 59 insertions(+), 3 deletions(-)
> >>> [...]
> >>> +
> >>> +    // check for device index given in filename
> >>> +    if (ctx->video_device_index == -1) {
> >>> +        sscanf(s->filename, "%d", &ctx->video_device_index);
> >>> +    }
> >>
> >> I'm not sure it is required. It can possibly lead to scan a random number that
> >> is a part of device name.
> > 
> > I wouldn't like to drop this convenience functionality except for a real
> > problem. However, checking for invalid numbers should be more robust now.
> > 
> >>> +    if (ctx->video_device_index != -1) {
> >>> +        NSArray *devices = [QTCaptureDevice
> >>> inputDevicesWithMediaType:QTMediaTypeVideo];
> >>> +
> >>> +        if (ctx->video_device_index >= [devices count]) {
> >>> +            av_log(ctx, AV_LOG_ERROR, "Invalid device index\n");
> >>> +            goto fail;
> >>> +        }
> >>> +
> >>> +        video_device = [devices objectAtIndex:ctx->video_device_index];
> >>> +    } else if (strncmp(s->filename, "", 1)) {
> >>
> >> Many devices uses string "default" for this reason, not empty string. Be free to
> >> ignore this, but this would make it more consistent with other devices.
> > 
> > Nice hint - "default" added.
> > 
> >>> [...]
> >>
> >> You may also consider implementing .get_device_list callback to obtain device
> >> list programmatically (as another patch).
> > 
> > Hm. If anyone convinces me of a benifit in that, I could do it.
> > 
> > Updated patch attached.
> 
> Just updated.
> 
> -Thilo
> 

>  doc/indevs.texi     |   19 +++++++++++++++++
>  libavdevice/qtkit.m |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 71 insertions(+), 3 deletions(-)
> 6d3d2e9002d51aa794c92e73719625c5b76b0d70  0001-lavd-qtkit-Support-choosing-the-input-device-by-inde.patch
> From 15a592d3176bf24e40fbe2525cf6818d9df35002 Mon Sep 17 00:00:00 2001
> From: Thilo Borgmann <thilo.borgmann at mail.de>
> Date: Wed, 2 Apr 2014 22:24:36 +0200
> Subject: [PATCH] lavd/qtkit: Support choosing the input device by index or by
>  name.

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140402/c6e47d36/attachment.asc>


More information about the ffmpeg-devel mailing list