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.
This commit is contained in:
Carl Eugen Hoyos 2015-09-01 09:19:49 +02:00
parent 0cb6c0ec48
commit 670d8ecfae
5 changed files with 35 additions and 1 deletions

View File

@ -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.

View File

@ -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");

View File

@ -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 */

View File

@ -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;

View File

@ -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