| 148 | } |
| 149 | |
| 150 | int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame) |
| 151 | { |
| 152 | size_t size = sizeof(VTHWFrame); |
| 153 | uint8_t *data = NULL; |
| 154 | AVBufferRef *buf = NULL; |
| 155 | int ret = ff_attach_decode_data(frame); |
| 156 | FrameDecodeData *fdd; |
| 157 | if (ret < 0) |
| 158 | return ret; |
| 159 | |
| 160 | data = av_mallocz(size); |
| 161 | if (!data) |
| 162 | return AVERROR(ENOMEM); |
| 163 | buf = av_buffer_create(data, size, videotoolbox_buffer_release, NULL, 0); |
| 164 | if (!buf) { |
| 165 | av_freep(&data); |
| 166 | return AVERROR(ENOMEM); |
| 167 | } |
| 168 | frame->buf[0] = buf; |
| 169 | |
| 170 | fdd = frame->private_ref; |
| 171 | fdd->post_process = videotoolbox_postproc_frame; |
| 172 | |
| 173 | frame->width = avctx->width; |
| 174 | frame->height = avctx->height; |
| 175 | frame->format = avctx->pix_fmt; |
| 176 | |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | #define AV_W8(p, v) *(p) = (v) |
| 181 |
nothing calls this directly
no test coverage detected