1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-09-16 08:36:51 +02:00

Merge commit '7968059e5c3cd8f91407f379c11bbf71a1b84c74'

* commit '7968059e5c3cd8f91407f379c11bbf71a1b84c74':
  mpegts: Allow custom max resync size

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2014-09-03 12:44:14 +02:00

View File

@@ -140,6 +140,8 @@ struct MpegTSContext {
int skip_changes; int skip_changes;
int skip_clear; int skip_clear;
int resync_size;
/******************************************/ /******************************************/
/* private mpegts data */ /* private mpegts data */
/* scan context */ /* scan context */
@@ -153,7 +155,11 @@ struct MpegTSContext {
int current_pid; int current_pid;
}; };
static const AVOption mpegtsraw_options[] = { #define MPEGTS_OPTIONS \
{ "resync_size", "Size limit for looking up a new syncronization.", offsetof(MpegTSContext, resync_size), AV_OPT_TYPE_INT, { .i64 = MAX_RESYNC_SIZE}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }
static const AVOption raw_options[] = {
MPEGTS_OPTIONS,
{ "compute_pcr", "Compute exact PCR for each transport stream packet.", { "compute_pcr", "Compute exact PCR for each transport stream packet.",
offsetof(MpegTSContext, mpeg2ts_compute_pcr), AV_OPT_TYPE_INT, offsetof(MpegTSContext, mpeg2ts_compute_pcr), AV_OPT_TYPE_INT,
{ .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
@@ -167,11 +173,12 @@ static const AVOption mpegtsraw_options[] = {
static const AVClass mpegtsraw_class = { static const AVClass mpegtsraw_class = {
.class_name = "mpegtsraw demuxer", .class_name = "mpegtsraw demuxer",
.item_name = av_default_item_name, .item_name = av_default_item_name,
.option = mpegtsraw_options, .option = raw_options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
static const AVOption mpegts_options[] = { static const AVOption options[] = {
MPEGTS_OPTIONS,
{"fix_teletext_pts", "Try to fix pts values of dvb teletext streams.", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_INT, {"fix_teletext_pts", "Try to fix pts values of dvb teletext streams.", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_INT,
{.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{"ts_packetsize", "Output option carrying the raw packet size.", offsetof(MpegTSContext, raw_packet_size), AV_OPT_TYPE_INT, {"ts_packetsize", "Output option carrying the raw packet size.", offsetof(MpegTSContext, raw_packet_size), AV_OPT_TYPE_INT,
@@ -186,7 +193,7 @@ static const AVOption mpegts_options[] = {
static const AVClass mpegts_class = { static const AVClass mpegts_class = {
.class_name = "mpegts demuxer", .class_name = "mpegts demuxer",
.item_name = av_default_item_name, .item_name = av_default_item_name,
.option = mpegts_options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
@@ -2188,10 +2195,11 @@ static void reanalyze(MpegTSContext *ts) {
* get_packet_size() ?) */ * get_packet_size() ?) */
static int mpegts_resync(AVFormatContext *s) static int mpegts_resync(AVFormatContext *s)
{ {
MpegTSContext *ts = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int c, i; int c, i;
for (i = 0; i < MAX_RESYNC_SIZE; i++) { for (i = 0; i < ts->resync_size; i++) {
c = avio_r8(pb); c = avio_r8(pb);
if (avio_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;