| @@ -3093,7 +3093,8 @@ typedef struct AVCodecContext { · 3092 unmodified lines |
| 3093 | 3093 | /** |
| 3094 | 3094 | * A reference to the AVHWFramesContext describing the input (for encoding) |
| 3095 | 3095 | * or output (decoding) frames. The reference is set by the caller and |
| 3096 | | − * afterwards owned (and freed) by libavcodec. |
| 3096 | + * afterwards owned (and freed) by libavcodec - it should never be read by |
| 3097 | + * the caller after being set. |
| 3097 | 3098 | * |
| 3098 | 3099 | * - decoding: This field should be set by the caller from the get_format() |
| 3099 | 3100 | * callback. The previous reference (if any) will always be |
| @@ -3139,6 +3140,28 @@ typedef struct AVCodecContext { · 39 unmodified lines |
| 3139 | 3140 | * (with the display dimensions being determined by the crop_* fields). |
| 3140 | 3141 | */ |
| 3141 | 3142 | int apply_cropping; |
| 3143 | + |
| 3144 | + /** |
| 3145 | + * A reference to the AVHWDeviceContext describing the device which will |
| 3146 | + * be used by a hardware encoder/decoder. The reference is set by the |
| 3147 | + * caller and afterwards owned (and freed) by libavcodec. |
| 3148 | + * |
| 3149 | + * This should be used if either the codec device does not require |
| 3150 | + * hardware frames or any that are used are to be allocated internally by |
| 3151 | + * libavcodec. If the user wishes to supply any of the frames used as |
| 3152 | + * encoder input or decoder output then hw_frames_ctx should be used |
| 3153 | + * instead. When hw_frames_ctx is set in get_format() for a decoder, this |
| 3154 | + * field will be ignored while decoding the associated stream segment, but |
| 3155 | + * may again be used on a following one after another get_format() call. |
| 3156 | + * |
| 3157 | + * For both encoders and decoders this field should be set before |
| 3158 | + * avcodec_open2() is called and must not be written to thereafter. |
| 3159 | + * |
| 3160 | + * Note that some decoders may require this field to be set initially in |
| 3161 | + * order to support hw_frames_ctx at all - in that case, all frames |
| 3162 | + * contexts used must be created on the same device. |
| 3163 | + */ |
| 3164 | + AVBufferRef *hw_device_ctx; |
| 3142 | 3165 | } AVCodecContext; |
| 3143 | 3166 | |
| 3144 | 3167 | /** |