From 670d8ecfae5201f8c2d5693495c2f763cbbc2d72 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 1 Sep 2015 09:19:49 +0200 Subject: lavf: Remove probesize32 and max_analyze_duration32 on version bump. Add FF_API_PROBESIZE_32 to allow removing 32bit probesize and 32bit max_analyze_duration after the next libavformat version bump. --- libavformat/avformat.h | 10 ++++++++++ libavformat/mpegts.c | 7 ++++++- libavformat/options_table.h | 8 ++++++++ libavformat/utils.c | 8 ++++++++ libavformat/version.h | 3 +++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index e83a374f6d..4068ab6a56 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1396,6 +1396,7 @@ typedef struct AVFormatContext { #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. #define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats +#if FF_API_PROBESIZE_32 /** * @deprecated deprecated in favor of probesize2 */ @@ -1406,6 +1407,7 @@ typedef struct AVFormatContext { */ attribute_deprecated int max_analyze_duration; +#endif const uint8_t *key; int keylen; @@ -1758,7 +1760,11 @@ typedef struct AVFormatContext { * via AVOptions (NO direct access). * Can be set to 0 to let avformat choose using a heuristic. */ +#if FF_API_PROBESIZE_32 int64_t max_analyze_duration2; +#else + int64_t max_analyze_duration; +#endif /** * Maximum size of the data read from input for determining @@ -1766,7 +1772,11 @@ typedef struct AVFormatContext { * Demuxing only, set by the caller before avformat_open_input() * via AVOptions (NO direct access). */ +#if FF_API_PROBESIZE_32 int64_t probesize2; +#else + int64_t probesize; +#endif /** * dump format separator. diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index eac6d9e66c..3500fc197a 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2510,7 +2510,12 @@ static int mpegts_read_header(AVFormatContext *s) AVIOContext *pb = s->pb; uint8_t buf[8 * 1024] = {0}; int len; - int64_t pos, probesize = s->probesize ? s->probesize : s->probesize2; + int64_t pos, probesize = +#if FF_API_PROBESIZE_32 + s->probesize ? s->probesize : s->probesize2; +#else + s->probesize; +#endif if (ffio_ensure_seekback(pb, probesize) < 0) av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n"); diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 58670b0035..773814a2b9 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -36,7 +36,11 @@ static const AVOption avformat_options[] = { {"avioflags", NULL, OFFSET(avio_flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "avioflags"}, {"direct", "reduce buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVIO_FLAG_DIRECT }, INT_MIN, INT_MAX, D|E, "avioflags"}, +#if FF_API_PROBESIZE_32 {"probesize", "set probing size", OFFSET(probesize2), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D}, +#else +{"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D}, +#endif {"formatprobesize", "number of bytes to probe file format", OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, INT_MAX-1, D}, {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, {"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"}, @@ -54,7 +58,11 @@ static const AVOption avformat_options[] = { {"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"}, {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D}, {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" }, +#if FF_API_PROBESIZE_32 {"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration2), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, +#else +{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, +#endif {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D}, {"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.i64 = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 758b9400b1..3833b1ffb3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3091,10 +3091,18 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) // new streams might appear, no options for those int orig_nb_streams = ic->nb_streams; int flush_codecs; +#if FF_API_PROBESIZE_32 int64_t max_analyze_duration = ic->max_analyze_duration2; +#else + int64_t max_analyze_duration = ic->max_analyze_duration; +#endif int64_t max_stream_analyze_duration; int64_t max_subtitle_analyze_duration; +#if FF_API_PROBESIZE_32 int64_t probesize = ic->probesize2; +#else + int64_t probesize = ic->probesize; +#endif if (!max_analyze_duration) max_analyze_duration = ic->max_analyze_duration; diff --git a/libavformat/version.h b/libavformat/version.h index d21cd690c7..f231474801 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -65,6 +65,9 @@ #ifndef FF_API_URL_FEOF #define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 57) #endif +#ifndef FF_API_PROBESIZE_32 +#define FF_API_PROBESIZE_32 (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif #ifndef FF_API_R_FRAME_RATE #define FF_API_R_FRAME_RATE 1 -- cgit v1.2.3