diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-02-09 00:23:36 +0000 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-02-13 22:06:43 +0000 |
commit | c1a5fca06f75cc0e7b9b2808fecaa0c1b424da50 (patch) | |
tree | 13c46887150c9a8473910f3fc88335d8bdc44a30 /libavcodec/avcodec.h | |
parent | aa234698e92fa856013a1391fac3526b06c4d533 (diff) | |
download | ffmpeg-c1a5fca06f75cc0e7b9b2808fecaa0c1b424da50.tar.gz |
lavc: Add device context field to AVCodecContext
For use by codec implementations which can allocate frames internally.
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3e161ea10e..5616fb01d6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3536,7 +3536,8 @@ typedef struct AVCodecContext { /** * A reference to the AVHWFramesContext describing the input (for encoding) * or output (decoding) frames. The reference is set by the caller and - * afterwards owned (and freed) by libavcodec. + * afterwards owned (and freed) by libavcodec - it should never be read by + * the caller after being set. * * - decoding: This field should be set by the caller from the get_format() * callback. The previous reference (if any) will always be @@ -3586,6 +3587,27 @@ typedef struct AVCodecContext { */ int64_t max_pixels; + /** + * A reference to the AVHWDeviceContext describing the device which will + * be used by a hardware encoder/decoder. The reference is set by the + * caller and afterwards owned (and freed) by libavcodec. + * + * This should be used if either the codec device does not require + * hardware frames or any that are used are to be allocated internally by + * libavcodec. If the user wishes to supply any of the frames used as + * encoder input or decoder output then hw_frames_ctx should be used + * instead. When hw_frames_ctx is set in get_format() for a decoder, this + * field will be ignored while decoding the associated stream segment, but + * may again be used on a following one after another get_format() call. + * + * For both encoders and decoders this field should be set before + * avcodec_open2() is called and must not be written to thereafter. + * + * Note that some decoders may require this field to be set initially in + * order to support hw_frames_ctx at all - in that case, all frames + * contexts used must be created on the same device. + */ + AVBufferRef *hw_device_ctx; } AVCodecContext; AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); |