summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avconv.c1
-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
5 files changed, 22 insertions, 10 deletions
diff --git a/avconv.c b/avconv.c
index deaa40b381..75b00f18be 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1595,7 +1595,6 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
}
if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
- av_dict_set(&ost->encoder_opts, "side_data_only_packets", "1", 0);
if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
if (ret == AVERROR_EXPERIMENTAL)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9b386551c9..8a073d4c4f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1140,7 +1140,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 Libav, whose size is a part of public
* ABI. Thus it may be allocated on stack and no new fields can be added to it
@@ -2867,20 +2869,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 c4c60ee573..58961b8dfa 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -1214,7 +1214,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 9fec8e48f4..b6e14681f8 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -473,7 +473,9 @@ static const AVOption avcodec_options[] = {
{"fltp", "32-bit float planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_FLTP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
{"dblp", "64-bit double planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_DBLP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
{"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
{NULL},
};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index eefc3a93d1..45b99ca266 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -162,5 +162,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 */