]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/avcodec.h
simplify
[ffmpeg] / libavcodec / avcodec.h
index 1b36cda5d3cc062d2101e5b27afeeebfa9488d76..db7bbed6dc6e9a0ac720d6a82c70bedf57e0f041 100644 (file)
@@ -37,8 +37,8 @@ extern "C" {
 #define AV_STRINGIFY(s)         AV_TOSTRING(s)
 #define AV_TOSTRING(s) #s
 
-#define LIBAVCODEC_VERSION_INT  ((51<<16)+(35<<8)+0)
-#define LIBAVCODEC_VERSION      51.35.0
+#define LIBAVCODEC_VERSION_INT  ((51<<16)+(40<<8)+0)
+#define LIBAVCODEC_VERSION      51.40.0
 #define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
 
 #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
@@ -150,6 +150,8 @@ enum CodecID {
     CODEC_ID_TIFF,
     CODEC_ID_GIF,
     CODEC_ID_FFH264,
+    CODEC_ID_DXA,
+    CODEC_ID_DNXHD,
 
     /* various pcm "codecs" */
     CODEC_ID_PCM_S16LE= 0x10000,
@@ -384,6 +386,8 @@ typedef struct RcOverride{
 #define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC)
 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format
 #define CODEC_FLAG2_SKIP_RD       0x00004000 ///< RD optimal MB level residual skiping
+#define CODEC_FLAG2_CHUNKS        0x00008000 ///< input bitstream might be truncated at a packet boundaries instead of only at frame boundaries
+#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< use MPEG-2 non linear quantizer
 
 /* Unsupported options :
  *              Syntax Arithmetic coding (SAC)
@@ -739,7 +743,10 @@ typedef struct AVCodecContext {
 
     /**
      * some codecs needs additionnal format info. It is stored here
-     * - encoding: set by user.
+     * if any muxer uses this then ALL demuxers/parsers AND encoders for the specific codec MUST set it correctly
+     * too otherwise stream copy breaks
+     * in general use of this field by muxers is not recommanded
+     * - encoding: set by lavc.
      * - decoding: set by lavc. (FIXME is this ok?)
      */
     int sub_id;
@@ -964,6 +971,13 @@ typedef struct AVCodecContext {
     /**
      * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
      * this is used to workaround some encoder bugs
+     * a demuxer should set this to what is stored in the field used to identify the codec
+     * if there are mutiple such fields in a container then the demuxer should choose the one
+     * which maximizes the information about the used codec
+     * if the codec tag field in a container is larger then 32bit then the demxuer should
+     * remap the longer id to 32bit with a table or other structure alternatively a new
+     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
+     * first
      * - encoding: set by user, if not then the default based on codec_id will be used
      * - decoding: set by user, will be converted to upper case by lavc during init
      */
@@ -2200,6 +2214,7 @@ extern AVCodec snow_encoder;
 extern AVCodec sonic_encoder;
 extern AVCodec sonic_ls_encoder;
 extern AVCodec svq1_encoder;
+extern AVCodec targa_encoder;
 extern AVCodec vcr1_encoder;
 extern AVCodec vorbis_encoder;
 extern AVCodec wmav1_encoder;
@@ -2227,9 +2242,11 @@ extern AVCodec cook_decoder;
 extern AVCodec cscd_decoder;
 extern AVCodec cyuv_decoder;
 extern AVCodec dca_decoder;
+extern AVCodec dnxhd_decoder;
 extern AVCodec dsicinaudio_decoder;
 extern AVCodec dsicinvideo_decoder;
 extern AVCodec dvvideo_decoder;
+extern AVCodec dxa_decoder;
 extern AVCodec eightbps_decoder;
 extern AVCodec ffv1_decoder;
 extern AVCodec ffvhuff_decoder;
@@ -2496,21 +2513,54 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
 enum PixelFormat avcodec_get_pix_fmt(const char* name);
 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
 
-#define FF_LOSS_RESOLUTION  0x0001 /* loss due to resolution change */
-#define FF_LOSS_DEPTH       0x0002 /* loss due to color depth change */
-#define FF_LOSS_COLORSPACE  0x0004 /* loss due to color space conversion */
-#define FF_LOSS_ALPHA       0x0008 /* loss of alpha bits */
-#define FF_LOSS_COLORQUANT  0x0010 /* loss due to color quantization */
-#define FF_LOSS_CHROMA      0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
+#define FF_LOSS_RESOLUTION  0x0001 /**< loss due to resolution change */
+#define FF_LOSS_DEPTH       0x0002 /**< loss due to color depth change */
+#define FF_LOSS_COLORSPACE  0x0004 /**< loss due to color space conversion */
+#define FF_LOSS_ALPHA       0x0008 /**< loss of alpha bits */
+#define FF_LOSS_COLORQUANT  0x0010 /**< loss due to color quantization */
+#define FF_LOSS_CHROMA      0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
 
 /**
- * compute the loss when converting from a pixel format to another
+ * Computes what kind of losses will occur when converting from one specific
+ * pixel format to another.
+ * When converting from one pixel format to another, information loss may occur.
+ * For example, when converting from RGB24 to GRAY, the color information will
+ * be lost. Similarly, other losses occur when converting from some formats to
+ * other formats. These losses can involve loss of chroma, but also loss of
+ * resolution, loss of color depth, loss due to the color space conversion, loss
+ * of the alpha bits or loss due to color quantization.
+ * avcodec_get_fix_fmt_loss() informs you on the various types of losses which
+ * will occur when converting from one pixel format to another.
+ *
+ * @param[in] dst_pix_fmt Destination pixel format.
+ * @param[in] src_pix_fmt Source pixel format.
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @return Combination of flags informing you what kind of losses will occur.
  */
 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
                              int has_alpha);
 
 /**
- * find best pixel format to convert to. Return -1 if none found
+ * Finds the best pixel format to convert to given a certain source pixel
+ * format.  When converting from one pixel format to another, information loss
+ * may occur.  For example, when converting from RGB24 to GRAY, the color
+ * information will be lost. Similarly, other losses occur when converting from
+ * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
+ * the given pixel formats should be used to undergo the least amount of losses.
+ * The pixel formats from which it choses one, are determined by the
+ * \p pix_fmt_mask parameter.
+ *
+ * @code
+ * src_pix_fmt = PIX_FMT_YUV420P;
+ * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
+ * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
+ * @endcode
+ *
+ * @param[in] pix_fmt_mask Bitmask determining which pixel format to choose from.
+ * @param[in] src_pix_fmt Source pixel format.
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
  */
 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
                               int has_alpha, int *loss_ptr);
@@ -2596,6 +2646,10 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  */
 void avcodec_get_context_defaults(AVCodecContext *s);
 
+/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
+ *  we WILL change its arguments and name a few times! */
+void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType);
+
 /**
  * Allocates an AVCodecContext and sets its fields to default values.  The
  * resulting struct can be deallocated by simply calling av_free().
@@ -2605,6 +2659,10 @@ void avcodec_get_context_defaults(AVCodecContext *s);
  */
 AVCodecContext *avcodec_alloc_context(void);
 
+/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
+ *  we WILL change its arguments and name a few times! */
+AVCodecContext *avcodec_alloc_context2(enum CodecType);
+
 /**
  * Sets the fields of the given AVFrame to default values.
  *
@@ -2939,6 +2997,7 @@ extern AVBitStreamFilter noise_bsf;
 extern AVBitStreamFilter mp3_header_compress_bsf;
 extern AVBitStreamFilter mp3_header_decompress_bsf;
 extern AVBitStreamFilter mjpega_dump_header_bsf;
+extern AVBitStreamFilter imx_dump_header_bsf;
 
 
 /* memory */
@@ -2957,7 +3016,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
  * Frees all static arrays and reset their pointers to 0.
  * Call this function to release all statically allocated tables.
  */
-void av_free_static(void);
+attribute_deprecated void av_free_static(void);
 
 /**
  * Allocation of static arrays.
@@ -2967,26 +3026,37 @@ void av_free_static(void);
  * @param[in] size The amount of memory you need in bytes.
  * @return Block of memory of the requested size.
  */
-void *av_mallocz_static(unsigned int size);
+attribute_deprecated void *av_mallocz_static(unsigned int size);
 
 /**
  * Copy image 'src' to 'dst'.
  */
-void img_copy(AVPicture *dst, const AVPicture *src,
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
               int pix_fmt, int width, int height);
 
 /**
  * Crop image top and left side
  */
-int img_crop(AVPicture *dst, const AVPicture *src,
+int av_picture_crop(AVPicture *dst, const AVPicture *src,
              int pix_fmt, int top_band, int left_band);
 
 /**
  * Pad image
  */
-int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
+int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
             int padtop, int padbottom, int padleft, int padright, int *color);
 
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+attribute_deprecated void img_copy(AVPicture *dst, const AVPicture *src,
+              int pix_fmt, int width, int height);
+
+attribute_deprecated int img_crop(AVPicture *dst, const AVPicture *src,
+             int pix_fmt, int top_band, int left_band);
+
+attribute_deprecated int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
+            int padtop, int padbottom, int padleft, int padright, int *color);
+#endif
+
 extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
 
 /* error handling */