FFmpeg
Data Structures | Functions | Variables
ffmpeg_dec.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/error.h"
#include "libavutil/log.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "libavutil/time.h"
#include "libavutil/timestamp.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/codec.h"
#include "libavfilter/buffersrc.h"
#include "ffmpeg.h"
#include "ffmpeg_utils.h"
#include "thread_queue.h"

Go to the source code of this file.

Data Structures

struct  DecoderPriv
 
struct  DecThreadContext
 

Functions

static DecoderPrivdp_from_dec (Decoder *d)
 
void dec_free (Decoder **pdec)
 
static const char * dec_item_name (void *obj)
 
static int decoder_thread (void *arg)
 
static int dec_alloc (DecoderPriv **pdec, Scheduler *sch, int send_end_ts)
 
static AVRational audio_samplerate_update (DecoderPriv *dp, const AVFrame *frame)
 
static void audio_ts_process (DecoderPriv *dp, AVFrame *frame)
 
static int64_t video_duration_estimate (const DecoderPriv *dp, const AVFrame *frame)
 
static int hwaccel_retrieve_data (AVCodecContext *avctx, AVFrame *input)
 
static int video_frame_process (DecoderPriv *dp, AVFrame *frame)
 
static int copy_av_subtitle (AVSubtitle *dst, const AVSubtitle *src)
 
static void subtitle_free (void *opaque, uint8_t *data)
 
static int subtitle_wrap_frame (AVFrame *frame, AVSubtitle *subtitle, int copy)
 
static int process_subtitle (DecoderPriv *dp, AVFrame *frame)
 
static int fix_sub_duration_heartbeat (DecoderPriv *dp, int64_t signal_pts)
 
static int transcode_subtitles (DecoderPriv *dp, const AVPacket *pkt, AVFrame *frame)
 
static int packet_decode (DecoderPriv *dp, AVPacket *pkt, AVFrame *frame)
 
static int dec_open (DecoderPriv *dp, AVDictionary **dec_opts, const DecoderOpts *o, AVFrame *param_out)
 
static int dec_standalone_open (DecoderPriv *dp, const AVPacket *pkt)
 
static void dec_thread_set_name (const DecoderPriv *dp)
 
static void dec_thread_uninit (DecThreadContext *dt)
 
static int dec_thread_init (DecThreadContext *dt)
 
static enum AVPixelFormat get_format (AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
 
static HWDevicehw_device_match_by_codec (const AVCodec *codec)
 
static int hw_device_setup_for_decode (DecoderPriv *dp, const AVCodec *codec, const char *hwaccel_device)
 
int dec_init (Decoder **pdec, Scheduler *sch, AVDictionary **dec_opts, const DecoderOpts *o, AVFrame *param_out)
 
int dec_create (const OptionsContext *o, const char *arg, Scheduler *sch)
 Create a standalone decoder. More...
 
int dec_filter_add (Decoder *d, InputFilter *ifilter, InputFilterOptions *opts)
 

Variables

static const AVClass dec_class
 

Function Documentation

◆ dp_from_dec()

static DecoderPriv* dp_from_dec ( Decoder d)
static

Definition at line 87 of file ffmpeg_dec.c.

Referenced by dec_filter_add(), and dec_free().

◆ dec_free()

void dec_free ( Decoder **  pdec)

Definition at line 98 of file ffmpeg_dec.c.

Referenced by dec_alloc(), dec_create(), dec_init(), ffmpeg_cleanup(), and ist_free().

◆ dec_item_name()

static const char* dec_item_name ( void *  obj)
static

Definition at line 123 of file ffmpeg_dec.c.

◆ decoder_thread()

static int decoder_thread ( void *  arg)
static

Definition at line 848 of file ffmpeg_dec.c.

Referenced by dec_alloc().

◆ dec_alloc()

static int dec_alloc ( DecoderPriv **  pdec,
Scheduler sch,
int  send_end_ts 
)
static

Definition at line 139 of file ffmpeg_dec.c.

Referenced by dec_create(), and dec_init().

◆ audio_samplerate_update()

static AVRational audio_samplerate_update ( DecoderPriv dp,
const AVFrame frame 
)
static

Definition at line 179 of file ffmpeg_dec.c.

Referenced by audio_ts_process().

◆ audio_ts_process()

static void audio_ts_process ( DecoderPriv dp,
AVFrame frame 
)
static

Definition at line 222 of file ffmpeg_dec.c.

Referenced by packet_decode().

◆ video_duration_estimate()

static int64_t video_duration_estimate ( const DecoderPriv dp,
const AVFrame frame 
)
static

Definition at line 259 of file ffmpeg_dec.c.

Referenced by video_frame_process().

◆ hwaccel_retrieve_data()

static int hwaccel_retrieve_data ( AVCodecContext avctx,
AVFrame input 
)
static

Definition at line 311 of file ffmpeg_dec.c.

Referenced by video_frame_process().

◆ video_frame_process()

static int video_frame_process ( DecoderPriv dp,
AVFrame frame 
)
static

Definition at line 353 of file ffmpeg_dec.c.

Referenced by packet_decode().

◆ copy_av_subtitle()

static int copy_av_subtitle ( AVSubtitle dst,
const AVSubtitle src 
)
static

Definition at line 409 of file ffmpeg_dec.c.

Referenced by subtitle_wrap_frame().

◆ subtitle_free()

static void subtitle_free ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 489 of file ffmpeg_dec.c.

Referenced by subtitle_wrap_frame().

◆ subtitle_wrap_frame()

static int subtitle_wrap_frame ( AVFrame frame,
AVSubtitle subtitle,
int  copy 
)
static

Definition at line 496 of file ffmpeg_dec.c.

Referenced by fix_sub_duration_heartbeat(), and transcode_subtitles().

◆ process_subtitle()

static int process_subtitle ( DecoderPriv dp,
AVFrame frame 
)
static

Definition at line 529 of file ffmpeg_dec.c.

Referenced by fix_sub_duration_heartbeat(), and transcode_subtitles().

◆ fix_sub_duration_heartbeat()

static int fix_sub_duration_heartbeat ( DecoderPriv dp,
int64_t  signal_pts 
)
static

Definition at line 572 of file ffmpeg_dec.c.

Referenced by ost_add(), and transcode_subtitles().

◆ transcode_subtitles()

static int transcode_subtitles ( DecoderPriv dp,
const AVPacket pkt,
AVFrame frame 
)
static

Definition at line 594 of file ffmpeg_dec.c.

Referenced by packet_decode().

◆ packet_decode()

static int packet_decode ( DecoderPriv dp,
AVPacket pkt,
AVFrame frame 
)
static

Definition at line 652 of file ffmpeg_dec.c.

Referenced by decoder_thread().

◆ dec_open()

static int dec_open ( DecoderPriv dp,
AVDictionary **  dec_opts,
const DecoderOpts o,
AVFrame param_out 
)
static

Definition at line 1141 of file ffmpeg_dec.c.

Referenced by dec_init(), and dec_standalone_open().

◆ dec_standalone_open()

static int dec_standalone_open ( DecoderPriv dp,
const AVPacket pkt 
)
static

Definition at line 771 of file ffmpeg_dec.c.

Referenced by decoder_thread().

◆ dec_thread_set_name()

static void dec_thread_set_name ( const DecoderPriv dp)
static

Definition at line 806 of file ffmpeg_dec.c.

Referenced by decoder_thread().

◆ dec_thread_uninit()

static void dec_thread_uninit ( DecThreadContext dt)
static

Definition at line 821 of file ffmpeg_dec.c.

Referenced by dec_thread_init(), and decoder_thread().

◆ dec_thread_init()

static int dec_thread_init ( DecThreadContext dt)
static

Definition at line 829 of file ffmpeg_dec.c.

Referenced by decoder_thread().

◆ get_format()

static enum AVPixelFormat get_format ( AVCodecContext s,
const enum AVPixelFormat pix_fmts 
)
static

Definition at line 962 of file ffmpeg_dec.c.

Referenced by dec_open().

◆ hw_device_match_by_codec()

static HWDevice* hw_device_match_by_codec ( const AVCodec codec)
static

Definition at line 996 of file ffmpeg_dec.c.

Referenced by hw_device_setup_for_decode().

◆ hw_device_setup_for_decode()

static int hw_device_setup_for_decode ( DecoderPriv dp,
const AVCodec codec,
const char *  hwaccel_device 
)
static

Definition at line 1012 of file ffmpeg_dec.c.

Referenced by dec_open().

◆ dec_init()

int dec_init ( Decoder **  pdec,
Scheduler sch,
AVDictionary **  dec_opts,
const DecoderOpts o,
AVFrame param_out 
)
Parameters
dec_optsDictionary filled with decoder options. Its ownership is transferred to the decoder.
param_outIf non-NULL, media properties after opening the decoder are written here.
Return values
>=0non-negative scheduler index on success
<0an error code on failure

Definition at line 1253 of file ffmpeg_dec.c.

Referenced by ist_use().

◆ dec_create()

int dec_create ( const OptionsContext o,
const char *  arg,
Scheduler sch 
)

Create a standalone decoder.

Definition at line 1278 of file ffmpeg_dec.c.

◆ dec_filter_add()

int dec_filter_add ( Decoder d,
InputFilter ifilter,
InputFilterOptions opts 
)

Definition at line 1350 of file ffmpeg_dec.c.

Referenced by ifilter_bind_dec().

Variable Documentation

◆ dec_class

const AVClass dec_class
static
Initial value:
= {
.class_name = "Decoder",
.parent_log_context_offset = 0x42,
.item_name = dec_item_name,
}

Definition at line 130 of file ffmpeg_dec.c.

Referenced by dec_alloc().

dec_item_name
static const char * dec_item_name(void *obj)
Definition: ffmpeg_dec.c:123
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85