]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/internal.h
lavc: add MMAL hardware decoder wrapper
[ffmpeg] / libavcodec / internal.h
index 268a7584b24ed5b47e0cd163346cae8e58a2f798..a681329f20d0f63e724f8923f980cb0be551b599 100644 (file)
 #include "avcodec.h"
 #include "config.h"
 
+/**
+ * Codec is thread safe.
+ */
+#define FF_CODEC_CAP_INIT_THREADSAFE        (1 << 0)
+/**
+ * Codec cleans up memory on init failure.
+ */
+#define FF_CODEC_CAP_INIT_CLEANUP           (1 << 1)
+
+
 #define FF_SANE_NB_CHANNELS 63U
 
+#define FF_SIGNBIT(x) (x >> CHAR_BIT * sizeof(x) - 1)
+
 typedef struct FramePool {
     /**
      * Pools for each data plane. For audio all the planes have the same size,
@@ -95,6 +107,11 @@ typedef struct AVCodecInternal {
      * packet into every function.
      */
     AVPacket *pkt;
+
+    /**
+     * hwaccel-specific private data
+     */
+    void *hwaccel_priv_data;
 } AVCodecInternal;
 
 struct AVCodecDefault {
@@ -102,15 +119,6 @@ struct AVCodecDefault {
     const uint8_t *value;
 };
 
-/**
- * Return the hardware accelerated codec for codec codec_id and
- * pixel format pix_fmt.
- *
- * @param avctx The codec context containing the codec_id and pixel format.
- * @return the hardware accelerated codec, or NULL if none was found.
- */
-AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx);
-
 /**
  * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
  * If there is no such matching pair then size is returned.
@@ -180,12 +188,25 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
  */
 int ff_set_dimensions(AVCodecContext *s, int width, int height);
 
+/**
+ * Check that the provided sample aspect ratio is valid and set it on the codec
+ * context.
+ */
+int ff_set_sar(AVCodecContext *avctx, AVRational sar);
+
 /**
  * Add or update AV_FRAME_DATA_MATRIXENCODING side data.
  */
 int ff_side_data_update_matrix_encoding(AVFrame *frame,
                                         enum AVMatrixEncoding matrix_encoding);
 
+/**
+ * Select the (possibly hardware accelerated) pixel format.
+ * This is a wrapper around AVCodecContext.get_format() and should be used
+ * instead of calling get_format() directly.
+ */
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt);
+
 /**
  * Set various frame properties from the codec context / packet data.
  */