[FFmpeg-devel] [PATCH 3/8] lavd/avdevice: add device iterators

Lukasz Marek lukasz.m.luki at gmail.com
Sun Mar 2 21:04:43 CET 2014


On 02.03.2014 16:01, Nicolas George wrote:
> Le primidi 11 ventôse, an CCXXII, Lukasz Marek a écrit :
>> Just noticed bug in it - there was AV_CLASS_CATEGORY_DEVICE_INPUT as
>> second category in output iterators
>> Updated patch attached.
>
> I like that version. Just a few remarks.
>
>> >From 3f22a48b1a95856fca48306ffab9333721bde156 Mon Sep 17 00:00:00 2001
>> From: Lukasz Marek <lukasz.m.luki at gmail.com>
>> Date: Sat, 22 Feb 2014 23:32:55 +0100
>> Subject: [PATCH 3/8] lavd/avdevice: add device iterators
>>
>> TODO: minor bump, update doc/APIChanges
>>
>> Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
>> ---
>>   libavdevice/avdevice.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>>   libavdevice/avdevice.h | 16 ++++++++++++++++
>>   2 files changed, 62 insertions(+)
>>
>> diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
>> index 9e2b7d5..e59942f 100644
>> --- a/libavdevice/avdevice.c
>> +++ b/libavdevice/avdevice.c
>> @@ -37,6 +37,52 @@ const char * avdevice_license(void)
>>       return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
>>   }
>>
>> +static void *av_device_next(void *prev, int output,
>> +                            AVClassCategory c1, AVClassCategory c2)
>> +{
>> +    const AVClass *pc;
>
>> +    AVClassCategory category = AV_CLASS_CATEGORY_NA;
>> +    while (category != c1 && category != c2) {
>
> I suspect this is a case where a do...while loop would make things more
> readable:
>
> 	do {
> 	} while (pc->category != c1 && pc->category != c2);
>
> By testing the condition after pc is updated, you avoid the need for a dummy
> category at the beginning.

It has to have dummy category anyway becuase category is updated 
conditionaly (some formats had no priv_class set). Changed anyway to 
skip initial test.

Updated doxy too.


-- 
Best Regards,
Lukasz Marek

Microsoft isn't evil, they just make really crappy operating systems. - 
Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavd-avdevice-add-device-iterators.patch
Type: text/x-patch
Size: 4055 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140302/c8231c19/attachment.bin>


More information about the ffmpeg-devel mailing list