]> git.sesse.net Git - ffmpeg/commitdiff
lavc: Enable side data only packets by default
authorVittorio Giovara <vittorio.giovara@gmail.com>
Fri, 11 Sep 2015 15:47:29 +0000 (17:47 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Sat, 12 Sep 2015 11:38:31 +0000 (13:38 +0200)
Deprecate the now unused option, but temporarily retain the capability
to disable the now default behaviour.

Mention this change in the AVPacket documentation.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
avconv.c
libavcodec/avcodec.h
libavcodec/flacenc.c
libavcodec/options_table.h
libavcodec/version.h

index deaa40b38134e39941d25eab78dffcc2daf4b8f4..75b00f18be90982c3b65adf0b8982287516aa256 100644 (file)
--- 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)
index 9b386551c901f0fa4dabdec0b99c1825335bfb0c..8a073d4c4f74b9f94d9a06e7a0427a39033b6944 100644 (file)
@@ -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
index c4c60ee57334ed947ca0186dae6f27855d4d1f86..58961b8dfa143248e81f1a6f8bf273b700ce19ab 100644 (file)
@@ -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)
index 9fec8e48f4b04f1da2df06ea2177d2151bf0e0cf..b6e14681f869b9134d4fe1f0066f8a50136602ac 100644 (file)
@@ -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},
 };
 
index eefc3a93d1d7b4093d5d338fab26af95e3b0c9e8..45b99ca266b3fd15d3c502a4c58848794a87da85 100644 (file)
 #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 */