On Fri, Jan 18, 2013 at 10:38 PM, Diego Biurrun <di...@biurrun.de> wrote:
> On Thu, Jan 17, 2013 at 04:26:34PM +0100, Jindřich Makovička wrote:
>>
>> From 37eb9b56534b8ffae296510feaf37a8d42e764aa Mon Sep 17 00:00:00 2001
>> From: Jindrich Makovicka <makov...@gmail.com>
>> Date: Thu, 17 Jan 2013 16:24:28 +0100
>> Subject: [PATCH] avidec: use sensible error codes instead of -1
>>
>> Use AVERROR_INVALIDDATA on invalid inputs, and AVERROR_EOF when no more
>> frames are available in an interleaved AVI.
>>
>> --- a/libavformat/avidec.c
>> +++ b/libavformat/avidec.c
>> @@ -181,7 +181,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, 
>> int frame_num){
>>
>>              if(pb->eof_reached)
>> -                return -1;
>> +                return AVERROR_INVALIDDATA;
>>
>> @@ -198,13 +198,13 @@ static int read_braindead_odml_indx(AVFormatContext 
>> *s, int frame_num){
>>
>>              if(pb->eof_reached)
>> -                return -1;
>> +                return AVERROR_INVALIDDATA;
>>
>> @@ -1016,7 +1019,7 @@ static int avi_read_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>          }
>>          if(!best_st)
>> -            return -1;
>> +            return AVERROR_EOF;
>>
>> @@ -1183,7 +1186,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
>>
>>          if(pb->eof_reached)
>> -            return -1;
>> +            return AVERROR_INVALIDDATA;
>
> Given the log message of your patch, these return values seem transposed.

Actually, they are not, the "best stream to output now" not found is
an EOF condition, while an incomplete AVI index means invalid data.

--
Jindřich Makovička
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to