FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ohdec.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * Copyright (c) 2025 Zhao Zhili <quinkblack@foxmail.com>
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include <stdbool.h>
24 #include <multimedia/player_framework/native_avcapability.h>
25 #include <multimedia/player_framework/native_avcodec_videodecoder.h>
26 
27 #include "libavutil/fifo.h"
28 #include "libavutil/hwcontext_oh.h"
29 #include "libavutil/imgutils.h"
30 #include "libavutil/mem.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/thread.h"
33 
34 #include "avcodec.h"
35 #include "codec_internal.h"
36 #include "decode.h"
37 #include "hwconfig.h"
38 #include "ohcodec.h"
39 
40 typedef struct OHCodecDecContext {
42  OH_AVCodec *dec;
43  /* A reference count to dec. Each hardware frame has a reference count to
44  * dec. dec will be destroyed only after oh_decode_close and all hardware
45  * frames have been released.
46  */
48 
52 
56 
58 
60  bool eof_sent;
61 
64  int width;
65  int height;
66  int stride;
68  OH_AVPixelFormat pix_fmt;
69 
70  char *name;
71  int allow_sw;
73 
74 typedef struct OHCodecBuffer {
75  uint32_t index;
76  OH_AVBuffer *buffer;
79 
80 static void oh_decode_release(void *opaque, uint8_t *data)
81 {
82  OH_AVCodec *dec = (OH_AVCodec *)data;
83  OH_AVErrCode err = OH_VideoDecoder_Destroy(dec);
84  if (err == AV_ERR_OK)
85  av_log(NULL, AV_LOG_DEBUG, "Destroy decoder success\n");
86  else
87  av_log(NULL, AV_LOG_ERROR, "Destroy decoder failed, %d, %s\n",
88  err, av_err2str(ff_oh_err_to_ff_err(err)));
89 }
90 
92 {
93  const char *name = s->name;
94 
95  if (!name) {
96  const char *mime = ff_oh_mime(avctx->codec_id, avctx);
97  if (!mime)
98  return AVERROR_BUG;
99  OH_AVCapability *cap = OH_AVCodec_GetCapabilityByCategory(mime, false, HARDWARE);
100  if (!cap) {
101  if (!s->allow_sw) {
102  av_log(avctx, AV_LOG_ERROR, "Failed to get hardware codec %s\n", mime);
103  return AVERROR_EXTERNAL;
104  }
105  av_log(avctx, AV_LOG_WARNING,
106  "Failed to get hardware codec %s, try software backend\n", mime);
107  cap = OH_AVCodec_GetCapabilityByCategory(mime, false, SOFTWARE);
108  if (!cap) {
109  av_log(avctx, AV_LOG_ERROR, "Failed to get software codec %s\n", mime);
110  return AVERROR_EXTERNAL;
111  }
112  }
113  name = OH_AVCapability_GetName(cap);
114  if (!name)
115  return AVERROR_EXTERNAL;
116  }
117 
118  s->dec = OH_VideoDecoder_CreateByName(name);
119  if (!s->dec) {
120  av_log(avctx, AV_LOG_ERROR, "Create decoder with name %s failed\n", name);
121  return AVERROR_EXTERNAL;
122  }
123  av_log(avctx, AV_LOG_DEBUG, "Create decoder %s success\n", name);
124 
125  s->dec_ref = av_buffer_create((uint8_t *)s->dec, 0, oh_decode_release,
126  NULL, 0);
127  if (!s->dec_ref)
128  return AVERROR(ENOMEM);
129 
130  return 0;
131 }
132 
134 {
135  int ret;
136  OHNativeWindow *window = NULL;
137 
138  if (avctx->hw_device_ctx) {
139  AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)(avctx->hw_device_ctx->data);
140  if (device_ctx->type == AV_HWDEVICE_TYPE_OHCODEC) {
141  AVOHCodecDeviceContext *dev = device_ctx->hwctx;
142  window = dev->native_window;
143  s->output_to_window = true;
144  } else {
145  av_log(avctx, AV_LOG_WARNING, "Ignore invalid hw device type %s\n",
146  av_hwdevice_get_type_name(device_ctx->type));
147  }
148  }
149 
150  if (avctx->width <= 0 || avctx->height <= 0) {
151  av_log(avctx, AV_LOG_ERROR,
152  "Invalid width/height (%dx%d), width and height are mandatory for ohcodec\n",
153  avctx->width, avctx->height);
154  return AVERROR(EINVAL);
155  }
156 
157  OH_AVFormat *format = OH_AVFormat_Create();
158  if (!format)
159  return AVERROR(ENOMEM);
160 
161  OH_AVFormat_SetIntValue(format, OH_MD_KEY_WIDTH, avctx->width);
162  OH_AVFormat_SetIntValue(format, OH_MD_KEY_HEIGHT, avctx->height);
163  if (!s->output_to_window)
164  OH_AVFormat_SetIntValue(format, OH_MD_KEY_PIXEL_FORMAT,
165  AV_PIXEL_FORMAT_NV12);
166  else
167  OH_AVFormat_SetIntValue(format, OH_MD_KEY_PIXEL_FORMAT,
168  AV_PIXEL_FORMAT_SURFACE_FORMAT);
169  OH_AVErrCode err = OH_VideoDecoder_Configure(s->dec, format);
170  OH_AVFormat_Destroy(format);
171  if (err != AV_ERR_OK) {
172  ret = ff_oh_err_to_ff_err(err);
173  av_log(avctx, AV_LOG_ERROR, "Decoder configure failed, %d, %s\n",
174  err, av_err2str(ret));
175  return ret;
176  }
177 
178  if (s->output_to_window) {
179  err = OH_VideoDecoder_SetSurface(s->dec, window);
180  if (err != AV_ERR_OK) {
181  ret = ff_oh_err_to_ff_err(err);
182  av_log(avctx, AV_LOG_ERROR, "Set surface failed, %d, %s\n",
183  err, av_err2str(ret));
184  return ret;
185  }
186  }
187 
188  return 0;
189 }
190 
191 static void oh_decode_on_err(OH_AVCodec *codec, int32_t err, void *userdata)
192 {
193  AVCodecContext *avctx = userdata;
194  OHCodecDecContext *s = avctx->priv_data;
195 
196  // Careful on the lock order.
197  // Always lock input first.
198  ff_mutex_lock(&s->input_mutex);
199  ff_mutex_lock(&s->output_mutex);
200  s->decode_status = ff_oh_err_to_ff_err(err);
201  ff_mutex_unlock(&s->output_mutex);
202  ff_mutex_unlock(&s->input_mutex);
203 
204  ff_cond_signal(&s->output_cond);
205  ff_cond_signal(&s->input_cond);
206 }
207 
208 static void oh_decode_on_stream_changed(OH_AVCodec *codec, OH_AVFormat *format,
209  void *userdata)
210 {
211  AVCodecContext *avctx = userdata;
212  OHCodecDecContext *s = avctx->priv_data;
213  int32_t n;
214  double d;
215 
216  if (!OH_AVFormat_GetIntValue(format, OH_MD_KEY_VIDEO_PIC_WIDTH, &s->width) ||
217  !OH_AVFormat_GetIntValue(format, OH_MD_KEY_VIDEO_PIC_HEIGHT, &s->height) ||
218  !OH_AVFormat_GetIntValue(format, OH_MD_KEY_VIDEO_STRIDE, &s->stride) ||
219  !OH_AVFormat_GetIntValue(format, OH_MD_KEY_VIDEO_SLICE_HEIGHT,
220  &s->slice_height)) {
221  av_log(avctx, AV_LOG_ERROR, "Get dimension info from format failed\n");
222  goto out;
223  }
224 
225  if (ff_set_dimensions(avctx, s->width, s->height) < 0)
226  goto out;
227 
228  if (s->stride <= 0 || s->slice_height <= 0) {
229  av_log(avctx, AV_LOG_ERROR,
230  "Buffer stride (%d) or slice height (%d) is invalid\n",
231  s->stride, s->slice_height);
232  goto out;
233  }
234 
235  if (OH_AVFormat_GetIntValue(format, OH_MD_KEY_PIXEL_FORMAT, &n)) {
236  s->pix_fmt = n;
237  /* When use output_to_window, the returned format is the memory
238  * layout of hardware frame, not AV_PIXEL_FORMAT_SURFACE_FORMAT as
239  * expected.
240  */
241  if (s->output_to_window)
242  avctx->pix_fmt = AV_PIX_FMT_OHCODEC;
243  else
244  avctx->pix_fmt = ff_oh_pix_to_ff_pix(s->pix_fmt);
245  // Check whether this pixel format is supported
246  if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
247  av_log(avctx, AV_LOG_ERROR, "Unsupported OH_AVPixelFormat %d\n",
248  n);
249  goto out;
250  }
251  } else {
252  av_log(avctx, AV_LOG_ERROR, "Failed to get pixel format\n");
253  goto out;
254  }
255 
256  if (OH_AVFormat_GetIntValue(format,
257  OH_MD_KEY_MATRIX_COEFFICIENTS,
258  &n))
259  avctx->colorspace = n;
260  if (OH_AVFormat_GetIntValue(format,
261  OH_MD_KEY_COLOR_PRIMARIES,
262  &n))
263  avctx->color_primaries = n;
264  if (OH_AVFormat_GetIntValue(format,
265  OH_MD_KEY_TRANSFER_CHARACTERISTICS,
266  &n))
267  avctx->color_trc = n;
268  if (OH_AVFormat_GetIntValue(format,
269  OH_MD_KEY_RANGE_FLAG,
270  &n))
272 
273  if (OH_AVFormat_GetDoubleValue(format, OH_MD_KEY_VIDEO_SAR, &d)) {
274  AVRational sar = av_d2q(d, 4096 * 4);
275  ff_set_sar(avctx, sar);
276  }
277 
278  s->got_stream_info = true;
279 
280  return;
281 out:
282  av_log(avctx, AV_LOG_ERROR, "Invalid format from decoder: %s\n",
283  OH_AVFormat_DumpInfo(format));
284  oh_decode_on_err(codec, AV_ERR_UNKNOWN, userdata);
285 }
286 
287 static void oh_decode_on_need_input(OH_AVCodec *codec, uint32_t index,
288  OH_AVBuffer *buffer, void *userdata)
289 {
290  AVCodecContext *avctx = userdata;
291  OHCodecDecContext *s = avctx->priv_data;
292  OHBufferQueueItem item = {
293  index, buffer,
294  };
295 
296  ff_mutex_lock(&s->input_mutex);
297  int ret = av_fifo_write(s->input_queue, &item, 1);
298  if (ret >= 0)
299  ff_cond_signal(&s->input_cond);
300  ff_mutex_unlock(&s->input_mutex);
301 
302  if (ret < 0)
303  oh_decode_on_err(codec, AV_ERR_NO_MEMORY, userdata);
304 }
305 
306 static void oh_decode_on_output(OH_AVCodec *codec, uint32_t index,
307  OH_AVBuffer *buffer, void *userdata)
308 {
309  AVCodecContext *avctx = userdata;
310  OHCodecDecContext *s = avctx->priv_data;
311  OHBufferQueueItem item = {
312  index, buffer,
313  };
314 
315  ff_mutex_lock(&s->output_mutex);
316  int ret = av_fifo_write(s->output_queue, &item, 1);
317  if (ret >= 0)
318  ff_cond_signal(&s->output_cond);
319  ff_mutex_unlock(&s->output_mutex);
320 
321  if (ret < 0)
322  oh_decode_on_err(codec, AV_ERR_NO_MEMORY, userdata);
323 }
324 
326 {
327  int ret;
328  OH_AVErrCode err;
329  OH_AVCodecCallback cb = {
330  .onError = oh_decode_on_err,
331  .onStreamChanged = oh_decode_on_stream_changed,
332  .onNeedInputBuffer = oh_decode_on_need_input,
333  .onNewOutputBuffer = oh_decode_on_output,
334  };
335 
336  err = OH_VideoDecoder_RegisterCallback(s->dec, cb, avctx);
337  if (err != AV_ERR_OK) {
338  ret = ff_oh_err_to_ff_err(err);
339  av_log(avctx, AV_LOG_ERROR, "Register callback failed, %d, %s\n",
340  err, av_err2str(ret));
341  return ret;
342  }
343  err = OH_VideoDecoder_Prepare(s->dec);
344  if (err != AV_ERR_OK) {
345  ret = ff_oh_err_to_ff_err(err);
346  av_log(avctx, AV_LOG_ERROR, "Prepare failed, %d, %s\n",
347  err, av_err2str(ret));
348  return ret;
349  }
350  err = OH_VideoDecoder_Start(s->dec);
351  if (err != AV_ERR_OK) {
352  ret = ff_oh_err_to_ff_err(err);
353  av_log(avctx, AV_LOG_ERROR, "Start failed, %d, %s\n",
354  err, av_err2str(ret));
355  return ret;
356  }
357 
358  return 0;
359 }
360 
362 {
363  OHCodecDecContext *s = avctx->priv_data;
364 
365  // Initialize these fields first, so oh_decode_close can destroy them safely
366  ff_mutex_init(&s->input_mutex, NULL);
367  ff_cond_init(&s->input_cond, NULL);
368  ff_mutex_init(&s->output_mutex, NULL);
369  ff_cond_init(&s->output_cond, NULL);
370 
371  int ret = oh_decode_create(s, avctx);
372  if (ret < 0)
373  return ret;
374  ret = oh_decode_set_format(s, avctx);
375  if (ret < 0)
376  return ret;
377 
378  size_t fifo_size = 16;
379  s->input_queue = av_fifo_alloc2(fifo_size, sizeof(OHBufferQueueItem),
381  s->output_queue = av_fifo_alloc2(fifo_size, sizeof(OHBufferQueueItem),
383  if (!s->input_queue || !s->output_queue)
384  return AVERROR(ENOMEM);
385 
386  ret = oh_decode_start(s, avctx);
387  if (ret < 0)
388  return ret;
389 
390  return 0;
391 }
392 
394 {
395  OHCodecDecContext *s = avctx->priv_data;
396 
397  if (s->dec) {
398  /* Stop but don't destroy dec directly, to keep hardware frames on
399  * the fly valid.
400  */
401  OH_AVErrCode err = OH_VideoDecoder_Stop(s->dec);
402  if (err == AV_ERR_OK)
403  av_log(avctx, AV_LOG_DEBUG, "Stop decoder success\n");
404  else
405  av_log(avctx, AV_LOG_ERROR, "Stop decoder failed, %d, %s\n",
406  err, av_err2str(ff_oh_err_to_ff_err(err)));
407  s->dec = NULL;
408  av_buffer_unref(&s->dec_ref);
409  }
410 
411  av_packet_unref(&s->pkt);
412 
413  ff_mutex_destroy(&s->input_mutex);
414  ff_cond_destroy(&s->input_cond);
415  av_fifo_freep2(&s->input_queue);
416 
417  ff_mutex_destroy(&s->output_mutex);
418  ff_cond_destroy(&s->output_cond);
419  av_fifo_freep2(&s->output_queue);
420 
421  return 0;
422 }
423 
424 static void oh_buffer_release(void *opaque, uint8_t *data)
425 {
426  if (!opaque)
427  return;
428 
429  OHCodecBuffer *buffer = opaque;
430 
431  if (!buffer->dec_ref) {
432  av_free(buffer);
433  return;
434  }
435 
436  if (buffer->buffer) {
437  OH_AVCodec *dec = (OH_AVCodec *)buffer->dec_ref->data;
438  OH_AVCodecBufferAttr attr;
439  OH_AVErrCode err = OH_AVBuffer_GetBufferAttr(buffer->buffer, &attr);
440  if (err == AV_ERR_OK && !(attr.flags & AVCODEC_BUFFER_FLAGS_DISCARD))
441  OH_VideoDecoder_RenderOutputBuffer(dec, buffer->index);
442  else
443  OH_VideoDecoder_FreeOutputBuffer(dec, buffer->index);
444  }
445 
446  av_buffer_unref(&buffer->dec_ref);
447  av_free(buffer);
448 }
449 
452  const OH_AVCodecBufferAttr *attr)
453 {
454  OHCodecDecContext *s = avctx->priv_data;
455 
456  frame->width = s->width;
457  frame->height = s->height;
458  int ret = ff_decode_frame_props(avctx, frame);
459  if (ret < 0)
460  return ret;
461 
462  frame->format = AV_PIX_FMT_OHCODEC;
463  OHCodecBuffer *buffer = av_mallocz(sizeof(*buffer));
464  if (!buffer)
465  return AVERROR(ENOMEM);
466 
467  buffer->dec_ref = av_buffer_ref(s->dec_ref);
468  if (!buffer->dec_ref) {
470  return AVERROR(ENOMEM);
471  }
472 
473  buffer->index = output->index;
474  buffer->buffer = output->buffer;
475  frame->buf[0] = av_buffer_create((uint8_t *)buffer->buffer, 1,
478  if (!frame->buf[0]) {
480  return AVERROR(ENOMEM);
481  }
482  // Point to OH_AVBuffer
483  frame->data[3] = frame->buf[0]->data;
484  frame->pts = av_rescale_q(attr->pts, AV_TIME_BASE_Q, avctx->pkt_timebase);
485  frame->pkt_dts = AV_NOPTS_VALUE;
486 
487  return 0;
488 }
489 
492  const OH_AVCodecBufferAttr *attr)
493 {
494  OHCodecDecContext *s = avctx->priv_data;
495 
496  frame->format = avctx->pix_fmt;
497  frame->width = s->width;
498  frame->height = s->height;
499  int ret = ff_get_buffer(avctx, frame, 0);
500  if (ret < 0)
501  return ret;
502 
503  frame->pts = av_rescale_q(attr->pts, AV_TIME_BASE_Q, avctx->pkt_timebase);
504  frame->pkt_dts = AV_NOPTS_VALUE;
505 
506  uint8_t *p = OH_AVBuffer_GetAddr(output->buffer);
507  if (!p) {
508  av_log(avctx, AV_LOG_ERROR, "Failed to get output buffer addr\n");
509  return AVERROR_EXTERNAL;
510  }
511 
512  uint8_t *src[4] = {0};
513  int src_linesizes[4] = {0};
514 
515  ret = av_image_fill_linesizes(src_linesizes, frame->format, s->stride);
516  if (ret < 0)
517  return ret;
518  ret = av_image_fill_pointers(src, frame->format, s->slice_height, p,
519  src_linesizes);
520  if (ret < 0)
521  return ret;
522  av_image_copy2(frame->data, frame->linesize, src, src_linesizes,
523  frame->format, frame->width, frame->height);
524 
525  OH_AVErrCode err = OH_VideoDecoder_FreeOutputBuffer(s->dec, output->index);
526  if (err != AV_ERR_OK) {
527  ret = ff_oh_err_to_ff_err(err);
528  av_log(avctx, AV_LOG_ERROR, "FreeOutputBuffer failed, %d, %s\n", err,
529  av_err2str(ret));
530  return ret;
531  }
532 
533  return 0;
534 }
535 
538 {
539  OHCodecDecContext *s = avctx->priv_data;
540  OH_AVCodecBufferAttr attr;
541 
542  OH_AVErrCode err = OH_AVBuffer_GetBufferAttr(output->buffer, &attr);
543  if (err != AV_ERR_OK)
544  return ff_oh_err_to_ff_err(err);
545 
546  if (attr.flags & AVCODEC_BUFFER_FLAGS_EOS) {
547  av_log(avctx, AV_LOG_DEBUG, "Buffer flag eos\n");
548  OH_VideoDecoder_FreeOutputBuffer(s->dec, output->index);
549  return AVERROR_EOF;
550  }
551 
552  if (!s->got_stream_info) {
553  // This shouldn't happen, add a warning message.
554  av_log(avctx, AV_LOG_WARNING,
555  "decoder didn't notify stream info, try get format explicitly\n");
556 
557  OH_AVFormat *format = OH_VideoDecoder_GetOutputDescription(s->dec);
558  if (!format) {
559  av_log(avctx, AV_LOG_ERROR, "GetOutputDescription failed\n");
560  return AVERROR_EXTERNAL;
561  }
562 
563  oh_decode_on_stream_changed(s->dec, format, avctx);
564  OH_AVFormat_Destroy(format);
565  if (!s->got_stream_info)
566  return AVERROR_EXTERNAL;
567  }
568 
569  if (s->output_to_window)
570  return oh_decode_wrap_hw_buffer(avctx, frame, output, &attr);
571  return oh_decode_wrap_sw_buffer(avctx, frame, output, &attr);
572 }
573 
575 {
576  OHCodecDecContext *s = avctx->priv_data;
577  OH_AVErrCode err;
578  int ret;
579 
580  if (!s->pkt.size && !s->eof_sent) {
581  OH_AVCodecBufferAttr attr = {
582  .flags = AVCODEC_BUFFER_FLAGS_EOS,
583  };
584  err = OH_AVBuffer_SetBufferAttr(input->buffer, &attr);
585  if (err != AV_ERR_OK)
586  return ff_oh_err_to_ff_err(err);
587  err = OH_VideoDecoder_PushInputBuffer(s->dec, input->index);
588  if (err != AV_ERR_OK)
589  return ff_oh_err_to_ff_err(err);
590  s->eof_sent = true;
591  return 0;
592  }
593 
594  uint8_t *p = OH_AVBuffer_GetAddr(input->buffer);
595  int32_t n = OH_AVBuffer_GetCapacity(input->buffer);
596  if (!p || n <= 0) {
597  av_log(avctx, AV_LOG_ERROR,
598  "Failed to get buffer addr (%p) or capacity (%d)\n",
599  p, n);
600  return AVERROR_EXTERNAL;
601  }
602  n = FFMIN(s->pkt.size, n);
603  memcpy(p, s->pkt.data, n);
604 
605  OH_AVCodecBufferAttr attr = {
606  .size = n,
607  .offset = 0,
608  .pts = av_rescale_q(s->pkt.pts, avctx->pkt_timebase,
610  .flags = (s->pkt.flags & AV_PKT_FLAG_KEY)
611  ? AVCODEC_BUFFER_FLAGS_SYNC_FRAME : 0,
612  };
613 
614  err = OH_AVBuffer_SetBufferAttr(input->buffer, &attr);
615  if (err != AV_ERR_OK) {
616  ret = ff_oh_err_to_ff_err(err);
617  return ret;
618  }
619  err = OH_VideoDecoder_PushInputBuffer(s->dec, input->index);
620  if (err != AV_ERR_OK) {
621  ret = ff_oh_err_to_ff_err(err);
622  av_log(avctx, AV_LOG_ERROR, "Push input buffer failed, %d, %s\n",
623  err, av_err2str(ret));
624  return ret;
625  }
626 
627  if (n < s->pkt.size) {
628  s->pkt.size -= n;
629  s->pkt.data += n;
630  } else {
631  av_packet_unref(&s->pkt);
632  }
633 
634  return 0;
635 }
636 
638 {
639  OHCodecDecContext *s = avctx->priv_data;
640 
641  while (1) {
643  int ret;
644 
645  // Try get output
646  ff_mutex_lock(&s->output_mutex);
647  while (!s->decode_status) {
648  if (av_fifo_read(s->output_queue, &buffer, 1) >= 0)
649  break;
650  // Only wait after send EOF
651  if (s->eof_sent && !s->decode_status)
652  ff_cond_wait(&s->output_cond, &s->output_mutex);
653  else
654  break;
655  }
656 
657  ret = s->decode_status;
658  ff_mutex_unlock(&s->output_mutex);
659 
660  // Got a frame
661  if (buffer.buffer)
662  return oh_decode_output_frame(avctx, frame, &buffer);
663  if (ret < 0)
664  return ret;
665 
666  if (!s->pkt.size) {
667  /* fetch new packet or eof */
668  ret = ff_decode_get_packet(avctx, &s->pkt);
669  if (ret < 0 && ret != AVERROR_EOF)
670  return ret;
671  }
672 
673  // Wait input buffer
674  ff_mutex_lock(&s->input_mutex);
675  while (!s->decode_status) {
676  if (av_fifo_read(s->input_queue, &buffer, 1) >= 0)
677  break;
678  ff_cond_wait(&s->input_cond, &s->input_mutex);
679  }
680 
681  ret = s->decode_status;
682  ff_mutex_unlock(&s->input_mutex);
683 
684  if (ret < 0)
685  return ret;
686 
687  ret = oh_decode_send_pkt(avctx, &buffer);
688  if (ret < 0)
689  return ret;
690  }
691 
692  return AVERROR(EAGAIN);
693 }
694 
695 static void oh_decode_flush(AVCodecContext *avctx)
696 {
697  OHCodecDecContext *s = avctx->priv_data;
698 
699  OH_VideoDecoder_Flush(s->dec);
700 
701  ff_mutex_lock(&s->input_mutex);
702  ff_mutex_lock(&s->output_mutex);
703  av_fifo_reset2(s->input_queue);
704  av_fifo_reset2(s->output_queue);
705  s->decode_status = 0;
706  s->eof_sent = false;
707  ff_mutex_unlock(&s->output_mutex);
708  ff_mutex_unlock(&s->input_mutex);
709 
710  OH_VideoDecoder_Start(s->dec);
711 }
712 
713 static const AVCodecHWConfigInternal *const oh_hw_configs[] = {
714  &(const AVCodecHWConfigInternal) {
715  .public = {
719  .device_type = AV_HWDEVICE_TYPE_OHCODEC,
720  },
721  .hwaccel = NULL,
722  },
723  NULL
724 };
725 
726 #define OFFSET(x) offsetof(OHCodecDecContext, x)
727 #define VD (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM)
728 static const AVOption ohcodec_vdec_options[] = {
729  {"codec_name", "Select codec by name",
730  OFFSET(name), AV_OPT_TYPE_STRING, .flags = VD},
731  {"allow_sw", "Allow software decoding",
732  OFFSET(allow_sw), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD},
733  {NULL}
734 };
735 
736 #define DECLARE_OHCODEC_VCLASS(short_name) \
737  static const AVClass short_name##_oh_dec_class = { \
738  .class_name = #short_name "_ohcodec", \
739  .item_name = av_default_item_name, \
740  .option = ohcodec_vdec_options, \
741  .version = LIBAVUTIL_VERSION_INT, \
742  };
743 
744 #define DECLARE_OHCODEC_VDEC(short_name, full_name, codec_id, bsf) \
745  DECLARE_OHCODEC_VCLASS(short_name) \
746  const FFCodec ff_##short_name##_oh_decoder = { \
747  .p.name = #short_name "_ohcodec", \
748  CODEC_LONG_NAME(full_name " OpenHarmony Codec"), \
749  .p.type = AVMEDIA_TYPE_VIDEO, \
750  .p.id = codec_id, \
751  .p.priv_class = &short_name##_oh_dec_class, \
752  .priv_data_size = sizeof(OHCodecDecContext), \
753  .init = oh_decode_init, \
754  FF_CODEC_RECEIVE_FRAME_CB(oh_decode_receive_frame), \
755  .flush = oh_decode_flush, \
756  .close = oh_decode_close, \
757  .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | \
758  AV_CODEC_CAP_HARDWARE, \
759  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \
760  .bsfs = bsf, \
761  .hw_configs = oh_hw_configs, \
762  .p.wrapper_name = "ohcodec", \
763  };
764 
765 #if CONFIG_H264_OH_DECODER
766 DECLARE_OHCODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb")
767 #endif
768 
769 #if CONFIG_HEVC_OH_DECODER
770 DECLARE_OHCODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
771 #endif
hwconfig.h
AVHWDeviceContext::hwctx
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:88
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:432
ff_decode_get_packet
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
Definition: decode.c:244
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
oh_decode_wrap_hw_buffer
static int oh_decode_wrap_hw_buffer(AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output, const OH_AVCodecBufferAttr *attr)
Definition: ohdec.c:450
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
ff_mutex_init
static int ff_mutex_init(AVMutex *mutex, const void *attr)
Definition: thread.h:187
OHCodecDecContext::allow_sw
int allow_sw
Definition: ohdec.c:71
oh_decode_release
static void oh_decode_release(void *opaque, uint8_t *data)
Definition: ohdec.c:80
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:659
OHCodecDecContext::input_cond
AVCond input_cond
Definition: ohdec.c:50
out
FILE * out
Definition: movenc.c:55
cb
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:247
OHBufferQueueItem
Definition: ohcodec.h:33
thread.h
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:263
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:226
oh_decode_on_output
static void oh_decode_on_output(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userdata)
Definition: ohdec.c:306
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:421
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:652
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:767
AVOption
AVOption.
Definition: opt.h:429
data
const char data[16]
Definition: mxf.c:149
oh_decode_receive_frame
static int oh_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: ohdec.c:637
OHCodecBuffer::buffer
OH_AVBuffer * buffer
Definition: ohdec.c:76
oh_decode_create
static int oh_decode_create(OHCodecDecContext *s, AVCodecContext *avctx)
Definition: ohdec.c:91
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:91
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:607
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:442
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:189
window
static SDL_Window * window
Definition: ffplay.c:361
fifo.h
OHCodecDecContext::dec
OH_AVCodec * dec
Definition: ohdec.c:42
OHCodecDecContext::height
int height
Definition: ohdec.c:65
oh_decode_close
static av_cold int oh_decode_close(AVCodecContext *avctx)
Definition: ohdec.c:393
oh_decode_on_stream_changed
static void oh_decode_on_stream_changed(OH_AVCodec *codec, OH_AVFormat *format, void *userdata)
Definition: ohdec.c:208
av_fifo_write
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
Definition: fifo.c:188
AV_CODEC_HW_CONFIG_METHOD_AD_HOC
@ AV_CODEC_HW_CONFIG_METHOD_AD_HOC
The codec supports this format by some ad-hoc method.
Definition: codec.h:327
ohcodec.h
OHCodecDecContext::input_queue
AVFifo * input_queue
Definition: ohdec.c:51
OHCodecDecContext::avclass
AVClass * avclass
Definition: ohdec.c:41
av_image_fill_pointers
int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, uint8_t *ptr, const int linesizes[4])
Fill plane data pointers for an image with pixel format pix_fmt and height height.
Definition: imgutils.c:145
ff_oh_err_to_ff_err
int ff_oh_err_to_ff_err(OH_AVErrCode err)
Definition: ohcodec.c:25
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:63
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:645
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
av_cold
#define av_cold
Definition: attributes.h:90
av_fifo_read
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
Definition: fifo.c:240
AVMutex
#define AVMutex
Definition: thread.h:184
OHCodecDecContext::pkt
AVPacket pkt
Definition: ohdec.c:57
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
s
#define s(width, name)
Definition: cbs_vp9.c:198
OHCodecDecContext::output_mutex
AVMutex output_mutex
Definition: ohdec.c:53
OHCodecDecContext::decode_status
int decode_status
Definition: ohdec.c:59
OHCodecDecContext::eof_sent
bool eof_sent
Definition: ohdec.c:60
AV_BUFFER_FLAG_READONLY
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
Definition: buffer.h:114
oh_buffer_release
static void oh_buffer_release(void *opaque, uint8_t *data)
Definition: ohdec.c:424
hwcontext_oh.h
OHCodecDecContext::input_mutex
AVMutex input_mutex
Definition: ohdec.c:49
ff_cond_wait
static int ff_cond_wait(AVCond *cond, AVMutex *mutex)
Definition: thread.h:198
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
oh_decode_on_need_input
static void oh_decode_on_need_input(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userdata)
Definition: ohdec.c:287
decode.h
AVCond
#define AVCond
Definition: thread.h:192
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
AVCodecHWConfig::pix_fmt
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:339
av_hwdevice_get_type_name
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
Definition: hwcontext.c:120
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:441
oh_decode_send_pkt
static int oh_decode_send_pkt(AVCodecContext *avctx, OHBufferQueueItem *input)
Definition: ohdec.c:574
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:669
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
OHCodecBuffer
Definition: ohdec.c:74
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
ff_set_sar
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:106
oh_decode_set_format
static int oh_decode_set_format(OHCodecDecContext *s, AVCodecContext *avctx)
Definition: ohdec.c:133
OHCodecBuffer::dec_ref
AVBufferRef * dec_ref
Definition: ohdec.c:77
oh_decode_start
static int oh_decode_start(OHCodecDecContext *s, AVCodecContext *avctx)
Definition: ohdec.c:325
index
int index
Definition: gxfenc.c:90
av_buffer_create
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
Definition: buffer.c:55
AV_HWDEVICE_TYPE_OHCODEC
@ AV_HWDEVICE_TYPE_OHCODEC
Definition: hwcontext.h:43
ff_mutex_destroy
static int ff_mutex_destroy(AVMutex *mutex)
Definition: thread.h:190
OHCodecDecContext
Definition: ohdec.c:40
av_fifo_reset2
void av_fifo_reset2(AVFifo *f)
Definition: fifo.c:280
ff_oh_mime
static const char * ff_oh_mime(enum AVCodecID codec_id, void *log)
Definition: ohcodec.h:40
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1635
AVPacket::size
int size
Definition: packet.h:553
AVFifo
Definition: fifo.c:35
codec_internal.h
OHCodecDecContext::stride
int stride
Definition: ohdec.c:66
OHCodecDecContext::pix_fmt
OH_AVPixelFormat pix_fmt
Definition: ohdec.c:68
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:122
AVCodecContext::pkt_timebase
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
Definition: avcodec.h:542
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:247
VD
#define VD
Definition: ohdec.c:727
oh_decode_init
static av_cold int oh_decode_init(AVCodecContext *avctx)
Definition: ohdec.c:361
AVCodecHWConfigInternal
Definition: hwconfig.h:25
oh_hw_configs
static const AVCodecHWConfigInternal *const oh_hw_configs[]
Definition: ohdec.c:713
oh_decode_wrap_sw_buffer
static int oh_decode_wrap_sw_buffer(AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output, const OH_AVCodecBufferAttr *attr)
Definition: ohdec.c:490
OHCodecDecContext::width
int width
Definition: ohdec.c:64
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
ff_mutex_lock
static int ff_mutex_lock(AVMutex *mutex)
Definition: thread.h:188
input
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
Definition: filter_design.txt:172
OHCodecDecContext::name
char * name
Definition: ohdec.c:70
OHCodecBuffer::index
uint32_t index
Definition: ohdec.c:75
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:228
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_d2q
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:106
OHCodecDecContext::dec_ref
AVBufferRef * dec_ref
Definition: ohdec.c:47
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
AVCodecContext::hw_device_ctx
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
Definition: avcodec.h:1475
AVCodecContext::height
int height
Definition: avcodec.h:592
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:631
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:750
avcodec.h
ret
ret
Definition: filter_design.txt:187
AVHWDeviceContext::type
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
Definition: hwcontext.h:75
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
ohcodec_vdec_options
static const AVOption ohcodec_vdec_options[]
Definition: ohdec.c:728
av_fifo_alloc2
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
Definition: fifo.c:47
oh_decode_on_err
static void oh_decode_on_err(OH_AVCodec *codec, int32_t err, void *userdata)
Definition: ohdec.c:191
ff_decode_frame_props
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
Definition: decode.c:1481
AVCodecContext
main external API structure.
Definition: avcodec.h:431
OHCodecDecContext::got_stream_info
bool got_stream_info
Definition: ohdec.c:63
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
av_image_copy2
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition: imgutils.h:184
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
OHCodecDecContext::output_to_window
bool output_to_window
Definition: ohdec.c:62
AVOHCodecDeviceContext
OpenHarmony codec device.
Definition: hwcontext_oh.h:27
ff_oh_pix_to_ff_pix
enum AVPixelFormat ff_oh_pix_to_ff_pix(OH_AVPixelFormat oh_pix)
Definition: ohcodec.c:63
ff_cond_signal
static int ff_cond_signal(AVCond *cond)
Definition: thread.h:196
DECLARE_OHCODEC_VDEC
#define DECLARE_OHCODEC_VDEC(short_name, full_name, codec_id, bsf)
Definition: ohdec.c:744
mem.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
Definition: codec.h:298
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
AV_PIX_FMT_OHCODEC
@ AV_PIX_FMT_OHCODEC
Definition: pixfmt.h:500
ff_cond_destroy
static int ff_cond_destroy(AVCond *cond)
Definition: thread.h:195
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
AVPacket
This structure stores compressed data.
Definition: packet.h:529
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
int32_t
int32_t
Definition: audioconvert.c:56
imgutils.h
oh_decode_flush
static void oh_decode_flush(AVCodecContext *avctx)
Definition: ohdec.c:695
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
av_fifo_freep2
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
Definition: fifo.c:286
ff_cond_init
static int ff_cond_init(AVCond *cond, const void *attr)
Definition: thread.h:194
oh_decode_output_frame
static int oh_decode_output_frame(AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output)
Definition: ohdec.c:536
OFFSET
#define OFFSET(x)
Definition: ohdec.c:726
AVOHCodecDeviceContext::native_window
void * native_window
Pointer to OHNativeWindow.
Definition: hwcontext_oh.h:31
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
OHCodecDecContext::slice_height
int slice_height
Definition: ohdec.c:67
OHCodecDecContext::output_queue
AVFifo * output_queue
Definition: ohdec.c:55
AVCodecHWConfigInternal::public
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwconfig.h:30
src
#define src
Definition: vp8dsp.c:248
fifo_size
size_t fifo_size
Definition: dts2pts.c:371
AV_FIFO_FLAG_AUTO_GROW
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
Definition: fifo.h:63
OHCodecDecContext::output_cond
AVCond output_cond
Definition: ohdec.c:54