FFmpeg  4.3.9
mediacodecdec.c
Go to the documentation of this file.
1 /*
2  * Android MediaCodec MPEG-2 / H.264 / H.265 / MPEG-4 / VP8 / VP9 decoders
3  *
4  * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <stdint.h>
24 #include <string.h>
25 
26 #include "libavutil/avassert.h"
27 #include "libavutil/common.h"
28 #include "libavutil/opt.h"
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/pixfmt.h"
31 #include "libavutil/internal.h"
32 
33 #include "avcodec.h"
34 #include "decode.h"
35 #include "h264_parse.h"
36 #include "hevc_parse.h"
37 #include "hwconfig.h"
38 #include "internal.h"
39 #include "mediacodec_wrapper.h"
40 #include "mediacodecdec_common.h"
41 
42 typedef struct MediaCodecH264DecContext {
43 
45 
47 
49 
52 
54 
56 {
58 
59  ff_mediacodec_dec_close(avctx, s->ctx);
60  s->ctx = NULL;
61 
63 
64  return 0;
65 }
66 
67 #if CONFIG_H264_MEDIACODEC_DECODER || CONFIG_HEVC_MEDIACODEC_DECODER
68 static int h2645_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int *out_size)
69 {
70  int i;
71  int ret = 0;
72  uint8_t *p = NULL;
73  static const uint8_t nalu_header[] = { 0x00, 0x00, 0x00, 0x01 };
74 
75  if (!out || !out_size) {
76  return AVERROR(EINVAL);
77  }
78 
79  p = av_malloc(sizeof(nalu_header) + src_size);
80  if (!p) {
81  return AVERROR(ENOMEM);
82  }
83 
84  *out = p;
85  *out_size = sizeof(nalu_header) + src_size;
86 
87  memcpy(p, nalu_header, sizeof(nalu_header));
88  memcpy(p + sizeof(nalu_header), src, src_size);
89 
90  /* Escape 0x00, 0x00, 0x0{0-3} pattern */
91  for (i = 4; i < *out_size; i++) {
92  if (i < *out_size - 3 &&
93  p[i + 0] == 0 &&
94  p[i + 1] == 0 &&
95  p[i + 2] <= 3) {
96  uint8_t *new;
97 
98  *out_size += 1;
99  new = av_realloc(*out, *out_size);
100  if (!new) {
101  ret = AVERROR(ENOMEM);
102  goto done;
103  }
104  *out = p = new;
105 
106  i = i + 2;
107  memmove(p + i + 1, p + i, *out_size - (i + 1));
108  p[i] = 0x03;
109  }
110  }
111 done:
112  if (ret < 0) {
113  av_freep(out);
114  *out_size = 0;
115  }
116 
117  return ret;
118 }
119 #endif
120 
121 #if CONFIG_H264_MEDIACODEC_DECODER
122 static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
123 {
124  int i;
125  int ret;
126 
127  H264ParamSets ps;
128  const PPS *pps = NULL;
129  const SPS *sps = NULL;
130  int is_avc = 0;
131  int nal_length_size = 0;
132 
133  memset(&ps, 0, sizeof(ps));
134 
136  &ps, &is_avc, &nal_length_size, 0, avctx);
137  if (ret < 0) {
138  goto done;
139  }
140 
141  for (i = 0; i < MAX_PPS_COUNT; i++) {
142  if (ps.pps_list[i]) {
143  pps = (const PPS*)ps.pps_list[i]->data;
144  break;
145  }
146  }
147 
148  if (pps) {
149  if (ps.sps_list[pps->sps_id]) {
150  sps = (const SPS*)ps.sps_list[pps->sps_id]->data;
151  }
152  }
153 
154  if (pps && sps) {
155  uint8_t *data = NULL;
156  int data_size = 0;
157 
158  if ((ret = h2645_ps_to_nalu(sps->data, sps->data_size, &data, &data_size)) < 0) {
159  goto done;
160  }
161  ff_AMediaFormat_setBuffer(format, "csd-0", (void*)data, data_size);
162  av_freep(&data);
163 
164  if ((ret = h2645_ps_to_nalu(pps->data, pps->data_size, &data, &data_size)) < 0) {
165  goto done;
166  }
167  ff_AMediaFormat_setBuffer(format, "csd-1", (void*)data, data_size);
168  av_freep(&data);
169  } else {
170  av_log(avctx, AV_LOG_ERROR, "Could not extract PPS/SPS from extradata");
171  ret = AVERROR_INVALIDDATA;
172  }
173 
174 done:
175  ff_h264_ps_uninit(&ps);
176 
177  return ret;
178 }
179 #endif
180 
181 #if CONFIG_HEVC_MEDIACODEC_DECODER
182 static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
183 {
184  int i;
185  int ret;
186 
187  HEVCParamSets ps;
188  HEVCSEI sei;
189 
190  const HEVCVPS *vps = NULL;
191  const HEVCPPS *pps = NULL;
192  const HEVCSPS *sps = NULL;
193  int is_nalff = 0;
194  int nal_length_size = 0;
195 
196  uint8_t *vps_data = NULL;
197  uint8_t *sps_data = NULL;
198  uint8_t *pps_data = NULL;
199  int vps_data_size = 0;
200  int sps_data_size = 0;
201  int pps_data_size = 0;
202 
203  memset(&ps, 0, sizeof(ps));
204  memset(&sei, 0, sizeof(sei));
205 
207  &ps, &sei, &is_nalff, &nal_length_size, 0, 1, avctx);
208  if (ret < 0) {
209  goto done;
210  }
211 
212  for (i = 0; i < HEVC_MAX_VPS_COUNT; i++) {
213  if (ps.vps_list[i]) {
214  vps = (const HEVCVPS*)ps.vps_list[i]->data;
215  break;
216  }
217  }
218 
219  for (i = 0; i < HEVC_MAX_PPS_COUNT; i++) {
220  if (ps.pps_list[i]) {
221  pps = (const HEVCPPS*)ps.pps_list[i]->data;
222  break;
223  }
224  }
225 
226  if (pps) {
227  if (ps.sps_list[pps->sps_id]) {
228  sps = (const HEVCSPS*)ps.sps_list[pps->sps_id]->data;
229  }
230  }
231 
232  if (vps && pps && sps) {
233  uint8_t *data;
234  int data_size;
235 
236  if ((ret = h2645_ps_to_nalu(vps->data, vps->data_size, &vps_data, &vps_data_size)) < 0 ||
237  (ret = h2645_ps_to_nalu(sps->data, sps->data_size, &sps_data, &sps_data_size)) < 0 ||
238  (ret = h2645_ps_to_nalu(pps->data, pps->data_size, &pps_data, &pps_data_size)) < 0) {
239  goto done;
240  }
241 
242  data_size = vps_data_size + sps_data_size + pps_data_size;
243  data = av_mallocz(data_size);
244  if (!data) {
245  ret = AVERROR(ENOMEM);
246  goto done;
247  }
248 
249  memcpy(data , vps_data, vps_data_size);
250  memcpy(data + vps_data_size , sps_data, sps_data_size);
251  memcpy(data + vps_data_size + sps_data_size, pps_data, pps_data_size);
252 
253  ff_AMediaFormat_setBuffer(format, "csd-0", data, data_size);
254 
255  av_freep(&data);
256  } else {
257  av_log(avctx, AV_LOG_ERROR, "Could not extract VPS/PPS/SPS from extradata");
258  ret = AVERROR_INVALIDDATA;
259  }
260 
261 done:
262  ff_hevc_ps_uninit(&ps);
263 
264  av_freep(&vps_data);
265  av_freep(&sps_data);
266  av_freep(&pps_data);
267 
268  return ret;
269 }
270 #endif
271 
272 #if CONFIG_MPEG2_MEDIACODEC_DECODER || \
273  CONFIG_MPEG4_MEDIACODEC_DECODER || \
274  CONFIG_VP8_MEDIACODEC_DECODER || \
275  CONFIG_VP9_MEDIACODEC_DECODER
276 static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
277 {
278  int ret = 0;
279 
280  if (avctx->extradata) {
281  ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size);
282  }
283 
284  return ret;
285 }
286 #endif
287 
289 {
290  int ret;
291  int sdk_int;
292 
293  const char *codec_mime = NULL;
294 
295  FFAMediaFormat *format = NULL;
297 
298  format = ff_AMediaFormat_new();
299  if (!format) {
300  av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n");
301  ret = AVERROR_EXTERNAL;
302  goto done;
303  }
304 
305  switch (avctx->codec_id) {
306 #if CONFIG_H264_MEDIACODEC_DECODER
307  case AV_CODEC_ID_H264:
308  codec_mime = "video/avc";
309 
310  ret = h264_set_extradata(avctx, format);
311  if (ret < 0)
312  goto done;
313  break;
314 #endif
315 #if CONFIG_HEVC_MEDIACODEC_DECODER
316  case AV_CODEC_ID_HEVC:
317  codec_mime = "video/hevc";
318 
319  ret = hevc_set_extradata(avctx, format);
320  if (ret < 0)
321  goto done;
322  break;
323 #endif
324 #if CONFIG_MPEG2_MEDIACODEC_DECODER
326  codec_mime = "video/mpeg2";
327 
328  ret = common_set_extradata(avctx, format);
329  if (ret < 0)
330  goto done;
331  break;
332 #endif
333 #if CONFIG_MPEG4_MEDIACODEC_DECODER
334  case AV_CODEC_ID_MPEG4:
335  codec_mime = "video/mp4v-es",
336 
337  ret = common_set_extradata(avctx, format);
338  if (ret < 0)
339  goto done;
340  break;
341 #endif
342 #if CONFIG_VP8_MEDIACODEC_DECODER
343  case AV_CODEC_ID_VP8:
344  codec_mime = "video/x-vnd.on2.vp8";
345 
346  ret = common_set_extradata(avctx, format);
347  if (ret < 0)
348  goto done;
349  break;
350 #endif
351 #if CONFIG_VP9_MEDIACODEC_DECODER
352  case AV_CODEC_ID_VP9:
353  codec_mime = "video/x-vnd.on2.vp9";
354 
355  ret = common_set_extradata(avctx, format);
356  if (ret < 0)
357  goto done;
358  break;
359 #endif
360  default:
361  av_assert0(0);
362  }
363 
364  ff_AMediaFormat_setString(format, "mime", codec_mime);
365  ff_AMediaFormat_setInt32(format, "width", avctx->width);
366  ff_AMediaFormat_setInt32(format, "height", avctx->height);
367 
368  s->ctx = av_mallocz(sizeof(*s->ctx));
369  if (!s->ctx) {
370  av_log(avctx, AV_LOG_ERROR, "Failed to allocate MediaCodecDecContext\n");
371  ret = AVERROR(ENOMEM);
372  goto done;
373  }
374 
375  s->ctx->delay_flush = s->delay_flush;
376 
377  if ((ret = ff_mediacodec_dec_init(avctx, s->ctx, codec_mime, format)) < 0) {
378  s->ctx = NULL;
379  goto done;
380  }
381 
382  av_log(avctx, AV_LOG_INFO,
383  "MediaCodec started successfully: codec = %s, ret = %d\n",
384  s->ctx->codec_name, ret);
385 
386  sdk_int = ff_Build_SDK_INT(avctx);
387  if (sdk_int <= 23 &&
388  strcmp(s->ctx->codec_name, "OMX.amlogic.mpeg2.decoder.awesome") == 0) {
389  av_log(avctx, AV_LOG_INFO, "Enabling workaround for %s on API=%d\n",
390  s->ctx->codec_name, sdk_int);
392  }
393 
394 done:
395  if (format) {
396  ff_AMediaFormat_delete(format);
397  }
398 
399  if (ret < 0) {
401  }
402 
403  return ret;
404 }
405 
407 {
409  int ret;
410  ssize_t index;
411 
412  /* In delay_flush mode, wait until the user has released or rendered
413  all retained frames. */
414  if (s->delay_flush && ff_mediacodec_dec_is_flushing(avctx, s->ctx)) {
415  if (!ff_mediacodec_dec_flush(avctx, s->ctx)) {
416  return AVERROR(EAGAIN);
417  }
418  }
419 
420  /* poll for new frame */
421  ret = ff_mediacodec_dec_receive(avctx, s->ctx, frame, false);
422  if (ret != AVERROR(EAGAIN))
423  return ret;
424 
425  /* feed decoder */
426  while (1) {
427  if (s->ctx->current_input_buffer < 0) {
428  /* poll for input space */
430  if (index < 0) {
431  /* no space, block for an output frame to appear */
432  return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
433  }
435  }
436 
437  /* try to flush any buffered packet data */
438  if (s->buffered_pkt.size > 0) {
439  ret = ff_mediacodec_dec_send(avctx, s->ctx, &s->buffered_pkt, false);
440  if (ret >= 0) {
441  s->buffered_pkt.size -= ret;
442  s->buffered_pkt.data += ret;
443  if (s->buffered_pkt.size <= 0) {
445  } else {
446  av_log(avctx, AV_LOG_WARNING,
447  "could not send entire packet in single input buffer (%d < %d)\n",
448  ret, s->buffered_pkt.size+ret);
449  }
450  } else if (ret < 0 && ret != AVERROR(EAGAIN)) {
451  return ret;
452  }
453 
455  /* fallthrough to fetch next packet regardless of input buffer space */
456  } else {
457  /* poll for space again */
458  continue;
459  }
460  }
461 
462  /* fetch new packet or eof */
463  ret = ff_decode_get_packet(avctx, &s->buffered_pkt);
464  if (ret == AVERROR_EOF) {
465  AVPacket null_pkt = { 0 };
466  ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt, true);
467  if (ret < 0)
468  return ret;
469  return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
470  } else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) {
471  return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
472  } else if (ret < 0) {
473  return ret;
474  }
475  }
476 
477  return AVERROR(EAGAIN);
478 }
479 
481 {
483 
485 
486  ff_mediacodec_dec_flush(avctx, s->ctx);
487 }
488 
490  &(const AVCodecHWConfigInternal) {
491  .public = {
495  .device_type = AV_HWDEVICE_TYPE_MEDIACODEC,
496  },
497  .hwaccel = NULL,
498  },
499  NULL
500 };
501 
502 #define OFFSET(x) offsetof(MediaCodecH264DecContext, x)
503 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
505  { "delay_flush", "Delay flush until hw output buffers are returned to the decoder",
506  OFFSET(delay_flush), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD },
507  { NULL }
508 };
509 
510 #define DECLARE_MEDIACODEC_VCLASS(short_name) \
511 static const AVClass ff_##short_name##_mediacodec_dec_class = { \
512  .class_name = #short_name "_mediacodec", \
513  .item_name = av_default_item_name, \
514  .option = ff_mediacodec_vdec_options, \
515  .version = LIBAVUTIL_VERSION_INT, \
516 };
517 
518 #define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf) \
519 DECLARE_MEDIACODEC_VCLASS(short_name) \
520 AVCodec ff_##short_name##_mediacodec_decoder = { \
521  .name = #short_name "_mediacodec", \
522  .long_name = NULL_IF_CONFIG_SMALL(full_name " Android MediaCodec decoder"), \
523  .type = AVMEDIA_TYPE_VIDEO, \
524  .id = codec_id, \
525  .priv_class = &ff_##short_name##_mediacodec_dec_class, \
526  .priv_data_size = sizeof(MediaCodecH264DecContext), \
527  .init = mediacodec_decode_init, \
528  .receive_frame = mediacodec_receive_frame, \
529  .flush = mediacodec_decode_flush, \
530  .close = mediacodec_decode_close, \
531  .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \
532  .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
533  .bsfs = bsf, \
534  .hw_configs = mediacodec_hw_configs, \
535  .wrapper_name = "mediacodec", \
536 }; \
537 
538 #if CONFIG_H264_MEDIACODEC_DECODER
539 DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb")
540 #endif
541 
542 #if CONFIG_HEVC_MEDIACODEC_DECODER
543 DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
544 #endif
545 
546 #if CONFIG_MPEG2_MEDIACODEC_DECODER
548 #endif
549 
550 #if CONFIG_MPEG4_MEDIACODEC_DECODER
552 #endif
553 
554 #if CONFIG_VP8_MEDIACODEC_DECODER
556 #endif
557 
558 #if CONFIG_VP9_MEDIACODEC_DECODER
560 #endif
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwconfig.h:34
#define NULL
Definition: coverity.c:32
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
Definition: mem.c:134
static const char * format[]
Definition: af_aiir.c:339
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
AVOption.
Definition: opt.h:246
static const AVCodecHWConfigInternal * mediacodec_hw_configs[]
AVBufferRef * vps_list[HEVC_MAX_VPS_COUNT]
Definition: hevc_ps.h:328
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
AVBufferRef * sps_list[MAX_SPS_COUNT]
Definition: h264_ps.h:144
MediaCodecDecContext * ctx
Definition: mediacodecdec.c:46
Sequence parameter set.
Definition: h264_ps.h:44
int size
Definition: packet.h:356
void ff_AMediaFormat_setBuffer(FFAMediaFormat *format, const char *name, void *data, size_t size)
static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
Definition: mediacodecdec.c:55
Picture parameter set.
Definition: h264_ps.h:111
int out_size
Definition: movenc.c:55
H.265 parser code.
int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps, HEVCSEI *sei, int *is_nalff, int *nal_length_size, int err_recognition, int apply_defdispwin, void *logctx)
Definition: hevc_parse.c:80
static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, AVPacket *pkt, bool wait)
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s)
int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
AVBufferRef * sps_list[HEVC_MAX_SPS_COUNT]
Definition: hevc_ps.h:329
uint8_t
#define av_cold
Definition: attributes.h:88
#define av_malloc(s)
AVOptions.
FFAMediaFormat * ff_AMediaFormat_new(void)
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
Definition: decode.c:238
int ff_Build_SDK_INT(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
For decoders, a hardware pixel format which that decoder may be able to decode to if suitable hardwar...
Definition: codec.h:434
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:627
static AVFrame * frame
const char data[16]
Definition: mxf.c:91
int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, int *is_avc, int *nal_length_size, int err_recognition, void *logctx)
Definition: h264_parse.c:462
#define MAX_PPS_COUNT
Definition: h264_ps.h:38
uint8_t * data
Definition: packet.h:355
#define AVERROR_EOF
End of file.
Definition: error.h:55
AVBufferRef * pps_list[HEVC_MAX_PPS_COUNT]
Definition: hevc_ps.h:330
#define av_log(a,...)
#define src
Definition: vp8dsp.c:254
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define AVERROR(e)
Definition: error.h:43
int data_size
Definition: hevc_ps.h:324
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
The codec supports this format via the hw_device_ctx interface.
Definition: codec.h:393
simple assert() macros that are a bit more flexible than ISO C assert().
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
#define OFFSET(x)
int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, AVFrame *frame, bool wait)
common internal API header
size_t data_size
Definition: h264_ps.h:105
The codec supports this format by some ad-hoc method.
Definition: codec.h:422
uint8_t data[4096]
Definition: h264_ps.h:131
void ff_AMediaFormat_setInt32(FFAMediaFormat *format, const char *name, int32_t value)
int width
picture width / height.
Definition: avcodec.h:699
#define s(width, name)
Definition: cbs_vp9.c:257
int data_size
Definition: hevc_ps.h:143
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:51
void ff_AMediaFormat_setString(FFAMediaFormat *format, const char *name, const char *value)
ssize_t ff_AMediaCodec_dequeueInputBuffer(FFAMediaCodec *codec, int64_t timeoutUs)
#define VD
void ff_hevc_ps_uninit(HEVCParamSets *ps)
Definition: hevc_ps.c:1747
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
Libavcodec external API header.
AVBufferRef * pps_list[MAX_PPS_COUNT]
Definition: h264_ps.h:145
enum AVCodecID codec_id
Definition: avcodec.h:536
unsigned int sps_id
seq_parameter_set_id
Definition: hevc_ps.h:250
main external API structure.
Definition: avcodec.h:526
#define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:605
uint8_t * data
The data buffer.
Definition: buffer.h:89
int extradata_size
Definition: avcodec.h:628
Describe the class of an AVClass context structure.
Definition: log.h:67
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
int index
Definition: gxfenc.c:89
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
unsigned int sps_id
Definition: h264_ps.h:112
int ff_AMediaFormat_delete(FFAMediaFormat *format)
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
static void mediacodec_decode_flush(AVCodecContext *avctx)
hardware decoding through MediaCodec
Definition: pixfmt.h:293
static const AVOption ff_mediacodec_vdec_options[]
int data_size
Definition: hevc_ps.h:246
common internal api header.
common internal and external API header
uint8_t data[4096]
Definition: h264_ps.h:104
size_t data_size
Definition: h264_ps.h:132
uint8_t data[4096]
Definition: hevc_ps.h:142
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
void ff_h264_ps_uninit(H264ParamSets *ps)
Uninit H264 param sets structure.
Definition: h264_ps.c:317
int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, const char *mime, FFAMediaFormat *format)
void * priv_data
Definition: avcodec.h:553
pixel format definitions
uint8_t data[4096]
Definition: hevc_ps.h:245
FILE * out
Definition: movenc.c:54
#define av_freep(p)
H.264 decoder/parser shared code.
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:57
This structure stores compressed data.
Definition: packet.h:332
uint8_t data[4096]
Definition: hevc_ps.h:323