avcodec: add an AVCodecContext flag to export PRFT side data on demand

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-02-02 19:12:08 -03:00
parent c666689491
commit d005a7cdfd
5 changed files with 15 additions and 2 deletions

View File

@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
2020-02-21 - xxxxxxxxxx - lavc 58.73.101 - avcodec.h
Add AV_CODEC_EXPORT_DATA_PRFT.
2020-02-21 - xxxxxxxxxx - lavc 58.73.100 - avcodec.h
Add AVCodecContext.export_side_data and AV_CODEC_EXPORT_DATA_MVS.

View File

@ -795,6 +795,9 @@ Possible values:
@item mvs
Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
for codecs that support it. See also @file{doc/examples/export_mvs.c}.
@item prft
Export encoder Producer Reference Time into packet side-data (see @code{AV_PKT_DATA_PRFT})
for codecs that support it.
@end table
@item error @var{integer} (@emph{encoding,video})

View File

@ -1110,6 +1110,10 @@ typedef struct RcOverride{
* Export motion vectors through frame side data
*/
#define AV_CODEC_EXPORT_DATA_MVS (1 << 0)
/**
* Export encoder Producer Reference Time through packet side data
*/
#define AV_CODEC_EXPORT_DATA_PRFT (1 << 1)
/**
* Pan Scan area.
@ -1430,7 +1434,9 @@ enum AVPacketSideDataType {
AV_PKT_DATA_AFD,
/**
* Producer Reference Time data corresponding to the AVProducerReferenceTime struct.
* Producer Reference Time data corresponding to the AVProducerReferenceTime struct,
* usually exported by some encoders (on demand through the prft flag set in the
* AVCodecContext export_side_data field).
*/
AV_PKT_DATA_PRFT,

View File

@ -80,6 +80,7 @@ static const AVOption avcodec_options[] = {
{"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"},
{"export_side_data", "Export metadata as side data", OFFSET(export_side_data), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, A|V|S|D|E, "export_side_data"},
{"mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_MVS}, INT_MIN, INT_MAX, V|D, "export_side_data"},
{"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"},
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},

View File

@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 73
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \