[FFmpeg-devel] [PATCH v3 3/3] libavcodec/jpeb2000dec.c: Handle non EOC streams

Steven Liu lq at chinaffmpeg.org
Sat Mar 28 06:28:45 EET 2020



> 2020年3月28日 下午12:24,Gautam Ramakrishnan <gautamramk at gmail.com> 写道:
> 
> On Sat, Mar 28, 2020 at 9:49 AM <gautamramk at gmail.com> wrote:
should the title be jpeg2000dec?, it maybe is a typo if I don’t misunderstand.
>> 
>> From: Gautam Ramakrishnan <gautamramk at gmail.com>
>> 
>> This patch allows decoding of j2k streams which do
>> not have an EOC marker. OpenJPEG implements a similar
>> check.
>> ---
>> libavcodec/jpeg2000dec.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
>> index 44b3e7e41b..99fcb2cf68 100644
>> --- a/libavcodec/jpeg2000dec.c
>> +++ b/libavcodec/jpeg2000dec.c
>> @@ -2076,8 +2076,9 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
>> 
>>         len = bytestream2_get_be16(&s->g);
>>         if (len < 2 || bytestream2_get_bytes_left(&s->g) < len - 2) {
>> -            av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, bytestream2_get_bytes_left(&s->g));
>> -            return AVERROR_INVALIDDATA;
>> +            av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d left=%d\n", len, bytestream2_get_bytes_left(&s->g));
>> +            av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with EOC.\n");
>> +            return 0;
>>         }
>> 
>>         switch (marker) {
>> --
>> 2.17.1
>> 
> Hi,
> 
> @Carl, on adding this patch series, looks like the frames of
> http://samples.ffmpeg.org/jpeg2000/jpeg2000_mxf_first_10mb.mxf
> also seems to be decoded correctly. Have sent this patch for your
> comments.
> 
> -- 
> -------------
> Gautam |
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

Thanks

Steven Liu





More information about the ffmpeg-devel mailing list