You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavf: add support for error_recognition, use it in avidec, and bump minor API version
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
committed by
Anton Khirnov
parent
8d2e4a7e68
commit
2f63440c59
@@ -854,6 +854,14 @@ typedef struct AVFormatContext {
|
|||||||
* decoding: number of frames used to probe fps
|
* decoding: number of frames used to probe fps
|
||||||
*/
|
*/
|
||||||
int fps_probe_size;
|
int fps_probe_size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error recognition; higher values will detect more errors but may
|
||||||
|
* misdetect some more or less valid parts as errors.
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: Set by user.
|
||||||
|
*/
|
||||||
|
int error_recognition;
|
||||||
} AVFormatContext;
|
} AVFormatContext;
|
||||||
|
|
||||||
typedef struct AVPacketList {
|
typedef struct AVPacketList {
|
||||||
|
@@ -667,8 +667,9 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
break;
|
break;
|
||||||
case MKTAG('i', 'n', 'd', 'x'):
|
case MKTAG('i', 'n', 'd', 'x'):
|
||||||
i= avio_tell(pb);
|
i= avio_tell(pb);
|
||||||
if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX)){
|
if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
|
||||||
read_braindead_odml_indx(s, 0);
|
read_braindead_odml_indx(s, 0) < 0 && s->error_recognition >= FF_ER_EXPLODE){
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
avio_seek(pb, i+size, SEEK_SET);
|
avio_seek(pb, i+size, SEEK_SET);
|
||||||
break;
|
break;
|
||||||
@@ -706,6 +707,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
if(size > 1000000){
|
if(size > 1000000){
|
||||||
av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
|
av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
|
||||||
"I will ignore it and try to continue anyway.\n");
|
"I will ignore it and try to continue anyway.\n");
|
||||||
|
if (s->error_recognition >= FF_ER_EXPLODE) goto fail;
|
||||||
avi->movi_list = avio_tell(pb) - 4;
|
avi->movi_list = avio_tell(pb) - 4;
|
||||||
avi->movi_end = avio_size(pb);
|
avi->movi_end = avio_size(pb);
|
||||||
goto end_of_header;
|
goto end_of_header;
|
||||||
|
@@ -87,6 +87,9 @@ static const AVOption options[]={
|
|||||||
{"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
|
{"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
|
||||||
{"ts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
|
{"ts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
|
||||||
{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
|
{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
|
||||||
|
{"fer", "set error detection aggressivity", OFFSET(error_recognition), FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
|
||||||
|
{"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
|
||||||
|
{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
|
||||||
{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
|
{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
|
||||||
{NULL},
|
{NULL},
|
||||||
};
|
};
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 53
|
#define LIBAVFORMAT_VERSION_MAJOR 53
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 3
|
#define LIBAVFORMAT_VERSION_MINOR 4
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 0
|
#define LIBAVFORMAT_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
|
Reference in New Issue
Block a user