aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-09-12 15:12:05 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-09-12 15:12:05 +0200
commit580c4fc98a213ff56ec95f95c30dde81cb7ef46c (patch)
treee540b1dbb8df192953f6f4e1e91fefefc001212d /libavcodec
parent141637002767d47154bffaf1463edcfd9445a5ee (diff)
parent6064f697a321174232a3fad351afb21150c3e9e5 (diff)
downloadffmpeg-580c4fc98a213ff56ec95f95c30dde81cb7ef46c.tar.gz
Merge commit '6064f697a321174232a3fad351afb21150c3e9e5'
* commit '6064f697a321174232a3fad351afb21150c3e9e5': lavc: Enable side data only packets by default Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h18
-rw-r--r--libavcodec/flacenc.c6
-rw-r--r--libavcodec/options_table.h4
-rw-r--r--libavcodec/version.h3
4 files changed, 22 insertions, 9 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a5faff5da3..6e3edaaed7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1352,7 +1352,9 @@ typedef struct AVPacketSideData {
* then passed to muxers.
*
* For video, it should typically contain one compressed frame. For audio it may
- * contain several compressed frames.
+ * contain several compressed frames. Encoders are allowed to output empty
+ * packets, with no compressed data, containing only side data
+ * (e.g. to update some stream parameters at the end of encoding).
*
* AVPacket is one of the few structs in FFmpeg, whose size is a part of public
* ABI. Thus it may be allocated on stack and no new fields can be added to it
@@ -3105,20 +3107,20 @@ typedef struct AVCodecContext {
*/
uint64_t vbv_delay;
+#if FF_API_SIDEDATA_ONLY_PKT
/**
- * Encoding only. Allow encoders to output packets that do not contain any
- * encoded data, only side data.
+ * Encoding only and set by default. Allow encoders to output packets
+ * that do not contain any encoded data, only side data.
*
* Some encoders need to output such packets, e.g. to update some stream
* parameters at the end of encoding.
*
- * All callers are strongly recommended to set this option to 1 and update
- * their code to deal with such packets, since this behaviour may become
- * always enabled in the future (then this option will be deprecated and
- * later removed). To avoid ABI issues when this happens, the callers should
- * use AVOptions to set this field.
+ * @deprecated this field disables the default behaviour and
+ * it is kept only for compatibility.
*/
+ attribute_deprecated
int side_data_only_packets;
+#endif
/**
* Audio only. The number of "priming" samples (padding) inserted by the
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index be791b39df..f849ffcca4 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -1346,7 +1346,13 @@ static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
av_md5_final(s->md5ctx, s->md5sum);
write_streaminfo(s, avctx->extradata);
+#if FF_API_SIDEDATA_ONLY_PKT
+FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->side_data_only_packets && !s->flushed) {
+FF_ENABLE_DEPRECATION_WARNINGS
+#else
+ if (!s->flushed) {
+#endif
uint8_t *side_data = av_packet_new_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
avctx->extradata_size);
if (!side_data)
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 1d781e8a2c..d86c0c071d 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -490,7 +490,9 @@ static const AVOption avcodec_options[] = {
{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
{"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
{"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, A|V|D },
-{"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, A|V|E },
+#if FF_API_SIDEDATA_ONLY_PKT
+{"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, A|V|E },
+#endif
{"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, V|D },
{"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" },
{"progressive", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_PROGRESSIVE }, 0, 0, V|D|E, "field_order" },
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 24ebaaee45..d233c712cf 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -179,5 +179,8 @@
#ifndef FF_API_WITHOUT_PREFIX
#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
+#ifndef FF_API_SIDEDATA_ONLY_PKT
+#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#endif /* AVCODEC_VERSION_H */