| @@ -3536,7 +3536,8 @@ typedef struct AVCodecContext { · 3535 unmodified lines |
| 3536 | 3536 | /** |
| 3537 | 3537 | * A reference to the AVHWFramesContext describing the input (for encoding) |
| 3538 | 3538 | * or output (decoding) frames. The reference is set by the caller and |
| 3539 | | − * afterwards owned (and freed) by libavcodec. |
| 3539 | + * afterwards owned (and freed) by libavcodec - it should never be read by |
| 3540 | + * the caller after being set. |
| 3540 | 3541 | * |
| 3541 | 3542 | * - decoding: This field should be set by the caller from the get_format() |
| 3542 | 3543 | * callback. The previous reference (if any) will always be |
| @@ -3586,6 +3587,27 @@ typedef struct AVCodecContext { · 43 unmodified lines |
| 3586 | 3587 | */ |
| 3587 | 3588 | int64_t max_pixels; |
| 3588 | 3589 | |
| 3590 | + /** |
| 3591 | + * A reference to the AVHWDeviceContext describing the device which will |
| 3592 | + * be used by a hardware encoder/decoder. The reference is set by the |
| 3593 | + * caller and afterwards owned (and freed) by libavcodec. |
| 3594 | + * |
| 3595 | + * This should be used if either the codec device does not require |
| 3596 | + * hardware frames or any that are used are to be allocated internally by |
| 3597 | + * libavcodec. If the user wishes to supply any of the frames used as |
| 3598 | + * encoder input or decoder output then hw_frames_ctx should be used |
| 3599 | + * instead. When hw_frames_ctx is set in get_format() for a decoder, this |
| 3600 | + * field will be ignored while decoding the associated stream segment, but |
| 3601 | + * may again be used on a following one after another get_format() call. |
| 3602 | + * |
| 3603 | + * For both encoders and decoders this field should be set before |
| 3604 | + * avcodec_open2() is called and must not be written to thereafter. |
| 3605 | + * |
| 3606 | + * Note that some decoders may require this field to be set initially in |
| 3607 | + * order to support hw_frames_ctx at all - in that case, all frames |
| 3608 | + * contexts used must be created on the same device. |
| 3609 | + */ |
| 3610 | + AVBufferRef *hw_device_ctx; |
| 3589 | 3611 | } AVCodecContext; |
| 3590 | 3612 | |
| 3591 | 3613 | AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); |