[FFmpeg-devel] [PATCH] Work around msvc (c99wrap) build failure

Pavel Koshevoy pkoshevoy at gmail.com
Mon Aug 26 05:57:45 CEST 2013


On 8/25/13 9:13 PM, Michael Niedermayer wrote:
> On Sun, Aug 25, 2013 at 06:30:35PM -0600, pkoshevoy at gmail.com wrote:
>> From: Pavel Koshevoy <pkoshevoy at gmail.com>
>>
>> c99wrap choked on initialization of .dbl start_time option with
>> AV_NOPTS_VALUE: Unable to parse int64_t as expression primary
>>
>> Signed-off-by: Pavel Koshevoy <pkoshevoy at gmail.com>
>> ---
>>   libavfilter/vf_fps.c |    6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
>> index e30e90b..219bcd1 100644
>> --- a/libavfilter/vf_fps.c
>> +++ b/libavfilter/vf_fps.c
>> @@ -25,6 +25,8 @@
>>    * a filter enforcing given constant framerate
>>    */
>>   
>> +#include <float.h>
>> +
>>   #include "libavutil/common.h"
>>   #include "libavutil/fifo.h"
>>   #include "libavutil/mathematics.h"
>> @@ -61,7 +63,7 @@ typedef struct FPSContext {
>>   #define F AV_OPT_FLAG_FILTERING_PARAM
>>   static const AVOption fps_options[] = {
>>       { "fps", "A string describing desired output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = V|F },
>> -    { "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX, V },
>> +    { "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, V },
> does INT64_MIN work as well ?
> if so i think its preferable as it has the same nummeric value as
> AV_NOPTS_VALUE, introducing no change except the fix/workaround
> (vf_fps.c could check by assert that the 2 match)
>

No, INT64_MIN triggers the same error from c99wrap: Unable to parse 
int64_t as expression primary

I suspect c99wrap chokes on the typecast statement.

If I change it to { .dbl = 0 } it compiles fine.
If I change it to { .dbl = (double)0 } it complains:  Unable to parse 
double as expression primary

I don't see why there is any particular attachment to AV_NOPTS_VALUE as 
initial value for start_time.  It's appears to be just that -- an 
initial value used to determine whether a user has actually set a 
start_time value.  The initial value can be any reasonably exceptional 
value, maybe even a NAN.  Although, I am not sure how well NAN would 
work with min/max constraints.

     Pavel.



More information about the ffmpeg-devel mailing list