aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-06-17 10:16:47 +0200
committerAnton Khirnov <anton@khirnov.net>2021-06-26 19:33:42 +0200
commit296dc876ec885cb90f47afaeb30fbe3b94786e1e (patch)
treef1bef1d8f2a811376f2d8dd954ed5e00a76a9ff1
parent81bad080cd99c3754763d5cfe884f307120eba81 (diff)
downloadffmpeg-296dc876ec885cb90f47afaeb30fbe3b94786e1e.tar.gz
lavc: fix and extend AVCodecContext.get_format doxy
Remove some incorrect (or at least misleading) statements, such as the formats being ordered by quality, or the first format being the native one. Neither of those are true for hardware acceleration, which is the main use of this callback.
-rw-r--r--libavcodec/avcodec.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dabd60386e..8b97895aeb 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -621,17 +621,29 @@ typedef struct AVCodecContext {
int y, int type, int height);
/**
- * callback to negotiate the pixelFormat
- * @param fmt is the list of formats which are supported by the codec,
- * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
- * The first is always the native one.
- * @note The callback may be called again immediately if initialization for
- * the selected (hardware-accelerated) pixel format failed.
- * @warning Behavior is undefined if the callback returns a value not
- * in the fmt list of formats.
- * @return the chosen format
- * - encoding: unused
- * - decoding: Set by user, if not set the native format will be chosen.
+ * Callback to negotiate the pixel format. Decoding only, may be set by the
+ * caller before avcodec_open2().
+ *
+ * Called by some decoders to select the pixel format that will be used for
+ * the output frames. This is mainly used to set up hardware acceleration,
+ * then the provided format list contains the corresponding hwaccel pixel
+ * formats alongside the "software" one. The software pixel format may also
+ * be retrieved from \ref sw_pix_fmt.
+ *
+ * This callback will be called when the coded frame properties (such as
+ * resolution, pixel format, etc.) change and more than one output format is
+ * supported for those new properties. If a hardware pixel format is chosen
+ * and initialization for it fails, the callback may be called again
+ * immediately.
+ *
+ * This callback may be called from different threads if the decoder is
+ * multi-threaded, but not from more than one thread simultaneously.
+ *
+ * @param fmt list of formats which may be used in the current
+ * configuration, terminated by AV_PIX_FMT_NONE.
+ * @warning Behavior is undefined if the callback returns a value other
+ * than one of the formats in fmt or AV_PIX_FMT_NONE.
+ * @return the chosen format or AV_PIX_FMT_NONE
*/
enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);