FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
internal.h File Reference

common internal api header. More...

#include <stdint.h>
#include "libavutil/mathematics.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  InternalBuffer
 
struct  AVCodecInternal
 
struct  AVCodecDefault
 

Macros

#define FF_SANE_NB_CHANNELS   128U
 
#define FF_MAX_EXTRADATA_SIZE   ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
 Maximum size in bytes of extradata.
 

Functions

AVHWAccelff_find_hwaccel (enum AVCodecID codec_id, enum AVPixelFormat pix_fmt)
 Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.
 
int ff_match_2uint16 (const uint16_t(*tab)[2], int size, int a, int b)
 Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
 
unsigned int avpriv_toupper4 (unsigned int x)
 
void ff_init_buffer_info (AVCodecContext *s, AVFrame *frame)
 does needed setup of pkt_pts/pos and such for (re)get_buffer();
 
void avpriv_color_frame (AVFrame *frame, const int color[4])
 
void ff_packet_free_side_data (AVPacket *pkt)
 Remove and free all side data from packet.
 
int ff_lock_avcodec (AVCodecContext *log_ctx)
 
int ff_unlock_avcodec (void)
 
int avpriv_lock_avformat (void)
 
int avpriv_unlock_avformat (void)
 
int ff_alloc_packet2 (AVCodecContext *avctx, AVPacket *avpkt, int size)
 Check AVPacket size and/or allocate data.
 
int ff_alloc_packet (AVPacket *avpkt, int size)
 
static av_always_inline int64_t ff_samples_to_time_base (AVCodecContext *avctx, int64_t samples)
 Rescale from sample rate to AVCodecContext.time_base.
 
int ff_get_buffer (AVCodecContext *avctx, AVFrame *frame)
 Get a buffer for a frame.
 
int ff_thread_can_start_frame (AVCodecContext *avctx)
 
int ff_get_logical_cpus (AVCodecContext *avctx)
 
int avpriv_h264_has_num_reorder_frames (AVCodecContext *avctx)
 
void ff_print_debug_info2 (AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint8_t *visualization_buffer[3], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)
 Print debugging info for the given picture.
 
int ff_codec_open2_recursive (AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
 Call avcodec_open2 recursively by decrementing counter, unlocking mutex, calling the function and then restoring again.
 
int ff_codec_close_recursive (AVCodecContext *avctx)
 Call avcodec_close recursively, counterpart to avcodec_open2_recursive.
 
int avpriv_bprint_to_extradata (AVCodecContext *avctx, struct AVBPrint *buf)
 Finalize buf into extradata and set its size appropriately.
 
AVDictionary ** ff_frame_get_metadatap (AVFrame *frame)
 

Variables

volatile int ff_avcodec_locked
 

Detailed Description

common internal api header.

Definition in file internal.h.

Macro Definition Documentation

#define FF_SANE_NB_CHANNELS   128U

Definition at line 33 of file internal.h.

Referenced by avcodec_open2().

#define FF_MAX_EXTRADATA_SIZE   ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)

Maximum size in bytes of extradata.

This value was chosen such that every bit of the buffer is addressable by a 32-bit signed integer as used by get_bits.

Definition at line 147 of file internal.h.

Referenced by avcodec_open2(), and avformat_find_stream_info().

Function Documentation

AVHWAccel* ff_find_hwaccel ( enum AVCodecID  codec_id,
enum AVPixelFormat  pix_fmt 
)

Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.

Parameters
codec_idthe codec to match
pix_fmtthe pixel format to match
Returns
the hardware accelerated codec, or NULL if none was found.

Definition at line 2699 of file utils.c.

Referenced by ff_h263_decode_init(), h264_slice_header_init(), vc1_decode_init(), and vcr2_init_sequence().

int ff_match_2uint16 ( const uint16_t(*)  tab[2],
int  size,
int  a,
int  b 
)

Return the index into tab at which {a,b} match elements {[0],[1]} of tab.

If there is no such matching pair then size is returned.

Definition at line 2651 of file utils.c.

Referenced by ff_h263_encode_picture_header(), ff_MPV_encode_init(), and svq1_write_header().

unsigned int avpriv_toupper4 ( unsigned int  x)
void ff_init_buffer_info ( AVCodecContext s,
AVFrame frame 
)

does needed setup of pkt_pts/pos and such for (re)get_buffer();

Definition at line 548 of file utils.c.

Referenced by avcodec_default_reget_buffer(), ff_get_buffer(), and ff_thread_get_buffer().

void avpriv_color_frame ( AVFrame frame,
const int  color[4] 
)

Definition at line 513 of file utils.c.

Referenced by ff_h264_frame_start().

void ff_packet_free_side_data ( AVPacket pkt)

Remove and free all side data from packet.

Definition at line 30 of file avpacket.c.

Referenced by avcodec_decode_audio4(), avcodec_decode_subtitle2(), and avcodec_decode_video2().

int ff_lock_avcodec ( AVCodecContext log_ctx)
int ff_unlock_avcodec ( void  )
int avpriv_lock_avformat ( void  )

Definition at line 2760 of file utils.c.

Referenced by ff_tls_deinit(), and ff_tls_init().

int avpriv_unlock_avformat ( void  )

Definition at line 2769 of file utils.c.

Referenced by ff_tls_deinit(), and ff_tls_init().

int ff_alloc_packet2 ( AVCodecContext avctx,
AVPacket avpkt,
int  size 
)

Check AVPacket size and/or allocate data.

Encoders supporting AVCodec.encode2() can use this as a convenience to ensure the output packet data is large enough, whether provided by the user or allocated in this function.

Parameters
avctxthe AVCodecContext of the encoder
avpktthe AVPacket If avpkt->data is already set, avpkt->size is checked to ensure it is large enough. If avpkt->data is NULL, a new buffer is allocated. avpkt->size is set to the specified size. All other AVPacket fields will be reset with av_init_packet().
sizethe minimum required packet size
Returns
0 on success, negative error code on failure

Definition at line 1147 of file utils.c.

Referenced by a64multi_encode_frame(), aac_encode_frame(), aacPlus_encode_frame(), adx_encode_frame(), alac_encode_frame(), amr_wb_encode_frame(), avui_encode_frame(), bmp_encode_frame(), dnxhd_encode_picture(), encode_frame(), encode_nals(), encode_picture_lossless(), encode_picture_ls(), encode_superframe(), Faac_encode_frame(), ff_alloc_packet(), ff_MPV_encode_picture(), flac_encode_frame(), flashsv2_encode_frame(), flashsv_encode_frame(), gif_encode_frame(), ilbc_encode_frame(), libgsm_encode_frame(), libopenjpeg_encode_frame(), libopus_encode(), libschroedinger_encode_frame(), mp3lame_encode_frame(), MPA_encode_frame(), oggvorbis_encode_frame(), pam_encode_frame(), pcm_encode_frame(), pcx_encode_frame(), pnm_encode_frame(), prores_encode_frame(), qtrle_encode_frame(), ra144_encode_frame(), raw_encode(), roq_dpcm_encode_frame(), roq_encode_frame(), storeframe(), sunrast_encode_frame(), svq1_encode_frame(), targa_encode_frame(), twolame_encode_frame(), utvideo_encode_frame(), v308_encode_frame(), v408_encode_frame(), v410_encode_frame(), vorbis_encode_frame(), XAVS_frame(), xbm_encode_frame(), xface_encode_frame(), xvid_encode_frame(), xwd_encode_frame(), y41p_encode_frame(), and yuv4_encode_frame().

int ff_alloc_packet ( AVPacket avpkt,
int  size 
)

Definition at line 1184 of file utils.c.

Referenced by cng_encode_frame().

static av_always_inline int64_t ff_samples_to_time_base ( AVCodecContext avctx,
int64_t  samples 
)
static
int ff_get_buffer ( AVCodecContext avctx,
AVFrame frame 
)

Get a buffer for a frame.

This is a wrapper around AVCodecContext.get_buffer() and should be used instead calling get_buffer() directly.

Definition at line 579 of file utils.c.

Referenced by ac3_decode_frame(), adpcm_decode_frame(), adx_decode_frame(), amrnb_decode_frame(), amrwb_decode_frame(), ape_decode_frame(), atrac1_decode_frame(), atrac3_decode_frame(), aura_decode_frame(), avcodec_default_reget_buffer(), avui_decode_frame(), bfi_decode_frame(), bmp_decode_frame(), bmv_aud_decode_frame(), brpix_decode_frame(), cdg_decode_frame(), cdxl_decode_frame(), cinaudio_decode_frame(), cllc_decode_frame(), cmv_decode_frame(), cng_decode_frame(), cook_decode_frame(), copy_frame(), copy_output(), cyuv_decode_frame(), dca_decode_frame(), decode_element(), decode_frame(), decode_pic(), decode_tag(), decode_thread(), dfa_decode_frame(), dirac_decode_data_unit(), dirac_decode_picture_header(), dpcm_decode_frame(), dvvideo_decode_frame(), eightsvx_decode_frame(), encode_init(), escape124_decode_frame(), escape130_decode_frame(), evrc_decode_frame(), execute_code(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_snow_common_init_after_header(), ff_snow_frame_start(), ff_thread_get_buffer(), ff_thread_video_encode_frame(), ff_vp56_decode_frame(), flac_decode_frame(), frame_configure_elements(), g722_decode_frame(), g723_1_decode_frame(), get_buffer(), get_siz(), gif_decode_frame(), gsm_decode_frame(), idcin_decode_frame(), ilbc_decode_frame(), imc_decode_frame(), init_image(), ipvideo_decode_frame(), libcelt_dec_decode(), libgsm_decode_frame(), libopus_decode(), libschroedinger_decode_frame(), libspeex_decode_frame(), mace_decode_frame(), mp_decode_frame(), mpc7_decode_frame(), mpc8_decode_frame(), mss2_decode_frame(), mxpeg_decode_frame(), oggvorbis_decode_frame(), output_data(), paf_aud_decode(), pcm_bluray_decode_frame(), pcm_decode_frame(), pcx_decode_frame(), pnm_decode_frame(), ptx_decode_frame(), qcelp_decode_frame(), qdm2_decode_frame(), ra144_decode_frame(), ra288_decode_frame(), rl2_decode_frame(), roq_encode_frame(), s302m_decode_frame(), shorten_decode_frame(), sipr_decode_frame(), smka_decode_frame(), submit_packet(), sunrast_decode_frame(), svq1_decode_frame(), svq1_encode_frame(), synth_superframe(), tak_decode_frame(), tgq_decode_frame(), tmv_decode_frame(), tqi_decode_frame(), truespeech_decode_frame(), tta_decode_frame(), twin_decode_frame(), txd_decode_frame(), v308_decode_frame(), v408_decode_frame(), v410_decode_frame(), vble_decode_frame(), vcr1_decode_frame(), vmdaudio_decode_frame(), vmdvideo_decode_frame(), vorbis_decode_frame(), vqa_decode_frame(), wavesynth_decode(), wavpack_decode_frame(), wma_decode_superframe(), ws_snd_decode_frame(), xan_decode_frame(), xbm_decode_frame(), xface_decode_frame(), xwd_decode_frame(), y216_decode_frame(), y41p_decode_frame(), yop_decode_frame(), yuv4_decode_frame(), zero12v_decode_frame(), and zerocodec_decode_frame().

int ff_thread_can_start_frame ( AVCodecContext avctx)

Definition at line 948 of file pthread.c.

Referenced by ff_h264_frame_start(), and ff_MPV_frame_start().

int ff_get_logical_cpus ( AVCodecContext avctx)

Definition at line 167 of file pthread.c.

Referenced by ff_frame_thread_encoder_init(), frame_thread_init(), and thread_init().

int avpriv_h264_has_num_reorder_frames ( AVCodecContext avctx)

Definition at line 105 of file h264.c.

Referenced by has_decode_delay_been_guessed().

void ff_print_debug_info2 ( AVCodecContext avctx,
AVFrame pict,
uint8_t mbskip_table,
uint8_t visualization_buffer[3],
int *  low_delay,
int  mb_width,
int  mb_height,
int  mb_stride,
int  quarter_sample 
)

Print debugging info for the given picture.

Definition at line 1798 of file mpegvideo.c.

Referenced by decode_frame(), and ff_print_debug_info().

int ff_codec_open2_recursive ( AVCodecContext avctx,
const AVCodec codec,
AVDictionary **  options 
)

Call avcodec_open2 recursively by decrementing counter, unlocking mutex, calling the function and then restoring again.

Assumes the mutex is already locked

Definition at line 811 of file utils.c.

int ff_codec_close_recursive ( AVCodecContext avctx)

Call avcodec_close recursively, counterpart to avcodec_open2_recursive.

Definition at line 2023 of file utils.c.

int avpriv_bprint_to_extradata ( AVCodecContext avctx,
struct AVBPrint buf 
)

Finalize buf into extradata and set its size appropriately.

Definition at line 2844 of file utils.c.

Referenced by ass_read_header(), dvdsub_init(), jacosub_read_header(), sami_read_header(), and subviewer_read_header().

AVDictionary** ff_frame_get_metadatap ( AVFrame frame)

Variable Documentation

volatile int ff_avcodec_locked

Definition at line 55 of file utils.c.

Referenced by ff_lock_avcodec(), and ff_unlock_avcodec().