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

common internal API header More...

#include <limits.h>
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
#include "config.h"
#include "attributes.h"
#include "timer.h"
#include "cpu.h"
#include "dict.h"
#include "macros.h"
#include "pixfmt.h"
#include "version.h"
#include "libm.h"

Go to the source code of this file.

Macros

#define NDEBUG
 
#define av_export
 
#define FF_DISABLE_DEPRECATION_WARNINGS
 
#define FF_ENABLE_DEPRECATION_WARNINGS
 
#define FF_MEMORY_POISON   0x2a
 
#define MAKE_ACCESSORS(str, name, type, field)
 
#define E1(x)   x
 
#define AV_CHECK_OFFSET(s, m, o)
 
#define LOCAL_ALIGNED_A(a, t, v, s, o,...)
 
#define LOCAL_ALIGNED_D(a, t, v, s, o,...)
 
#define LOCAL_ALIGNED(a, t, v,...)   E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
 
#define LOCAL_ALIGNED_8(t, v,...)   LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
 
#define LOCAL_ALIGNED_16(t, v,...)   LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
 
#define LOCAL_ALIGNED_32(t, v,...)   LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
 
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
 
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
 
#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)
 
#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)
 
#define NULL_IF_CONFIG_SMALL(x)   x
 Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. More...
 
#define ONLY_IF_THREADS_ENABLED(x)   NULL
 Define a function with only the non-default version specified. More...
 
#define PTRDIFF_SPECIFIER   "td"
 
#define SIZE_SPECIFIER   "zu"
 
#define ff_dlog(ctx,...)   do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
 

Functions

void avpriv_report_missing_feature (void *avc, const char *msg,...) av_printf_format(2
 Log a generic warning message about a missing feature. More...
 
void void avpriv_request_sample (void *avc, const char *msg,...) av_printf_format(2
 Log a generic warning message about a missing feature. More...
 
static av_always_inline
av_const int64_t 
ff_rint64_clip (double a, int64_t amin, int64_t amax)
 Clip and convert a double value into the long long amin-amax range. More...
 
av_warn_unused_result int avpriv_open (const char *filename, int flags,...)
 A wrapper for open() setting O_CLOEXEC. More...
 
int avpriv_tempfile (const char *prefix, char **filename, int log_offset, void *log_ctx)
 Wrapper to work around the lack of mkstemp() on mingw. More...
 
int avpriv_set_systematic_pal2 (uint32_t pal[256], enum AVPixelFormat pix_fmt)
 
static av_always_inline
av_const int 
avpriv_mirror (int x, int w)
 
void ff_check_pixfmt_descriptors (void)
 

Variables

const uint8_t ff_reverse [256]
 

Detailed Description

common internal API header

Definition in file internal.h.

Macro Definition Documentation

#define NDEBUG

Definition at line 30 of file internal.h.

#define av_export

Definition at line 65 of file internal.h.

#define FF_DISABLE_DEPRECATION_WARNINGS

Definition at line 80 of file internal.h.

Referenced by alac_encode_init(), av_frame_get_qp_table(), av_frame_set_qp_table(), av_init_packet(), av_packet_copy_props(), av_packet_rescale_ts(), av_parser_init(), avcodec_close(), avcodec_copy_context(), avcodec_open2(), avformat_find_stream_info(), avformat_match_stream_specifier(), avformat_new_stream(), avpriv_set_pts_info(), bmp_encode_frame(), compute_pkt_fields(), decode_dvd_subtitles(), decode_nal_units(), display_end_segment(), dnxhd_encode_init(), dnxhd_encode_picture(), dnxhd_load_picture(), do_swap(), dvvideo_encode_frame(), encode_dvd_subtitles(), encode_frame(), encode_init(), encode_init_ls(), encode_picture_ls(), encode_thread(), ff_init_me(), ff_mpv_encode_init(), ff_mpv_encode_picture(), ff_rate_control_init(), ff_vdpau_common_end_frame(), find_decoder(), find_fps(), find_smallest_bounding_rectangle(), flac_encode_frame(), flac_encode_init(), flashsv_encode_frame(), frame_copy_props(), frame_end(), free_stream(), gif_encode_init(), init_muxer(), init_video_param(), io_open_default(), j2kenc_init(), libschroedinger_encode_frame(), libschroedinger_encode_init(), libx265_encode_frame(), ljpeg_encode_bgr(), ljpeg_encode_init(), ljpeg_encode_yuv(), matroska_parse_frame(), mkv_write_packet_internal(), mov_parse_stsd_data(), mov_read_dac3(), mov_read_dec3(), mov_write_tmcd_tag(), mov_write_video_tag(), mpeg_decode_gop(), mpeg_decode_user_data(), pam_encode_init(), pcx_encode_init(), png_enc_init(), pnm_encode_init(), process_output_surface(), qtrle_encode_frame(), raw_encode_init(), set_codec_from_probe_data(), setup_hwaccel_for_pixfmt(), srt_write_packet(), storeframe(), sunrast_encode_init(), svc_encode_init(), svq1_encode_frame(), svq1_encode_plane(), targa_encode_frame(), targa_encode_init(), teletext_decode_frame(), update_context_from_thread(), update_stream_avctx(), utvideo_encode_frame(), utvideo_encode_init(), v410_encode_frame(), v4l2_read_packet(), vpx_init(), X264_frame(), X264_init(), XAVS_frame(), XAVS_init(), xsub_encode(), xvid_encode_frame(), xvid_encode_init(), and yuv4_generate_header().

#define FF_ENABLE_DEPRECATION_WARNINGS

Definition at line 81 of file internal.h.

Referenced by alac_encode_init(), av_frame_get_qp_table(), av_frame_set_qp_table(), av_init_packet(), av_packet_copy_props(), av_packet_rescale_ts(), av_parser_init(), avcodec_close(), avcodec_copy_context(), avcodec_open2(), avformat_find_stream_info(), avformat_match_stream_specifier(), avformat_new_stream(), avpriv_set_pts_info(), bmp_encode_frame(), compute_pkt_fields(), decode_dvd_subtitles(), decode_nal_units(), display_end_segment(), dnxhd_encode_init(), dnxhd_encode_picture(), dnxhd_load_picture(), do_swap(), dvvideo_encode_frame(), encode_dvd_subtitles(), encode_frame(), encode_init(), encode_init_ls(), encode_picture_ls(), encode_thread(), ff_init_me(), ff_mpv_encode_init(), ff_mpv_encode_picture(), ff_rate_control_init(), ff_vdpau_common_end_frame(), find_decoder(), find_fps(), find_smallest_bounding_rectangle(), flac_encode_frame(), flac_encode_init(), flashsv_encode_frame(), frame_copy_props(), frame_end(), free_stream(), gif_encode_init(), init_muxer(), init_video_param(), io_open_default(), j2kenc_init(), libschroedinger_encode_frame(), libschroedinger_encode_init(), libx265_encode_frame(), ljpeg_encode_bgr(), ljpeg_encode_init(), ljpeg_encode_yuv(), matroska_parse_frame(), mkv_write_packet_internal(), mov_parse_stsd_data(), mov_read_dac3(), mov_read_dec3(), mov_write_tmcd_tag(), mov_write_video_tag(), mpeg_decode_gop(), mpeg_decode_user_data(), pam_encode_init(), pcx_encode_init(), png_enc_init(), pnm_encode_init(), process_output_surface(), qtrle_encode_frame(), raw_encode_init(), set_codec_from_probe_data(), setup_hwaccel_for_pixfmt(), srt_write_packet(), storeframe(), sunrast_encode_init(), svc_encode_init(), svq1_encode_frame(), svq1_encode_plane(), targa_encode_frame(), targa_encode_init(), teletext_decode_frame(), update_context_from_thread(), update_stream_avctx(), utvideo_encode_frame(), utvideo_encode_init(), v410_encode_frame(), v4l2_read_packet(), vpx_init(), X264_frame(), X264_init(), XAVS_frame(), XAVS_init(), xsub_encode(), xvid_encode_frame(), xvid_encode_init(), and yuv4_generate_header().

#define FF_MEMORY_POISON   0x2a

Definition at line 85 of file internal.h.

Referenced by av_dynarray2_add(), av_malloc(), and pool_release_buffer().

#define MAKE_ACCESSORS (   str,
  name,
  type,
  field 
)
Value:
type av_##name##_get_##field(const str *s) { return s->field; } \
void av_##name##_set_##field(str *s, type v) { s->field = v; }
const char * s
Definition: avisynth_c.h:631
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLint GLenum type
Definition: opengl_enc.c:105
const char * name
Definition: opengl_enc.c:103

Definition at line 87 of file internal.h.

#define E1 (   x)    x

Definition at line 93 of file internal.h.

#define AV_CHECK_OFFSET (   s,
  m,
 
)
Value:
struct check_##o { \
int x_##o[offsetof(s, m) == o? 1: -1]; \
}
const char * s
Definition: avisynth_c.h:631
unsigned m
Definition: audioconvert.c:187

Definition at line 98 of file internal.h.

#define LOCAL_ALIGNED_A (   a,
  t,
  v,
  s,
  o,
  ... 
)
Value:
uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
const char * s
Definition: avisynth_c.h:631
uint8_t
#define FFALIGN(x, a)
Definition: macros.h:48

Definition at line 102 of file internal.h.

#define LOCAL_ALIGNED_D (   a,
  t,
  v,
  s,
  o,
  ... 
)
Value:
DECLARE_ALIGNED(a, t, la_##v) s o; \
t (*v) o = la_##v
const char * s
Definition: avisynth_c.h:631
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:53

Definition at line 106 of file internal.h.

#define LOCAL_ALIGNED (   a,
  t,
  v,
  ... 
)    E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
#define LOCAL_ALIGNED_8 (   t,
  v,
  ... 
)    LOCAL_ALIGNED(8, t, v, __VA_ARGS__)

Definition at line 115 of file internal.h.

Referenced by apply_obmc(), and dv_encode_video_segment().

#define LOCAL_ALIGNED_16 (   t,
  v,
  ... 
)    LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
#define LOCAL_ALIGNED_32 (   t,
  v,
  ... 
)    LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
#define FF_ALLOC_OR_GOTO (   ctx,
  p,
  size,
  label 
)
Value:
{\
if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\
}
#define av_malloc(s)
ptrdiff_t size
Definition: opengl_enc.c:101
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
if(ret< 0)
Definition: vf_mcdeint.c:282

Definition at line 130 of file internal.h.

Referenced by adpcm_encode_frame(), adpcm_encode_init(), allocate_buffers(), allocate_sample_buffers(), ape_decode_init(), ff_h264_slice_context_init(), ff_iir_filter_init_coeffs(), ff_snow_common_init_after_header(), init_context_frame(), and sws_init_context().

#define FF_ALLOCZ_OR_GOTO (   ctx,
  p,
  size,
  label 
)
Value:
{\
if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\
}
ptrdiff_t size
Definition: opengl_enc.c:101
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
if(ret< 0)
Definition: vf_mcdeint.c:282
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:252

Definition at line 139 of file internal.h.

Referenced by alloc_buffers(), allocate_sample_buffers(), dnxhd_encode_init(), dnxhd_init_vlc(), ff_h264_alloc_tables(), ff_h264_slice_context_init(), ff_iir_filter_init_coeffs(), ff_mpv_common_init(), ff_mpv_encode_init(), init_context_frame(), init_duplicate_context(), and sws_init_context().

#define FF_ALLOC_ARRAY_OR_GOTO (   ctx,
  p,
  nelem,
  elsize,
  label 
)
Value:
{\
p = av_malloc_array(nelem, elsize);\
if (!p) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\
}
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
if(ret< 0)
Definition: vf_mcdeint.c:282
#define av_malloc_array(a, b)

Definition at line 148 of file internal.h.

Referenced by adpcm_encode_frame(), allocate_buffers(), allocate_sample_buffers(), init_mdct_win(), initFilter(), and mca().

#define FF_ALLOCZ_ARRAY_OR_GOTO (   ctx,
  p,
  nelem,
  elsize,
  label 
)
Value:
{\
p = av_mallocz_array(nelem, elsize);\
if (!p) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\
}
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
if(ret< 0)
Definition: vf_mcdeint.c:282
static void * av_mallocz_array(size_t nmemb, size_t size)
Definition: mem.h:229

Definition at line 157 of file internal.h.

Referenced by alloc_buffers(), allocate_buffers(), dnxhd_init_qmat(), dnxhd_init_rc(), dnxhd_init_vlc(), ff_h264_alloc_tables(), ff_mpeg_framesize_alloc(), ff_snow_common_init_after_header(), initFilter(), and mca().

#define NULL_IF_CONFIG_SMALL (   x)    x

Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.

Used to disable the definition of strings (for example AVCodec long_names).

Definition at line 176 of file internal.h.

Referenced by mpeg12_class().

#define ONLY_IF_THREADS_ENABLED (   x)    NULL

Define a function with only the non-default version specified.

On systems with ELF shared libraries, all symbols exported from FFmpeg libraries are tagged with the name and major version of the library to which they belong. If a function is moved from one library to another, a wrapper must be retained in the original location to preserve binary compatibility.

Functions defined with this macro will never be used to resolve symbols by the build-time linker.

Parameters
typereturn type of function
namename of function
argsargument list of function
verversion tag to assign function Return NULL if a threading library has not been enabled. Used to disable threading functions in AVCodec definitions when not needed.

Definition at line 215 of file internal.h.

#define PTRDIFF_SPECIFIER   "td"
#define SIZE_SPECIFIER   "zu"
#define ff_dlog (   ctx,
  ... 
)    do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)

Definition at line 258 of file internal.h.

Function Documentation

void avpriv_report_missing_feature ( void avc,
const char *  msg,
  ... 
)
void void avpriv_request_sample ( void avc,
const char *  msg,
  ... 
)

Log a generic warning message about a missing feature.

Additionally request that a sample showcasing the feature be uploaded.

Parameters
[in]avca pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct
[in]msgstring containing the name of the missing feature

Referenced by aac_decode_er_frame(), alac_decode_init(), amrwb_decode_frame(), ape_decode_init(), apng_read_packet(), asf_get_packet(), ast_read_header(), avi_extract_stream_metadata(), avr_read_header(), cdxl_decode_frame(), chs_parse_header(), cine_read_header(), cinepak_decode(), compute_band_indexes(), cook_decode_init(), dcstr_read_header(), decode_audio_block(), decode_band_hdr(), decode_bytes(), decode_cdlms(), decode_channel_transform(), decode_eld_specific_config(), decode_element(), decode_frame(), decode_frame_headers(), decode_ga_specific_config(), decode_ics(), decode_idat_chunk(), decode_init(), decode_mvc2(), decode_nal_units(), decode_nop(), decode_packet(), decode_scalefactors(), decode_sgirle8(), decode_slice(), decode_subframe(), decode_wmv9(), decode_yuv_frame(), determine_bitrate(), dnxhd_decode_header(), dnxhd_init_vlc(), dsf_read_header(), dss_read_header(), dxva2_mpeg2_decode_slice(), ea_read_packet(), encode_frame(), epaf_read_header(), execute_code(), exif_add_metadata(), ff_adx_decode_header(), ff_dca_exss_parse(), ff_eac3_parse_header(), ff_get_wav_header(), ff_h264_decode_seq_parameter_set(), ff_h264_decode_slice_header(), ff_hevc_parse_sps(), ff_jpegls_decode_lse(), ff_mjpeg_decode_sof(), ff_opus_parse_extradata(), ff_parse_mpeg2_descriptor(), ff_spdif_read_packet(), fill_coding_method_array(), flashsv_decode_frame(), flic_decode_init(), flv_read_packet(), flv_set_audio_codec(), flv_set_video_codec(), fsb_read_header(), g2m_decode_frame(), genh_read_header(), get_aiff_header(), get_packet_header(), get_poc(), get_siz(), handle_p_frame_apng(), hq_decode_frame(), iff_read_header(), imc_decode_init(), jp2_find_codestream(), jpeg2000_decode_packet(), jpeg2000_decode_packets_po_iteration(), lag_decode_zero_run_line(), latm_decode_audio_specific_config(), load_buffer(), lvf_read_header(), m101_decode_init(), mimic_decode_frame(), mov_build_index(), mov_read_mdhd(), mov_read_sidx(), mpc7_decode_init(), mpc8_decode_init(), msf_read_header(), msrle_decode_pal4(), mtv_read_header(), musx_read_header(), mv_read_header(), mxf_parse_structural_metadata(), mxf_read_packet_old(), mxf_read_primer_pack(), nist_read_header(), oma_read_header(), on2avc_decode_init(), output_configure(), paf_video_decode(), parse_coding_header(), parse_common_header(), parse_dsd_prop(), parse_fmtp(), parse_setup_header(), parse_video_var(), parse_xxch_frame(), pix_decode_frame(), process_audio_header_eacs(), process_audio_header_elements(), process_ea_header(), process_frame_obj(), ptx_decode_frame(), qdm2_decode_init(), qt_rtp_parse_packet(), read_block_data(), read_frame(), read_header(), read_major_sync(), read_restart_header(), read_sbr_extension(), read_stream_mux_config(), read_table(), rm_read_audio_stream_info(), rm_read_multi(), rpl_read_header(), rsd_read_header(), rso_read_header(), rv10_decode_init(), rv10_decode_picture_header(), save_bits(), save_subtitle_set(), scan_file(), smc_decode_stream(), smjpeg_read_header(), spdif_get_offset_and_codec(), spdif_header_dts(), spdif_header_truehd(), sunrast_decode_frame(), synth_superframe(), tdsc_load_cursor(), tdsc_parse_dtsm(), threedostr_read_header(), tm2_read_header(), truemotion1_decode_header(), truespeech_decode_init(), unsupported(), update_odml_entry(), vc1_decode_init(), vcr1_decode_init(), vp7_decode_frame_header(), vp8_decode_frame_header(), vqa_decode_init(), wsaud_read_header(), wsd_read_header(), wsd_to_av_channel_layoyt(), xa_decode(), xan_wc3_copy_pixel_run(), xmv_read_header(), xvag_read_header(), xwd_decode_frame(), xwma_read_header(), and zero12v_decode_init().

static av_always_inline av_const int64_t ff_rint64_clip ( double  a,
int64_t  amin,
int64_t  amax 
)
static

Clip and convert a double value into the long long amin-amax range.

This function is needed because conversion of floating point to integers when it does not fit in the integer's representation does not necessarily saturate correctly (usually converted to a cvttsd2si on x86) which saturates numbers

INT64_MAX to INT64_MIN. The standard marks such conversions as undefined

behavior, allowing this sort of mathematically bogus conversions. This provides a safe alternative that is slower obviously but assures safety and better mathematical behavior.

Parameters
avalue to clip
aminminimum value of the clip range
amaxmaximum value of the clip range
Returns
clipped value

Definition at line 275 of file internal.h.

av_warn_unused_result int avpriv_open ( const char *  filename,
int  flags,
  ... 
)
int avpriv_tempfile ( const char *  prefix,
char **  filename,
int  log_offset,
void log_ctx 
)

Wrapper to work around the lack of mkstemp() on mingw.

Also, tries to create file in /tmp first, if possible. *prefix can be a character constant; *filename will be allocated internally.

Returns
file descriptor of opened file (or negative value corresponding to an AVERROR code on error) and opened file name in **filename.
Note
On very old libcs it is necessary to set a secure umask before calling this, av_tempfile() can't call umask itself as it is used in libraries and could interfere with the calling application.

Definition at line 106 of file file_open.c.

Referenced by av_tempfile(), cache_open(), ff_xvid_rate_control_init(), and xvid_encode_init().

int avpriv_set_systematic_pal2 ( uint32_t  pal[256],
enum AVPixelFormat  pix_fmt 
)
static av_always_inline av_const int avpriv_mirror ( int  x,
int  w 
)
static
void ff_check_pixfmt_descriptors ( void  )

Definition at line 2277 of file pixdesc.c.

Referenced by main().

Variable Documentation

const uint8_t ff_reverse[256]