#include "config_components.h"
#include <stdbool.h>
#include <multimedia/player_framework/native_avcapability.h>
#include <multimedia/player_framework/native_avcodec_videodecoder.h>
#include "libavutil/fifo.h"
#include "libavutil/hwcontext_oh.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/refstruct.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwconfig.h"
#include "ohcodec.h"
#include "pthread_internal.h"
 
Go to the source code of this file.
 | 
|   | DEFINE_OFFSET_ARRAY (OHCodecDecContext, mutex_cond, mutex_cond_cnt,(OFFSET(input_mutex), OFFSET(output_mutex)),(OFFSET(input_cond), OFFSET(output_cond))) | 
|   | 
| static void  | oh_decode_release (AVRefStructOpaque unused, void *obj) | 
|   | 
| static int  | oh_decode_create (OHCodecDecContext *s, AVCodecContext *avctx) | 
|   | 
| static int  | oh_decode_set_format (OHCodecDecContext *s, AVCodecContext *avctx) | 
|   | 
| static void  | oh_decode_on_err (OH_AVCodec *codec, int32_t err, void *userdata) | 
|   | 
| static void  | oh_decode_on_stream_changed (OH_AVCodec *codec, OH_AVFormat *format, void *userdata) | 
|   | 
| static void  | oh_decode_on_need_input (OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userdata) | 
|   | 
| static void  | oh_decode_on_output (OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userdata) | 
|   | 
| static int  | oh_decode_start (OHCodecDecContext *s, AVCodecContext *avctx) | 
|   | 
| static av_cold int  | oh_decode_init (AVCodecContext *avctx) | 
|   | 
| static av_cold int  | oh_decode_close (AVCodecContext *avctx) | 
|   | 
| static void  | oh_buffer_release (void *opaque, uint8_t *data) | 
|   | 
| static int  | oh_decode_wrap_hw_buffer (AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output, const OH_AVCodecBufferAttr *attr) | 
|   | 
| static int  | oh_decode_wrap_sw_buffer (AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output, const OH_AVCodecBufferAttr *attr) | 
|   | 
| static int  | oh_decode_output_frame (AVCodecContext *avctx, AVFrame *frame, OHBufferQueueItem *output) | 
|   | 
| static int  | oh_decode_send_pkt (AVCodecContext *avctx, OHBufferQueueItem *input) | 
|   | 
| static int  | oh_decode_receive_frame (AVCodecContext *avctx, AVFrame *frame) | 
|   | 
| static void  | oh_decode_flush (AVCodecContext *avctx) | 
|   | 
◆ OFFSET
◆ VD
◆ DECLARE_OHCODEC_VCLASS
      
        
          | #define DECLARE_OHCODEC_VCLASS | 
          ( | 
            | 
          short_name | ) | 
           | 
        
      
 
Value:  static const AVClass short_name##_oh_dec_class = {                           \
 
  };
 
Definition at line 734 of file ohdec.c.
 
 
◆ DECLARE_OHCODEC_VDEC
      
        
          | #define DECLARE_OHCODEC_VDEC | 
          ( | 
            | 
          short_name,  | 
        
        
           | 
           | 
            | 
          full_name,  | 
        
        
           | 
           | 
            | 
          codec_id,  | 
        
        
           | 
           | 
            | 
          bsf  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Value:
  const 
FFCodec ff_##short_name##_oh_decoder = {                               \
 
      .
p.
name = #short_name 
"_ohcodec",                                        \
 
      CODEC_LONG_NAME(full_name " OpenHarmony Codec"),                         \
      .p.priv_class = &short_name##_oh_dec_class,                              \
                        AV_CODEC_CAP_HARDWARE,                                 \
      .bsfs = bsf,                                                             \
      .p.wrapper_name = "ohcodec",                                             \
  };
 
Definition at line 742 of file ohdec.c.
 
 
◆ DEFINE_OFFSET_ARRAY()
◆ oh_decode_release()
◆ oh_decode_create()
◆ oh_decode_set_format()
◆ oh_decode_on_err()
  
  
      
        
          | static void oh_decode_on_err  | 
          ( | 
          OH_AVCodec *  | 
          codec,  | 
         
        
           | 
           | 
          int32_t  | 
          err,  | 
         
        
           | 
           | 
          void *  | 
          userdata  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ oh_decode_on_stream_changed()
  
  
      
        
          | static void oh_decode_on_stream_changed  | 
          ( | 
          OH_AVCodec *  | 
          codec,  | 
         
        
           | 
           | 
          OH_AVFormat *  | 
          format,  | 
         
        
           | 
           | 
          void *  | 
          userdata  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ oh_decode_on_need_input()
  
  
      
        
          | static void oh_decode_on_need_input  | 
          ( | 
          OH_AVCodec *  | 
          codec,  | 
         
        
           | 
           | 
          uint32_t  | 
          index,  | 
         
        
           | 
           | 
          OH_AVBuffer *  | 
          buffer,  | 
         
        
           | 
           | 
          void *  | 
          userdata  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ oh_decode_on_output()
  
  
      
        
          | static void oh_decode_on_output  | 
          ( | 
          OH_AVCodec *  | 
          codec,  | 
         
        
           | 
           | 
          uint32_t  | 
          index,  | 
         
        
           | 
           | 
          OH_AVBuffer *  | 
          buffer,  | 
         
        
           | 
           | 
          void *  | 
          userdata  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ oh_decode_start()
◆ oh_decode_init()
◆ oh_decode_close()
◆ oh_buffer_release()
  
  
      
        
          | static void oh_buffer_release  | 
          ( | 
          void *  | 
          opaque,  | 
         
        
           | 
           | 
          uint8_t *  | 
          data  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ oh_decode_wrap_hw_buffer()
◆ oh_decode_wrap_sw_buffer()
◆ oh_decode_output_frame()
◆ oh_decode_send_pkt()
◆ oh_decode_receive_frame()
◆ oh_decode_flush()
◆ oh_hw_configs
Initial value:
Definition at line 712 of file ohdec.c.
 
 
◆ ohcodec_vdec_options
Initial value:= {
    {"codec_name", "Select codec by name",
    {"allow_sw", "Allow software decoding",
}
 
Definition at line 726 of file ohdec.c.
 
 
 
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
 
#define DECLARE_OHCODEC_VCLASS(short_name)
 
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
 
static int oh_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 
AVCodec p
The public AVCodec.
 
static av_cold int oh_decode_close(AVCodecContext *avctx)
 
@ AV_CODEC_HW_CONFIG_METHOD_AD_HOC
The codec supports this format by some ad-hoc method.
 
#define LIBAVUTIL_VERSION_INT
 
Describe the class of an AVClass context structure.
 
const char * av_default_item_name(void *ptr)
Return the context name.
 
@ AV_HWDEVICE_TYPE_OHCODEC
 
int(* init)(AVBSFContext *ctx)
 
static av_cold int oh_decode_init(AVCodecContext *avctx)
 
static const AVCodecHWConfigInternal *const oh_hw_configs[]
 
const char * name
Name of the codec implementation.
 
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
 
static const AVOption ohcodec_vdec_options[]
 
#define FF_CODEC_RECEIVE_FRAME_CB(func)
 
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
 
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
 
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
 
static void oh_decode_flush(AVCodecContext *avctx)
 
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
 
@ 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...