[FFmpeg-cvslog] Merge commit '04fc8e24a091ed1d77d7a3c0cbcfe60baec19a9f'

Hendrik Leppkes git at videolan.org
Sun Jun 26 14:37:01 CEST 2016


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Sun Jun 26 14:34:53 2016 +0200| [69c38d64d745c678f2f596f5932a5121b7aafc07] | committer: Hendrik Leppkes

Merge commit '04fc8e24a091ed1d77d7a3c0cbcfe60baec19a9f'

* commit '04fc8e24a091ed1d77d7a3c0cbcfe60baec19a9f':
  lavc: deprecate avcodec_get_context_defaults3()

Merged-by: Hendrik Leppkes <h.leppkes at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69c38d64d745c678f2f596f5932a5121b7aafc07
---

 libavcodec/avcodec.h |   23 +++++++++--------------
 libavcodec/options.c |   11 +++++++++--
 libavcodec/version.h |    3 +++
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6c1d54b..5f3c4b3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4118,7 +4118,6 @@ void avcodec_register_all(void);
  *              important mainly for encoders, e.g. libx264).
  *
  * @return An AVCodecContext filled with default values or NULL on failure.
- * @see avcodec_get_context_defaults
  */
 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
 
@@ -4128,16 +4127,14 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
  */
 void avcodec_free_context(AVCodecContext **avctx);
 
+#if FF_API_GET_CONTEXT_DEFAULTS
 /**
- * Set the fields of the given AVCodecContext to default values corresponding
- * to the given codec (defaults may be codec-dependent).
- *
- * Do not call this function if a non-NULL codec has been passed
- * to avcodec_alloc_context3() that allocated this AVCodecContext.
- * If codec is non-NULL, it is illegal to call avcodec_open2() with a
- * different codec on this AVCodecContext.
+ * @deprecated This function should not be used, as closing and opening a codec
+ * context multiple time is not supported. A new codec context should be
+ * allocated for each new use.
  */
 int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
+#endif
 
 /**
  * Get the AVClass for AVCodecContext. It can be used in combination with
@@ -4256,9 +4253,8 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
  * @param avctx The context to initialize.
  * @param codec The codec to open this context for. If a non-NULL codec has been
  *              previously passed to avcodec_alloc_context3() or
- *              avcodec_get_context_defaults3() for this context, then this
- *              parameter MUST be either NULL or equal to the previously passed
- *              codec.
+ *              for this context, then this parameter MUST be either NULL or
+ *              equal to the previously passed codec.
  * @param options A dictionary filled with AVCodecContext and codec-private options.
  *                On return this object will be filled with options that were not found.
  *
@@ -4273,9 +4269,8 @@ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **op
  * (but not the AVCodecContext itself).
  *
  * Calling this function on an AVCodecContext that hasn't been opened will free
- * the codec-specific data allocated in avcodec_alloc_context3() /
- * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
- * do nothing.
+ * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
+ * codec. Subsequent calls will do nothing.
  */
 int avcodec_close(AVCodecContext *avctx);
 
diff --git a/libavcodec/options.c b/libavcodec/options.c
index a82f375..10dc055 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -89,7 +89,7 @@ static const AVClass av_codec_context_class = {
     .get_category            = get_category,
 };
 
-int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
+static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
 {
     int flags=0;
     memset(s, 0, sizeof(AVCodecContext));
@@ -146,6 +146,13 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
     return 0;
 }
 
+#if FF_API_GET_CONTEXT_DEFAULTS
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
+{
+    return init_context_defaults(s, codec);
+}
+#endif
+
 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
 {
     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
@@ -153,7 +160,7 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
     if (!avctx)
         return NULL;
 
-    if(avcodec_get_context_defaults3(avctx, codec) < 0){
+    if (init_context_defaults(avctx, codec) < 0) {
         av_free(avctx);
         return NULL;
     }
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b3dc8e8..6ce6fc7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -220,6 +220,9 @@
 #ifndef FF_API_COPY_CONTEXT
 #define FF_API_COPY_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_GET_CONTEXT_DEFAULTS
+#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
 #ifndef FF_API_NVENC_OLD_NAME
 #define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif


======================================================================

diff --cc libavcodec/options.c
index a82f375,117ae5e..10dc055
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@@ -85,13 -78,10 +85,13 @@@ static const AVClass av_codec_context_c
      .log_level_offset_offset = offsetof(AVCodecContext, log_level_offset),
      .child_next              = codec_child_next,
      .child_class_next        = codec_child_class_next,
 +    .category                = AV_CLASS_CATEGORY_ENCODER,
 +    .get_category            = get_category,
  };
  
- int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
+ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
  {
 +    int flags=0;
      memset(s, 0, sizeof(AVCodecContext));
  
      s->av_class = &av_codec_context_class;
diff --cc libavcodec/version.h
index b3dc8e8,ef5b742..6ce6fc7
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@@ -220,8 -203,8 +220,11 @@@
  #ifndef FF_API_COPY_CONTEXT
  #define FF_API_COPY_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 59)
  #endif
+ #ifndef FF_API_GET_CONTEXT_DEFAULTS
+ #define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
+ #endif
 +#ifndef FF_API_NVENC_OLD_NAME
 +#define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
 +#endif
  
  #endif /* AVCODEC_VERSION_H */



More information about the ffmpeg-cvslog mailing list