This commit adds a reference to the buffer as an argument to start_frame, and adapts all existing code. This allows for asynchronous hardware accelerators to skip copying packet data by referencing it.
Showing the changes to libavcodec (58 of 58 files). Show all
Unified · Split
| @@ -1389,7 +1389,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) · 1388 unmodified lines | |||
| 1389 | s->cur_frame.temporal_id = header->temporal_id; | 1389 | s->cur_frame.temporal_id = header->temporal_id; |
| 1390 | 1390 | ||
| 1391 | if (avctx->hwaccel && s->cur_frame.f) { | 1391 | if (avctx->hwaccel && s->cur_frame.f) { |
| 1392 | ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size); | 1392 | ret = FF_HW_CALL(avctx, start_frame, s->pkt->buf, |
| 1393 | unit->data, unit->data_size); | ||
| 1393 | if (ret < 0) { | 1394 | if (ret < 0) { |
| 1394 | av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n"); | 1395 | av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n"); |
| 1395 | goto end; | 1396 | goto end; |
| @@ -45,7 +45,10 @@ typedef struct AV1DecodePictureContext { · 44 unmodified lines | |||
| 45 | unsigned bitstream_size; | 45 | unsigned bitstream_size; |
| 46 | } AV1DecodePictureContext; | 46 | } AV1DecodePictureContext; |
| 47 | 47 | ||
| 48 | static int d3d12va_av1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 48 | static int d3d12va_av1_start_frame(AVCodecContext *avctx, |
| 49 | av_unused const AVBufferRef *buffer_ref, | ||
| 50 | av_unused const uint8_t *buffer, | ||
| 51 | av_unused uint32_t size) | ||
| 49 | { | 52 | { |
| 50 | const AV1DecContext *h = avctx->priv_data; | 53 | const AV1DecContext *h = avctx->priv_data; |
| 51 | AV1DecodePictureContext *ctx_pic = h->cur_frame.hwaccel_picture_private; | 54 | AV1DecodePictureContext *ctx_pic = h->cur_frame.hwaccel_picture_private; |
| @@ -50,8 +50,9 @@ static void fill_slice_short(DXVA_Slice_H264_Short *slice, · 49 unmodified lines | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static int d3d12va_h264_start_frame(AVCodecContext *avctx, | 52 | static int d3d12va_h264_start_frame(AVCodecContext *avctx, |
| 53 | av_unused const uint8_t *buffer, | 53 | av_unused const AVBufferRef *buffer_ref, |
| 54 | av_unused uint32_t size) | 54 | av_unused const uint8_t *buffer, |
| 55 | av_unused uint32_t size) | ||
| 55 | { | 56 | { |
| 56 | const H264Context *h = avctx->priv_data; | 57 | const H264Context *h = avctx->priv_data; |
| 57 | H264DecodePictureContext *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; | 58 | H264DecodePictureContext *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; |
| @@ -49,7 +49,10 @@ static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, un · 48 unmodified lines | |||
| 49 | slice->wBadSliceChopping = 0; | 49 | slice->wBadSliceChopping = 0; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 52 | static int d3d12va_hevc_start_frame(AVCodecContext *avctx, |
| 53 | av_unused const AVBufferRef *buffer_ref, | ||
| 54 | av_unused const uint8_t *buffer, | ||
| 55 | av_unused uint32_t size) | ||
| 53 | { | 56 | { |
| 54 | const HEVCContext *h = avctx->priv_data; | 57 | const HEVCContext *h = avctx->priv_data; |
| 55 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); | 58 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); |
| @@ -40,7 +40,10 @@ typedef struct D3D12DecodePictureContext { · 39 unmodified lines | |||
| 40 | unsigned bitstream_size; | 40 | unsigned bitstream_size; |
| 41 | } D3D12DecodePictureContext; | 41 | } D3D12DecodePictureContext; |
| 42 | 42 | ||
| 43 | static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 43 | static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, |
| 44 | av_unused const AVBufferRef *buffer_ref, | ||
| 45 | av_unused const uint8_t *buffer, | ||
| 46 | av_unused uint32_t size) | ||
| 44 | { | 47 | { |
| 45 | const MpegEncContext *s = avctx->priv_data; | 48 | const MpegEncContext *s = avctx->priv_data; |
| 46 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); | 49 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); |
| @@ -41,7 +41,10 @@ typedef struct D3D12DecodePictureContext { · 40 unmodified lines | |||
| 41 | unsigned bitstream_size; | 41 | unsigned bitstream_size; |
| 42 | } D3D12DecodePictureContext; | 42 | } D3D12DecodePictureContext; |
| 43 | 43 | ||
| 44 | static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 44 | static int d3d12va_vc1_start_frame(AVCodecContext *avctx, |
| 45 | av_unused const AVBufferRef *buffer_ref, | ||
| 46 | av_unused const uint8_t *buffer, | ||
| 47 | av_unused uint32_t size) | ||
| 45 | { | 48 | { |
| 46 | const VC1Context *v = avctx->priv_data; | 49 | const VC1Context *v = avctx->priv_data; |
| 47 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); | 50 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); |
| @@ -45,7 +45,10 @@ static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, uns · 44 unmodified lines | |||
| 45 | slice->wBadSliceChopping = 0; | 45 | slice->wBadSliceChopping = 0; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static int d3d12va_vp9_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 48 | static int d3d12va_vp9_start_frame(AVCodecContext *avctx, |
| 49 | av_unused const AVBufferRef *buffer_ref, | ||
| 50 | av_unused const uint8_t *buffer, | ||
| 51 | av_unused uint32_t size) | ||
| 49 | { | 52 | { |
| 50 | const VP9SharedContext *h = avctx->priv_data; | 53 | const VP9SharedContext *h = avctx->priv_data; |
| 51 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); | 54 | D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); |
| @@ -272,6 +272,7 @@ int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACont · 271 unmodified lines | |||
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | static int dxva2_av1_start_frame(AVCodecContext *avctx, | 274 | static int dxva2_av1_start_frame(AVCodecContext *avctx, |
| 275 | av_unused const AVBufferRef *buffer_ref, | ||
| 275 | av_unused const uint8_t *buffer, | 276 | av_unused const uint8_t *buffer, |
| 276 | av_unused uint32_t size) | 277 | av_unused uint32_t size) |
| 277 | { | 278 | { |
| @@ -444,6 +444,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 443 unmodified lines | |||
| 444 | 444 | ||
| 445 | 445 | ||
| 446 | static int dxva2_h264_start_frame(AVCodecContext *avctx, | 446 | static int dxva2_h264_start_frame(AVCodecContext *avctx, |
| 447 | av_unused const AVBufferRef *buffer_ref, | ||
| 447 | av_unused const uint8_t *buffer, | 448 | av_unused const uint8_t *buffer, |
| 448 | av_unused uint32_t size) | 449 | av_unused uint32_t size) |
| 449 | { | 450 | { |
| @@ -363,6 +363,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 362 unmodified lines | |||
| 363 | 363 | ||
| 364 | 364 | ||
| 365 | static int dxva2_hevc_start_frame(AVCodecContext *avctx, | 365 | static int dxva2_hevc_start_frame(AVCodecContext *avctx, |
| 366 | av_unused const AVBufferRef *buffer_ref, | ||
| 366 | av_unused const uint8_t *buffer, | 367 | av_unused const uint8_t *buffer, |
| 367 | av_unused uint32_t size) | 368 | av_unused uint32_t size) |
| 368 | { | 369 | { |
| @@ -257,6 +257,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 256 unmodified lines | |||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, | 259 | static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, |
| 260 | av_unused const AVBufferRef *buffer_ref, | ||
| 260 | av_unused const uint8_t *buffer, | 261 | av_unused const uint8_t *buffer, |
| 261 | av_unused uint32_t size) | 262 | av_unused uint32_t size) |
| 262 | { | 263 | { |
| @@ -315,6 +315,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 314 unmodified lines | |||
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | static int dxva2_vc1_start_frame(AVCodecContext *avctx, | 317 | static int dxva2_vc1_start_frame(AVCodecContext *avctx, |
| 318 | av_unused const AVBufferRef *buffer_ref, | ||
| 318 | av_unused const uint8_t *buffer, | 319 | av_unused const uint8_t *buffer, |
| 319 | av_unused uint32_t size) | 320 | av_unused uint32_t size) |
| 320 | { | 321 | { |
| @@ -254,6 +254,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, · 253 unmodified lines | |||
| 254 | 254 | ||
| 255 | 255 | ||
| 256 | static int dxva2_vp9_start_frame(AVCodecContext *avctx, | 256 | static int dxva2_vp9_start_frame(AVCodecContext *avctx, |
| 257 | av_unused const AVBufferRef *buffer_ref, | ||
| 257 | av_unused const uint8_t *buffer, | 258 | av_unused const uint8_t *buffer, |
| 258 | av_unused uint32_t size) | 259 | av_unused uint32_t size) |
| 259 | { | 260 | { |
| @@ -742,7 +742,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 741 unmodified lines | |||
| 742 | 742 | ||
| 743 | /* Start */ | 743 | /* Start */ |
| 744 | if (hwaccel) { | 744 | if (hwaccel) { |
| 745 | ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size); | 745 | ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); |
| 746 | if (ret < 0) | 746 | if (ret < 0) |
| 747 | return ret; | 747 | return ret; |
| 748 | } | 748 | } |
| @@ -561,7 +561,7 @@ retry: · 560 unmodified lines | |||
| 561 | ff_thread_finish_setup(avctx); | 561 | ff_thread_finish_setup(avctx); |
| 562 | 562 | ||
| 563 | if (avctx->hwaccel) { | 563 | if (avctx->hwaccel) { |
| 564 | ret = FF_HW_CALL(avctx, start_frame, | 564 | ret = FF_HW_CALL(avctx, start_frame, NULL, |
| 565 | s->gb.buffer, s->gb.buffer_end - s->gb.buffer); | 565 | s->gb.buffer, s->gb.buffer_end - s->gb.buffer); |
| 566 | if (ret < 0 ) | 566 | if (ret < 0 ) |
| 567 | return ret; | 567 | return ret; |
| @@ -587,7 +587,8 @@ static void debug_green_metadata(const H264SEIGreenMetaData *gm, void *logctx) · 586 unmodified lines | |||
| 587 | } | 587 | } |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) | 590 | static int decode_nal_units(H264Context *h, AVBufferRef *buf_ref, |
| 591 | const uint8_t *buf, int buf_size) | ||
| 591 | { | 592 | { |
| 592 | AVCodecContext *const avctx = h->avctx; | 593 | AVCodecContext *const avctx = h->avctx; |
| 593 | int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts | 594 | int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts |
| @@ -668,7 +669,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) · 74 unmodified lines | |||
| 668 | } | 669 | } |
| 669 | 670 | ||
| 670 | if (h->avctx->hwaccel && | 671 | if (h->avctx->hwaccel && |
| 671 | (ret = FF_HW_CALL(h->avctx, start_frame, buf, buf_size)) < 0) | 672 | (ret = FF_HW_CALL(h->avctx, start_frame, buf_ref, |
| 673 | buf, buf_size)) < 0) | ||
| 672 | goto end; | 674 | goto end; |
| 673 | } | 675 | } |
| 674 | 676 | ||
| @@ -1053,7 +1055,7 @@ static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 378 unmodified lines | |||
| 1053 | avctx->err_recognition, avctx); | 1055 | avctx->err_recognition, avctx); |
| 1054 | } | 1056 | } |
| 1055 | 1057 | ||
| 1056 | buf_index = decode_nal_units(h, buf, buf_size); | 1058 | buf_index = decode_nal_units(h, avpkt->buf, buf, buf_size); |
| 1057 | if (buf_index < 0) | 1059 | if (buf_index < 0) |
| 1058 | return AVERROR_INVALIDDATA; | 1060 | return AVERROR_INVALIDDATA; |
| 1059 | 1061 | ||
| @@ -3401,7 +3401,10 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l, · 3400 unmodified lines | |||
| 3401 | goto fail; | 3401 | goto fail; |
| 3402 | 3402 | ||
| 3403 | if (s->avctx->hwaccel) { | 3403 | if (s->avctx->hwaccel) { |
| 3404 | ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0); | 3404 | AVCodecInternal *avci = s->avctx->internal; |
| 3405 | AVPacket *avpkt = avci->in_pkt; | ||
| 3406 | ret = FF_HW_CALL(s->avctx, start_frame, | ||
| 3407 | avpkt->buf, NULL, 0); | ||
| 3405 | if (ret < 0) | 3408 | if (ret < 0) |
| 3406 | goto fail; | 3409 | goto fail; |
| 3407 | } | 3410 | } |
| @@ -52,11 +52,13 @@ typedef struct FFHWAccel { · 51 unmodified lines | |||
| 52 | * Otherwise, this means the whole frame is available at this point. | 52 | * Otherwise, this means the whole frame is available at this point. |
| 53 | * | 53 | * |
| 54 | * @param avctx the codec context | 54 | * @param avctx the codec context |
| 55 | * @param buf_ref the frame data buffer reference (optional) | ||
| 55 | * @param buf the frame data buffer base | 56 | * @param buf the frame data buffer base |
| 56 | * @param buf_size the size of the frame in bytes | 57 | * @param buf_size the size of the frame in bytes |
| 57 | * @return zero if successful, a negative value otherwise | 58 | * @return zero if successful, a negative value otherwise |
| 58 | */ | 59 | */ |
| 59 | int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); | 60 | int (*start_frame)(AVCodecContext *avctx, const AVBufferRef *buf_ref, |
| 61 | const uint8_t *buf, uint32_t buf_size); | ||
| 60 | 62 | ||
| 61 | /** | 63 | /** |
| 62 | * Callback for parameter data (SPS/PPS/VPS etc). | 64 | * Callback for parameter data (SPS/PPS/VPS etc). |
| @@ -808,7 +808,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) · 807 unmodified lines | |||
| 808 | if (!s->hwaccel_picture_private) | 808 | if (!s->hwaccel_picture_private) |
| 809 | return AVERROR(ENOMEM); | 809 | return AVERROR(ENOMEM); |
| 810 | 810 | ||
| 811 | ret = hwaccel->start_frame(s->avctx, s->raw_image_buffer, | 811 | ret = hwaccel->start_frame(s->avctx, NULL, s->raw_image_buffer, |
| 812 | s->raw_image_buffer_size); | 812 | s->raw_image_buffer_size); |
| 813 | if (ret < 0) | 813 | if (ret < 0) |
| 814 | return ret; | 814 | return ret; |
| @@ -1361,7 +1361,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) · 1360 unmodified lines | |||
| 1361 | } | 1361 | } |
| 1362 | 1362 | ||
| 1363 | if (avctx->hwaccel) { | 1363 | if (avctx->hwaccel) { |
| 1364 | if ((ret = FF_HW_CALL(avctx, start_frame, buf, buf_size)) < 0) | 1364 | if ((ret = FF_HW_CALL(avctx, start_frame, NULL, buf, buf_size)) < 0) |
| 1365 | return ret; | 1365 | return ret; |
| 1366 | } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) { | 1366 | } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) { |
| 1367 | // Exchange UV | 1367 | // Exchange UV |
| @@ -39,7 +39,9 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) · 38 unmodified lines | |||
| 39 | return 8; | 39 | return 8; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 42 | static int nvdec_av1_start_frame(AVCodecContext *avctx, |
| 43 | const AVBufferRef *buffer_ref, | ||
| 44 | const uint8_t *buffer, uint32_t size) | ||
| 43 | { | 45 | { |
| 44 | const AV1DecContext *s = avctx->priv_data; | 46 | const AV1DecContext *s = avctx->priv_data; |
| 45 | const AV1RawSequenceHeader *seq = s->raw_seq; | 47 | const AV1RawSequenceHeader *seq = s->raw_seq; |
| @@ -47,6 +47,7 @@ static void dpb_add(const H264Context *h, CUVIDH264DPBENTRY *dst, const H264Pict · 46 unmodified lines | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static int nvdec_h264_start_frame(AVCodecContext *avctx, | 49 | static int nvdec_h264_start_frame(AVCodecContext *avctx, |
| 50 | const AVBufferRef *buffer_ref, | ||
| 50 | const uint8_t *buffer, uint32_t size) | 51 | const uint8_t *buffer, uint32_t size) |
| 51 | { | 52 | { |
| 52 | const H264Context *h = avctx->priv_data; | 53 | const H264Context *h = avctx->priv_data; |
| @@ -70,6 +70,7 @@ static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s) · 69 unmodified lines | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static int nvdec_hevc_start_frame(AVCodecContext *avctx, | 72 | static int nvdec_hevc_start_frame(AVCodecContext *avctx, |
| 73 | const AVBufferRef *buffer_ref, | ||
| 73 | const uint8_t *buffer, uint32_t size) | 74 | const uint8_t *buffer, uint32_t size) |
| 74 | { | 75 | { |
| 75 | const HEVCContext *s = avctx->priv_data; | 76 | const HEVCContext *s = avctx->priv_data; |
| @@ -27,7 +27,9 @@ · 26 unmodified lines | |||
| 27 | #include "decode.h" | 27 | #include "decode.h" |
| 28 | #include "hwaccel_internal.h" | 28 | #include "hwaccel_internal.h" |
| 29 | 29 | ||
| 30 | static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 30 | static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, |
| 31 | const AVBufferRef *buffer_ref, | ||
| 32 | const uint8_t *buffer, uint32_t size) | ||
| 31 | { | 33 | { |
| 32 | MJpegDecodeContext *s = avctx->priv_data; | 34 | MJpegDecodeContext *s = avctx->priv_data; |
| 33 | 35 | ||
| @@ -30,7 +30,9 @@ · 29 unmodified lines | |||
| 30 | #include "nvdec.h" | 30 | #include "nvdec.h" |
| 31 | #include "decode.h" | 31 | #include "decode.h" |
| 32 | 32 | ||
| 33 | static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 33 | static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, |
| 34 | const AVBufferRef *buffer_ref, | ||
| 35 | const uint8_t *buffer, uint32_t size) | ||
| 34 | { | 36 | { |
| 35 | MpegEncContext *s = avctx->priv_data; | 37 | MpegEncContext *s = avctx->priv_data; |
| 36 | 38 | ||
| @@ -28,7 +28,9 @@ · 27 unmodified lines | |||
| 28 | #include "decode.h" | 28 | #include "decode.h" |
| 29 | #include "hwaccel_internal.h" | 29 | #include "hwaccel_internal.h" |
| 30 | 30 | ||
| 31 | static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 31 | static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, |
| 32 | const AVBufferRef *buffer_ref, | ||
| 33 | const uint8_t *buffer, uint32_t size) | ||
| 32 | { | 34 | { |
| 33 | Mpeg4DecContext *m = avctx->priv_data; | 35 | Mpeg4DecContext *m = avctx->priv_data; |
| 34 | MpegEncContext *s = &m->m; | 36 | MpegEncContext *s = &m->m; |
| @@ -29,7 +29,9 @@ · 28 unmodified lines | |||
| 29 | #include "decode.h" | 29 | #include "decode.h" |
| 30 | #include "vc1.h" | 30 | #include "vc1.h" |
| 31 | 31 | ||
| 32 | static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 32 | static int nvdec_vc1_start_frame(AVCodecContext *avctx, |
| 33 | const AVBufferRef *buffer_ref, | ||
| 34 | const uint8_t *buffer, uint32_t size) | ||
| 33 | { | 35 | { |
| 34 | VC1Context *v = avctx->priv_data; | 36 | VC1Context *v = avctx->priv_data; |
| 35 | MpegEncContext *s = &v->s; | 37 | MpegEncContext *s = &v->s; |
| @@ -32,7 +32,9 @@ static unsigned char safe_get_ref_idx(VP8Frame *frame) · 31 unmodified lines | |||
| 32 | return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255; | 32 | return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 35 | static int nvdec_vp8_start_frame(AVCodecContext *avctx, |
| 36 | const AVBufferRef *buffer_ref, | ||
| 37 | const uint8_t *buffer, uint32_t size) | ||
| 36 | { | 38 | { |
| 37 | VP8Context *h = avctx->priv_data; | 39 | VP8Context *h = avctx->priv_data; |
| 38 | 40 | ||
| @@ -29,7 +29,9 @@ · 28 unmodified lines | |||
| 29 | #include "internal.h" | 29 | #include "internal.h" |
| 30 | #include "vp9shared.h" | 30 | #include "vp9shared.h" |
| 31 | 31 | ||
| 32 | static int nvdec_vp9_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) | 32 | static int nvdec_vp9_start_frame(AVCodecContext *avctx, |
| 33 | const AVBufferRef *buffer_ref, | ||
| 34 | const uint8_t *buffer, uint32_t size) | ||
| 33 | { | 35 | { |
| 34 | VP9SharedContext *h = avctx->priv_data; | 36 | VP9SharedContext *h = avctx->priv_data; |
| 35 | const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); | 37 | const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); |
| @@ -793,7 +793,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, · 792 unmodified lines | |||
| 793 | 793 | ||
| 794 | if (HWACCEL_MAX && avctx->hwaccel) { | 794 | if (HWACCEL_MAX && avctx->hwaccel) { |
| 795 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); | 795 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); |
| 796 | ret = hwaccel->start_frame(avctx, NULL, 0); | 796 | ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); |
| 797 | if (ret < 0) | 797 | if (ret < 0) |
| 798 | return ret; | 798 | return ret; |
| 799 | ret = hwaccel->decode_slice(avctx, avpkt->data, avpkt->size); | 799 | ret = hwaccel->decode_slice(avctx, avpkt->data, avpkt->size); |
| @@ -108,6 +108,7 @@ static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx) · 107 unmodified lines | |||
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | static int vaapi_av1_start_frame(AVCodecContext *avctx, | 110 | static int vaapi_av1_start_frame(AVCodecContext *avctx, |
| 111 | av_unused const AVBufferRef *buffer_ref, | ||
| 111 | av_unused const uint8_t *buffer, | 112 | av_unused const uint8_t *buffer, |
| 112 | av_unused uint32_t size) | 113 | av_unused uint32_t size) |
| 113 | { | 114 | { |
| @@ -232,6 +232,7 @@ static void fill_vaapi_plain_pred_weight_table(const H264Context *h, · 231 unmodified lines | |||
| 232 | 232 | ||
| 233 | /** Initialize and start decoding a frame with VA API. */ | 233 | /** Initialize and start decoding a frame with VA API. */ |
| 234 | static int vaapi_h264_start_frame(AVCodecContext *avctx, | 234 | static int vaapi_h264_start_frame(AVCodecContext *avctx, |
| 235 | av_unused const AVBufferRef *buffer_ref, | ||
| 235 | av_unused const uint8_t *buffer, | 236 | av_unused const uint8_t *buffer, |
| 236 | av_unused uint32_t size) | 237 | av_unused uint32_t size) |
| 237 | { | 238 | { |
| @@ -122,6 +122,7 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, const HEVCLayerCon · 121 unmodified lines | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static int vaapi_hevc_start_frame(AVCodecContext *avctx, | 124 | static int vaapi_hevc_start_frame(AVCodecContext *avctx, |
| 125 | av_unused const AVBufferRef *buffer_ref, | ||
| 125 | av_unused const uint8_t *buffer, | 126 | av_unused const uint8_t *buffer, |
| 126 | av_unused uint32_t size) | 127 | av_unused uint32_t size) |
| 127 | { | 128 | { |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include "mjpegdec.h" | 24 | #include "mjpegdec.h" |
| 25 | 25 | ||
| 26 | static int vaapi_mjpeg_start_frame(AVCodecContext *avctx, | 26 | static int vaapi_mjpeg_start_frame(AVCodecContext *avctx, |
| 27 | av_unused const AVBufferRef *buffer_ref, | ||
| 27 | av_unused const uint8_t *buffer, | 28 | av_unused const uint8_t *buffer, |
| 28 | av_unused uint32_t size) | 29 | av_unused uint32_t size) |
| 29 | { | 30 | { |
| @@ -39,7 +39,10 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s) · 38 unmodified lines | |||
| 39 | return s->first_field || s->picture_structure == PICT_FRAME; | 39 | return s->first_field || s->picture_structure == PICT_FRAME; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 42 | static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, |
| 43 | av_unused const AVBufferRef *buffer_ref, | ||
| 44 | av_unused const uint8_t *buffer, | ||
| 45 | av_unused uint32_t size) | ||
| 43 | { | 46 | { |
| 44 | const MpegEncContext *s = avctx->priv_data; | 47 | const MpegEncContext *s = avctx->priv_data; |
| 45 | VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; | 48 | VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; |
| @@ -45,7 +45,10 @@ static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s) · 44 unmodified lines | |||
| 45 | return 0; | 45 | return 0; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 48 | static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, |
| 49 | av_unused const AVBufferRef *buffer_ref, | ||
| 50 | av_unused const uint8_t *buffer, | ||
| 51 | av_unused uint32_t size) | ||
| 49 | { | 52 | { |
| 50 | Mpeg4DecContext *ctx = avctx->priv_data; | 53 | Mpeg4DecContext *ctx = avctx->priv_data; |
| 51 | MpegEncContext *s = &ctx->m; | 54 | MpegEncContext *s = &ctx->m; |
| @@ -249,7 +249,10 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f · 248 unmodified lines | |||
| 249 | bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v; | 249 | bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) | 252 | static int vaapi_vc1_start_frame(AVCodecContext *avctx, |
| 253 | av_unused const AVBufferRef *buffer_ref, | ||
| 254 | av_unused const uint8_t *buffer, | ||
| 255 | av_unused uint32_t size) | ||
| 253 | { | 256 | { |
| 254 | const VC1Context *v = avctx->priv_data; | 257 | const VC1Context *v = avctx->priv_data; |
| 255 | const MpegEncContext *s = &v->s; | 258 | const MpegEncContext *s = &v->s; |
| @@ -32,6 +32,7 @@ static VASurfaceID vaapi_vp8_surface_id(VP8Frame *vf) · 31 unmodified lines | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | static int vaapi_vp8_start_frame(AVCodecContext *avctx, | 34 | static int vaapi_vp8_start_frame(AVCodecContext *avctx, |
| 35 | av_unused const AVBufferRef *buffer_ref, | ||
| 35 | av_unused const uint8_t *buffer, | 36 | av_unused const uint8_t *buffer, |
| 36 | av_unused uint32_t size) | 37 | av_unused uint32_t size) |
| 37 | { | 38 | { |
| @@ -35,6 +35,7 @@ static VASurfaceID vaapi_vp9_surface_id(const VP9Frame *vf) · 34 unmodified lines | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static int vaapi_vp9_start_frame(AVCodecContext *avctx, | 37 | static int vaapi_vp9_start_frame(AVCodecContext *avctx, |
| 38 | av_unused const AVBufferRef *buffer_ref, | ||
| 38 | av_unused const uint8_t *buffer, | 39 | av_unused const uint8_t *buffer, |
| 39 | av_unused uint32_t size) | 40 | av_unused uint32_t size) |
| 40 | { | 41 | { |
| @@ -80,6 +80,7 @@ static void fill_vaapi_reference_frames(const VVCFrameContext *h, VAPictureParam · 79 unmodified lines | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static int vaapi_vvc_start_frame(AVCodecContext *avctx, | 82 | static int vaapi_vvc_start_frame(AVCodecContext *avctx, |
| 83 | av_unused const AVBufferRef *buffer_ref, | ||
| 83 | av_unused const uint8_t *buffer, | 84 | av_unused const uint8_t *buffer, |
| 84 | av_unused uint32_t size) | 85 | av_unused uint32_t size) |
| 85 | { | 86 | { |
| @@ -1087,7 +1087,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 1086 unmodified lines | |||
| 1087 | if (v->field_mode && buf_start_second_field) { | 1087 | if (v->field_mode && buf_start_second_field) { |
| 1088 | // decode first field | 1088 | // decode first field |
| 1089 | s->picture_structure = PICT_BOTTOM_FIELD - v->tff; | 1089 | s->picture_structure = PICT_BOTTOM_FIELD - v->tff; |
| 1090 | ret = hwaccel->start_frame(avctx, buf_start, | 1090 | ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start, |
| 1091 | buf_start_second_field - buf_start); | 1091 | buf_start_second_field - buf_start); |
| 1092 | if (ret < 0) | 1092 | if (ret < 0) |
| 1093 | goto err; | 1093 | goto err; |
| @@ -1142,7 +1142,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 48 unmodified lines | |||
| 1142 | } | 1142 | } |
| 1143 | v->s.cur_pic.ptr->f->pict_type = v->s.pict_type; | 1143 | v->s.cur_pic.ptr->f->pict_type = v->s.pict_type; |
| 1144 | 1144 | ||
| 1145 | ret = hwaccel->start_frame(avctx, buf_start_second_field, | 1145 | ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start_second_field, |
| 1146 | (buf + buf_size) - buf_start_second_field); | 1146 | (buf + buf_size) - buf_start_second_field); |
| 1147 | if (ret < 0) | 1147 | if (ret < 0) |
| 1148 | goto err; | 1148 | goto err; |
| @@ -1185,7 +1185,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 36 unmodified lines | |||
| 1185 | goto err; | 1185 | goto err; |
| 1186 | } else { | 1186 | } else { |
| 1187 | s->picture_structure = PICT_FRAME; | 1187 | s->picture_structure = PICT_FRAME; |
| 1188 | ret = hwaccel->start_frame(avctx, buf_start, | 1188 | ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start, |
| 1189 | (buf + buf_size) - buf_start); | 1189 | (buf + buf_size) - buf_start); |
| 1190 | if (ret < 0) | 1190 | if (ret < 0) |
| 1191 | goto err; | 1191 | goto err; |
| @@ -41,7 +41,8 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) · 40 unmodified lines | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | static int vdpau_av1_start_frame(AVCodecContext *avctx, | 43 | static int vdpau_av1_start_frame(AVCodecContext *avctx, |
| 44 | const uint8_t *buffer, uint32_t size) | 44 | const AVBufferRef *buffer_ref, |
| 45 | const uint8_t *buffer, uint32_t size) | ||
| 45 | { | 46 | { |
| 46 | AV1DecContext *s = avctx->priv_data; | 47 | AV1DecContext *s = avctx->priv_data; |
| 47 | const AV1RawSequenceHeader *seq = s->raw_seq; | 48 | const AV1RawSequenceHeader *seq = s->raw_seq; |
| @@ -118,6 +118,7 @@ static void vdpau_h264_set_reference_frames(AVCodecContext *avctx) · 117 unmodified lines | |||
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | static int vdpau_h264_start_frame(AVCodecContext *avctx, | 120 | static int vdpau_h264_start_frame(AVCodecContext *avctx, |
| 121 | const AVBufferRef *buffer_ref, | ||
| 121 | const uint8_t *buffer, uint32_t size) | 122 | const uint8_t *buffer, uint32_t size) |
| 122 | { | 123 | { |
| 123 | H264Context * const h = avctx->priv_data; | 124 | H264Context * const h = avctx->priv_data; |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | static int vdpau_hevc_start_frame(AVCodecContext *avctx, | 34 | static int vdpau_hevc_start_frame(AVCodecContext *avctx, |
| 35 | const AVBufferRef *buffer_ref, | ||
| 35 | const uint8_t *buffer, uint32_t size) | 36 | const uint8_t *buffer, uint32_t size) |
| 36 | { | 37 | { |
| 37 | HEVCContext *h = avctx->priv_data; | 38 | HEVCContext *h = avctx->priv_data; |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include "vdpau_internal.h" | 32 | #include "vdpau_internal.h" |
| 33 | 33 | ||
| 34 | static int vdpau_mpeg_start_frame(AVCodecContext *avctx, | 34 | static int vdpau_mpeg_start_frame(AVCodecContext *avctx, |
| 35 | const AVBufferRef *buffer_ref, | ||
| 35 | const uint8_t *buffer, uint32_t size) | 36 | const uint8_t *buffer, uint32_t size) |
| 36 | { | 37 | { |
| 37 | MpegEncContext * const s = avctx->priv_data; | 38 | MpegEncContext * const s = avctx->priv_data; |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "vdpau_internal.h" | 30 | #include "vdpau_internal.h" |
| 31 | 31 | ||
| 32 | static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, | 32 | static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, |
| 33 | const AVBufferRef *buffer_ref, | ||
| 33 | const uint8_t *buffer, uint32_t size) | 34 | const uint8_t *buffer, uint32_t size) |
| 34 | { | 35 | { |
| 35 | Mpeg4DecContext *ctx = avctx->priv_data; | 36 | Mpeg4DecContext *ctx = avctx->priv_data; |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include "vdpau_internal.h" | 32 | #include "vdpau_internal.h" |
| 33 | 33 | ||
| 34 | static int vdpau_vc1_start_frame(AVCodecContext *avctx, | 34 | static int vdpau_vc1_start_frame(AVCodecContext *avctx, |
| 35 | const AVBufferRef *buffer_ref, | ||
| 35 | const uint8_t *buffer, uint32_t size) | 36 | const uint8_t *buffer, uint32_t size) |
| 36 | { | 37 | { |
| 37 | VC1Context * const v = avctx->priv_data; | 38 | VC1Context * const v = avctx->priv_data; |
| @@ -29,7 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include "vdpau_internal.h" | 29 | #include "vdpau_internal.h" |
| 30 | 30 | ||
| 31 | static int vdpau_vp9_start_frame(AVCodecContext *avctx, | 31 | static int vdpau_vp9_start_frame(AVCodecContext *avctx, |
| 32 | const uint8_t *buffer, uint32_t size) | 32 | const AVBufferRef *buffer_ref, |
| 33 | const uint8_t *buffer, uint32_t size) | ||
| 33 | { | 34 | { |
| 34 | VP9Context *s = avctx->priv_data; | 35 | VP9Context *s = avctx->priv_data; |
| 35 | VP9SharedContext *h = &(s->s); | 36 | VP9SharedContext *h = &(s->s); |
| @@ -415,6 +415,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) · 414 unmodified lines | |||
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, | 417 | int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, |
| 418 | const AVBufferRef *buffer_ref, | ||
| 418 | const uint8_t *buffer, | 419 | const uint8_t *buffer, |
| 419 | uint32_t size) | 420 | uint32_t size) |
| 420 | { | 421 | { |
| @@ -1084,6 +1085,7 @@ static int videotoolbox_h264_end_frame(AVCodecContext *avctx) · 663 unmodified lines | |||
| 1084 | } | 1085 | } |
| 1085 | 1086 | ||
| 1086 | static int videotoolbox_hevc_start_frame(AVCodecContext *avctx, | 1087 | static int videotoolbox_hevc_start_frame(AVCodecContext *avctx, |
| 1088 | const AVBufferRef *buffer_ref, | ||
| 1087 | const uint8_t *buffer, | 1089 | const uint8_t *buffer, |
| 1088 | uint32_t size) | 1090 | uint32_t size) |
| 1089 | { | 1091 | { |
| @@ -1127,6 +1129,7 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx) · 37 unmodified lines | |||
| 1127 | } | 1129 | } |
| 1128 | 1130 | ||
| 1129 | static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx, | 1131 | static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx, |
| 1132 | const AVBufferRef *buffer_ref, | ||
| 1130 | const uint8_t *buffer, | 1133 | const uint8_t *buffer, |
| 1131 | uint32_t size) | 1134 | uint32_t size) |
| 1132 | { | 1135 | { |
| @@ -1151,8 +1154,9 @@ static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx) · 18 unmodified lines | |||
| 1151 | } | 1154 | } |
| 1152 | 1155 | ||
| 1153 | static int videotoolbox_prores_start_frame(AVCodecContext *avctx, | 1156 | static int videotoolbox_prores_start_frame(AVCodecContext *avctx, |
| 1154 | const uint8_t *buffer, | 1157 | const AVBufferRef *buffer_ref, |
| 1155 | uint32_t size) | 1158 | const uint8_t *buffer, |
| 1159 | uint32_t size) | ||
| 1156 | { | 1160 | { |
| 1157 | return 0; | 1161 | return 0; |
| 1158 | } | 1162 | } |
| @@ -63,6 +63,7 @@ CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx) · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | static int videotoolbox_av1_start_frame(AVCodecContext *avctx, | 65 | static int videotoolbox_av1_start_frame(AVCodecContext *avctx, |
| 66 | const AVBufferRef *buffer_ref, | ||
| 66 | const uint8_t *buffer, | 67 | const uint8_t *buffer, |
| 67 | uint32_t size) | 68 | uint32_t size) |
| 68 | { | 69 | { |
| @@ -104,6 +104,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) · 103 unmodified lines | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static int videotoolbox_vp9_start_frame(AVCodecContext *avctx, | 106 | static int videotoolbox_vp9_start_frame(AVCodecContext *avctx, |
| 107 | const AVBufferRef *buffer_ref, | ||
| 107 | const uint8_t *buffer, | 108 | const uint8_t *buffer, |
| 108 | uint32_t size) | 109 | uint32_t size) |
| 109 | { | 110 | { |
| @@ -2729,7 +2729,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, · 2728 unmodified lines | |||
| 2729 | 2729 | ||
| 2730 | if (!is_vp7 && avctx->hwaccel) { | 2730 | if (!is_vp7 && avctx->hwaccel) { |
| 2731 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); | 2731 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); |
| 2732 | ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size); | 2732 | ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); |
| 2733 | if (ret < 0) | 2733 | if (ret < 0) |
| 2734 | goto err; | 2734 | goto err; |
| 2735 | 2735 | ||
| @@ -1618,7 +1618,7 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1617 unmodified lines | |||
| 1618 | 1618 | ||
| 1619 | if (avctx->hwaccel) { | 1619 | if (avctx->hwaccel) { |
| 1620 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); | 1620 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); |
| 1621 | ret = hwaccel->start_frame(avctx, NULL, 0); | 1621 | ret = hwaccel->start_frame(avctx, pkt->buf, pkt->data, pkt->size); |
| 1622 | if (ret < 0) | 1622 | if (ret < 0) |
| 1623 | return ret; | 1623 | return ret; |
| 1624 | ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size); | 1624 | ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size); |
| @@ -61,6 +61,7 @@ int ff_videotoolbox_buffer_append(VTContext *vtctx, · 60 unmodified lines | |||
| 61 | uint32_t size); | 61 | uint32_t size); |
| 62 | int ff_videotoolbox_uninit(AVCodecContext *avctx); | 62 | int ff_videotoolbox_uninit(AVCodecContext *avctx); |
| 63 | int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, | 63 | int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx, |
| 64 | const AVBufferRef *buffer_ref, | ||
| 64 | const uint8_t *buffer, | 65 | const uint8_t *buffer, |
| 65 | uint32_t size); | 66 | uint32_t size); |
| 66 | int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx, | 67 | int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx, |
| @@ -245,6 +245,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf, · 244 unmodified lines | |||
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | static int vk_av1_start_frame(AVCodecContext *avctx, | 247 | static int vk_av1_start_frame(AVCodecContext *avctx, |
| 248 | av_unused const AVBufferRef *buffer_ref, | ||
| 248 | av_unused const uint8_t *buffer, | 249 | av_unused const uint8_t *buffer, |
| 249 | av_unused uint32_t size) | 250 | av_unused uint32_t size) |
| 250 | { | 251 | { |
| @@ -359,6 +359,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 358 unmodified lines | |||
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | static int vk_h264_start_frame(AVCodecContext *avctx, | 361 | static int vk_h264_start_frame(AVCodecContext *avctx, |
| 362 | av_unused const AVBufferRef *buffer_ref, | ||
| 362 | av_unused const uint8_t *buffer, | 363 | av_unused const uint8_t *buffer, |
| 363 | av_unused uint32_t size) | 364 | av_unused uint32_t size) |
| 364 | { | 365 | { |
| @@ -709,6 +709,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 708 unmodified lines | |||
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | static int vk_hevc_start_frame(AVCodecContext *avctx, | 711 | static int vk_hevc_start_frame(AVCodecContext *avctx, |
| 712 | av_unused const AVBufferRef *buffer_ref, | ||
| 712 | av_unused const uint8_t *buffer, | 713 | av_unused const uint8_t *buffer, |
| 713 | av_unused uint32_t size) | 714 | av_unused uint32_t size) |
| 714 | { | 715 | { |
| @@ -831,7 +831,8 @@ static int frame_setup(VVCFrameContext *fc, VVCContext *s) · 830 unmodified lines | |||
| 831 | return 0; | 831 | return 0; |
| 832 | } | 832 | } |
| 833 | 833 | ||
| 834 | static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit) | 834 | static int decode_slice(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref, |
| 835 | const H2645NAL *nal, const CodedBitstreamUnit *unit) | ||
| 835 | { | 836 | { |
| 836 | int ret; | 837 | int ret; |
| 837 | SliceContext *sc; | 838 | SliceContext *sc; |
| @@ -860,7 +861,7 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, · 22 unmodified lines | |||
| 860 | 861 | ||
| 861 | if (s->avctx->hwaccel) { | 862 | if (s->avctx->hwaccel) { |
| 862 | if (is_first_slice) { | 863 | if (is_first_slice) { |
| 863 | ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0); | 864 | ret = FF_HW_CALL(s->avctx, start_frame, buf_ref, NULL, 0); |
| 864 | if (ret < 0) | 865 | if (ret < 0) |
| 865 | return ret; | 866 | return ret; |
| 866 | } | 867 | } |
| @@ -876,7 +877,8 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, · 9 unmodified lines | |||
| 876 | return 0; | 877 | return 0; |
| 877 | } | 878 | } |
| 878 | 879 | ||
| 879 | static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit) | 880 | static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref, |
| 881 | const H2645NAL *nal, const CodedBitstreamUnit *unit) | ||
| 880 | { | 882 | { |
| 881 | int ret; | 883 | int ret; |
| 882 | 884 | ||
| @@ -902,7 +904,7 @@ static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *n · 19 unmodified lines | |||
| 902 | case VVC_IDR_N_LP: | 904 | case VVC_IDR_N_LP: |
| 903 | case VVC_CRA_NUT: | 905 | case VVC_CRA_NUT: |
| 904 | case VVC_GDR_NUT: | 906 | case VVC_GDR_NUT: |
| 905 | ret = decode_slice(s, fc, nal, unit); | 907 | ret = decode_slice(s, fc, buf_ref, nal, unit); |
| 906 | if (ret < 0) | 908 | if (ret < 0) |
| 907 | return ret; | 909 | return ret; |
| 908 | break; | 910 | break; |
| @@ -940,7 +942,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt) · 31 unmodified lines | |||
| 940 | if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) { | 942 | if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) { |
| 941 | s->last_eos = 1; | 943 | s->last_eos = 1; |
| 942 | } else { | 944 | } else { |
| 943 | ret = decode_nal_unit(s, fc, nal, unit); | 945 | ret = decode_nal_unit(s, fc, avpkt->buf, nal, unit); |
| 944 | if (ret < 0) { | 946 | if (ret < 0) { |
| 945 | av_log(s->avctx, AV_LOG_WARNING, | 947 | av_log(s->avctx, AV_LOG_WARNING, |
| 946 | "Error parsing NAL unit #%d.\n", i); | 948 | "Error parsing NAL unit #%d.\n", i); |