[FFmpeg-soc] [PATCH 2/9] Add the AVCodec/AVCodecContext fields needed for multithreading and increment the API minor version

Alexander Strange astrange at ithinksw.com
Thu May 29 05:37:54 CEST 2008


---
  libavcodec/avcodec.h |   32 ++++++++++++++++++++++++++++++--
  1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8d8b635..80c07b1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,7 +30,7 @@
  #include "libavutil/avutil.h"

  #define LIBAVCODEC_VERSION_MAJOR 51
-#define LIBAVCODEC_VERSION_MINOR 56
+#define LIBAVCODEC_VERSION_MINOR 57
  #define LIBAVCODEC_VERSION_MICRO  0

  #define LIBAVCODEC_VERSION_INT   
AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -489,6 +489,7 @@ typedef struct RcOverride{
   * This can be used to prevent truncation of the last audio samples.
   */
  #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
+#define CODEC_CAP_FRAME_THREADS    0x0080

  //The following defines may change, don't expect compatibility if  
you use them.
  #define MB_TYPE_INTRA4x4   0x0001
@@ -751,7 +752,21 @@ typedef struct AVPanScan{
       * - encoding: Set by user.\
       * - decoding: Set by libavcodec.\
       */\
-    int8_t *ref_index[2];
+    int8_t *ref_index[2];\
+\
+    /**\
+     * context owning the internal buffers\
+     * - encoding: unused\
+     * - decoding: MUST be set by get_buffer().\
+     */\
+    struct AVCodecContext *avctx;\
+\
+    /**\
+     * shared data between copies of the frame struct\
+     * - encoding: unused\
+     * - decoding: Set by libavcodec.\
+     */\
+    void *thread_opaque;

  #define FF_QSCALE_TYPE_MPEG1 0
  #define FF_QSCALE_TYPE_MPEG2 1
@@ -2206,6 +2221,13 @@ typedef struct AVCodecContext {
       * - decoding: Set by user.
       */
      float drc_scale;
+
+    /**
+     * Whether this is a copy of another context - used by  
multithreading.
+     * - encoding: Set by libavcodec.
+     * - decoding: Set by libavcodec.
+     */
+    int is_copy;
  } AVCodecContext;

  /**
@@ -2242,6 +2264,12 @@ typedef struct AVCodec {
      const enum PixelFormat *pix_fmts;       ///< array of supported  
pixel formats, or NULL if unknown, array is terminated by -1
      const char *long_name;                  ///< descriptive name  
for the codec, meant to be more human readable than \p name
      const int *supported_samplerates;       ///< array of supported  
audio samplerates, or NULL if unknown, array is terminated by 0
+
+    /**
+     * Multithreading support functions.
+     */
+    int (*init_copy)(AVCodecContext *);     ///< called after copying  
initially, re-allocate all writable tables
+    int (*update_context)(AVCodecContext *, AVCodecContext *from); /// 
< called with the context of the last frame before every decode
  } AVCodec;

  /**
-- 
1.5.5.1





More information about the FFmpeg-soc mailing list