1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci#ifndef AVCODEC_VT_INTERNAL_H
20cabdff1aSopenharmony_ci#define AVCODEC_VT_INTERNAL_H
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#include "avcodec.h"
23cabdff1aSopenharmony_ci#include "videotoolbox.h"
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_citypedef struct VTContext {
26cabdff1aSopenharmony_ci    // The current bitstream buffer.
27cabdff1aSopenharmony_ci    uint8_t                     *bitstream;
28cabdff1aSopenharmony_ci
29cabdff1aSopenharmony_ci    // The current size of the bitstream.
30cabdff1aSopenharmony_ci    int                         bitstream_size;
31cabdff1aSopenharmony_ci
32cabdff1aSopenharmony_ci    // The reference size used for fast reallocation.
33cabdff1aSopenharmony_ci    int                         allocated_size;
34cabdff1aSopenharmony_ci
35cabdff1aSopenharmony_ci    // The core video buffer
36cabdff1aSopenharmony_ci    CVImageBufferRef            frame;
37cabdff1aSopenharmony_ci
38cabdff1aSopenharmony_ci    // Current dummy frames context (depends on exact CVImageBufferRef params).
39cabdff1aSopenharmony_ci    struct AVBufferRef         *cached_hw_frames_ctx;
40cabdff1aSopenharmony_ci
41cabdff1aSopenharmony_ci    // Non-NULL if the new hwaccel API is used. This is only a separate struct
42cabdff1aSopenharmony_ci    // to ease compatibility with the old API.
43cabdff1aSopenharmony_ci    struct AVVideotoolboxContext *vt_ctx;
44cabdff1aSopenharmony_ci
45cabdff1aSopenharmony_ci    // Current H264 parameters (used to trigger decoder restart on SPS changes).
46cabdff1aSopenharmony_ci    uint8_t                     sps[3];
47cabdff1aSopenharmony_ci    bool                        reconfig_needed;
48cabdff1aSopenharmony_ci
49cabdff1aSopenharmony_ci    void *logctx;
50cabdff1aSopenharmony_ci} VTContext;
51cabdff1aSopenharmony_ci
52cabdff1aSopenharmony_ciint ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame);
53cabdff1aSopenharmony_ciint ff_videotoolbox_common_init(AVCodecContext *avctx);
54cabdff1aSopenharmony_ciint ff_videotoolbox_frame_params(AVCodecContext *avctx,
55cabdff1aSopenharmony_ci                                 AVBufferRef *hw_frames_ctx);
56cabdff1aSopenharmony_ciint ff_videotoolbox_buffer_copy(VTContext *vtctx,
57cabdff1aSopenharmony_ci                                const uint8_t *buffer,
58cabdff1aSopenharmony_ci                                uint32_t size);
59cabdff1aSopenharmony_ciint ff_videotoolbox_uninit(AVCodecContext *avctx);
60cabdff1aSopenharmony_ciint ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
61cabdff1aSopenharmony_ci                                     const uint8_t *buffer,
62cabdff1aSopenharmony_ci                                     uint32_t size);
63cabdff1aSopenharmony_ciint ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx,
64cabdff1aSopenharmony_ci                                      const uint8_t *buffer,
65cabdff1aSopenharmony_ci                                      uint32_t size);
66cabdff1aSopenharmony_ciint ff_videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame);
67cabdff1aSopenharmony_ciCFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx);
68cabdff1aSopenharmony_ciCFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx);
69cabdff1aSopenharmony_ciCFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx);
70cabdff1aSopenharmony_ci
71cabdff1aSopenharmony_ci#endif /* AVCODEC_VT_INTERNAL_H */
72