History

avf: introduce nobuffer option

Useful in cases where a significant analyzeduration is still needed, while minimizing buffering before output. An example is processing low-latency streams where all media types won't necessarily come in if the analyzeduration is small. Additional changes by Josh Allmann <joshua.allmann@gmail.com>

Luca Barbato committed 14 years ago

Commit 681ed001 parent d905c645 files · +15 −5Browse files

Unified · Split

5 files
  1. doc/APIchanges +3 −0
  2. libavformat/avformat.h +1 −0
  3. libavformat/options_table.h +1 −0
  4. libavformat/utils.c +8 −3
  5. libavformat/version.h +2 −2
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162012-07-xx - xxxxxxx - lavf 54.13.0 - avformat.h
17 Add AVFMT_FLAG_NOBUFFER for low latency use cases.
18
162012-07-xx - xxxxxxx - lavfi 3.0.0 - avfilter.h192012-07-xx - xxxxxxx - lavfi 3.0.0 - avfilter.h
17 Add avfilter_unref_bufferp().20 Add avfilter_unref_bufferp().
18 21
libavformat/avformat.h+1−0
@@ -887,6 +887,7 @@ typedef struct AVFormatContext { · 886 unmodified lines
887#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS887#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
888#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container888#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
889#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled889#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
890#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible
890#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.891#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
891#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted892#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
892 893
libavformat/options_table.h+1−0
@@ -40,6 +40,7 @@ static const AVOption options[]={ · 39 unmodified lines
40{"noparse", "disable AVParsers, this needs nofillin too", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"},40{"noparse", "disable AVParsers, this needs nofillin too", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"},
41{"igndts", "ignore dts", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"},41{"igndts", "ignore dts", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"},
42{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},42{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},
43{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
43{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D},44{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D},
44{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D},45{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D},
45{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.dbl = 1<<20 }, 0, INT_MAX, D},46{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.dbl = 1<<20 }, 0, INT_MAX, D},
libavformat/utils.c+8−3
@@ -2383,9 +2383,14 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 2382 unmodified lines
2383 break;2383 break;
2384 }2384 }
2385 2385
2386 pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end);2386 if (ic->flags & AVFMT_FLAG_NOBUFFER) {
2387 if ((ret = av_dup_packet(pkt)) < 0)2387 pkt = &pkt1;
2388 goto find_stream_info_err;2388 } else {
2389 pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1,
2390 &ic->packet_buffer_end);
2391 if ((ret = av_dup_packet(pkt)) < 0)
2392 goto find_stream_info_err;
2393 }
2389 2394
2390 read_size += pkt->size;2395 read_size += pkt->size;
2391 2396
libavformat/version.h+2−2
@@ -30,8 +30,8 @@ · 29 unmodified lines
30#include "libavutil/avutil.h"30#include "libavutil/avutil.h"
31 31
32#define LIBAVFORMAT_VERSION_MAJOR 5432#define LIBAVFORMAT_VERSION_MAJOR 54
33#define LIBAVFORMAT_VERSION_MINOR 1233#define LIBAVFORMAT_VERSION_MINOR 13
34#define LIBAVFORMAT_VERSION_MICRO 134#define LIBAVFORMAT_VERSION_MICRO 0
35 35
36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
37 LIBAVFORMAT_VERSION_MINOR, \37 LIBAVFORMAT_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t