60 min_size=
FFMAX(17*min_size/16 + 32, min_size);
76 min_size=
FFMAX(17*min_size/16 + 32, min_size);
79 if (!*p) min_size = 0;
91 #if !FF_API_AVCODEC_INIT
96 static int initialized = 0;
112 return codec && codec->
decode;
140 #define INTERNAL_BUFFER_SIZE (32+1)
219 *width =
FFALIGN(*width , w_align);
220 *height=
FFALIGN(*height, h_align);
236 linesize_align[i] = 16;
246 align =
FFMAX(linesize_align[0], linesize_align[3]);
247 linesize_align[1] <<= chroma_shift;
248 linesize_align[2] <<= chroma_shift;
249 align =
FFMAX3(align, linesize_align[1], linesize_align[2]);
255 int buf_size,
int align)
257 int ch, planar, needed_size, ret = 0;
262 if (buf_size < needed_size)
276 sample_fmt, align)) < 0) {
364 "internal audio buffer used\n", frame);
409 int h_chroma_shift, v_chroma_shift;
435 unaligned |= picture.
linesize[i] % stride_align[i];
443 for (i=0; i<3 && picture.
data[i+1]; i++)
444 size[i] = picture.
data[i+1] - picture.
data[i];
445 size[i] = tmpsize - (picture.
data[i] - picture.
data[0]);
447 memset(buf->
base, 0,
sizeof(buf->
base));
448 memset(buf->
data, 0,
sizeof(buf->
data));
450 for(i=0; i<4 && size[i]; i++){
451 const int h_shift= i==0 ? 0 : h_chroma_shift;
452 const int v_shift= i==0 ? 0 : v_chroma_shift;
458 memset(buf->
base[i], 128, size[i]);
470 if(size[1] && !size[2])
526 assert(i < avci->buffer_count);
586 for(i=0; i<count; i++){
587 int r= func(c, (
char*)arg + i*size);
596 for(i=0; i<count; i++){
597 int r= func(c, arg, i, 0);
610 memset(pic, 0,
sizeof(
AVFrame));
628 #if FF_API_AVCODEC_OPEN
643 if ((!codec && !avctx->
codec)) {
647 if ((codec && avctx->
codec && codec != avctx->
codec)) {
649 "but %s passed to avcodec_open2().\n", avctx->
codec->
name, codec->
name);
653 codec = avctx->
codec;
669 av_log(avctx,
AV_LOG_ERROR,
"insufficient thread locking around avcodec_open/close()\n");
717 #define SANE_NB_CHANNELS 128U
723 avctx->
codec = codec;
742 avctx->
err_recognition |= (1<<(avctx->error_recognition-(avctx->error_recognition>=FF_ER_VERY_AGGRESSIVE))) - 1;
763 av_log(avctx,
AV_LOG_ERROR,
"The maximum value for lowres supported by the decoder is %d\n",
854 if (avpkt->
size < size)
857 pkt_data = avpkt->
data;
858 pkt_size = avpkt->
size;
860 avpkt->
data = pkt_data;
861 avpkt->
size = pkt_size;
874 int user_packet = !!avpkt->
data;
899 ret = avctx->
codec->
encode2(avctx, avpkt, frame, got_packet_ptr);
900 if (!ret && *got_packet_ptr &&
912 int buf_size = avpkt->
size;
916 buf_size = nb_samples * avctx->
channels *
936 nb_samples < avctx->frame_size) {
963 *got_packet_ptr = (ret > 0);
981 #if FF_API_OLD_DECODE_AUDIO
983 uint8_t *buf,
int buf_size,
989 int ret, samples_size, got_packet;
1007 "support this codec\n");
1010 nb_samples = (int64_t)buf_size * 8 /
1013 if (nb_samples >= INT_MAX)
1025 samples, samples_size, 1)))
1057 return ret ? ret : pkt.
size;
1071 int ret = avctx->
codec->
encode(avctx, buf, buf_size, pict);
1090 ret = avctx->
codec->
encode(avctx, buf, buf_size, sub);
1098 const uint8_t *
data;
1105 if (!data || size < 4)
1107 flags = bytestream_get_le32(&data);
1112 avctx->
channels = bytestream_get_le32(&data);
1130 avctx->
width = bytestream_get_le32(&data);
1131 avctx->
height = bytestream_get_le32(&data);
1138 int *got_picture_ptr,
1143 *got_picture_ptr= 0;
1155 ret = avctx->
codec->
decode(avctx, picture, got_picture_ptr,
1166 if (*got_picture_ptr)
1174 #if FF_API_OLD_DECODE_AUDIO
1176 int *frame_size_ptr,
1180 int ret, got_frame = 0;
1184 "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
1186 "avcodec_decode_audio4()\n");
1192 if (ret >= 0 && got_frame) {
1198 if (*frame_size_ptr < data_size) {
1200 "the current frame (%d < %d)\n", *frame_size_ptr, data_size);
1206 if (planar && avctx->
channels > 1) {
1207 uint8_t *out = ((uint8_t *)samples) + plane_size;
1208 for (ch = 1; ch < avctx->
channels; ch++) {
1213 *frame_size_ptr = data_size;
1215 *frame_size_ptr = 0;
1240 ret = avctx->
codec->
decode(avctx, frame, got_frame_ptr, avpkt);
1241 if (ret >= 0 && *got_frame_ptr) {
1259 ret = avctx->
codec->
decode(avctx, sub, got_sub_ptr, avpkt);
1295 av_log(avctx,
AV_LOG_ERROR,
"insufficient thread locking around avcodec_open/close()\n");
1340 return experimental;
1386 int bits_per_sample;
1408 int i,
len, ret = 0;
1410 for (i = 0; i < 4; i++) {
1411 len = snprintf(buf, buf_size,
1412 isprint(codec_tag&0xFF) ?
"%c" :
"[%d]", codec_tag&0xFF);
1414 buf_size = buf_size > len ? buf_size - len : 0;
1423 const char *codec_name;
1424 const char *profile =
NULL;
1436 codec_name = p->
name;
1441 codec_name =
"mpeg2ts";
1448 snprintf(buf1,
sizeof(buf1),
"%s / 0x%04X", tag_buf, enc->
codec_tag);
1454 snprintf(buf, buf_size,
1458 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1461 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1466 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1474 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1475 " [PAR %d:%d DAR %d:%d]",
1477 display_aspect_ratio.
num, display_aspect_ratio.
den);
1481 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1487 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1488 ", q=%d-%d", enc->
qmin, enc->
qmax);
1492 snprintf(buf, buf_size,
1496 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1499 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1505 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1510 snprintf(buf, buf_size,
"Data: %s", codec_name);
1513 snprintf(buf, buf_size,
"Subtitle: %s", codec_name);
1516 snprintf(buf, buf_size,
"Attachment: %s", codec_name);
1519 snprintf(buf, buf_size,
"Invalid Codec type %d", enc->
codec_type);
1524 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1527 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1532 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1533 ", %d kb/s", bitrate / 1000);
1562 #define LICENSE_PREFIX "libavcodec license: "
1628 #if FF_API_OLD_FF_PICT_TYPES
1629 char av_get_pict_type_char(
int pict_type){
1682 #if FF_API_OLD_SAMPLE_FMT
1683 int av_get_bits_per_sample_format(
enum AVSampleFormat sample_fmt) {
1710 for(i=0; i<size && !(
tab[i][0]==a &&
tab[i][1]==
b); i++);
1717 "version to the newest one from Git. If the problem still "
1718 "occurs, it means that your file has a feature which has not "
1719 "been implemented.\n", feature);
1726 va_list argument_list;
1728 va_start(argument_list, msg);
1733 "of this file to ftp://upload.libav.org/incoming/ "
1734 "and contact the libav-devel mailing list.\n");
1736 va_end(argument_list);
1760 if ( hwaccel->
id == codec_id
1761 && hwaccel->
pix_fmt == pix_fmt)
1807 return toupper( x &0xFF)
1808 + (toupper((x>>8 )&0xFF)<<8 )
1809 + (toupper((x>>16)&0xFF)<<16)
1810 + (toupper((x>>24)&0xFF)<<24);
1840 #if FF_API_THREAD_INIT
#define CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill channel data pointers and linesize for samples with sample format sample_fmt.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
static av_always_inline int codec_is_encoder(AVCodec *codec)
enum PixelFormat pix_fmt
Supported pixel format.
unsigned avcodec_get_edge_width(void)
Return the amount of padding in pixels which the get_buffer callback must provide around the edge of ...
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
void ff_thread_report_progress(AVFrame *f, int progress, int field)
Notify later decoding threads when part of their reference picture is ready.
int av_lockmgr_register(int(*cb)(void **mutex, enum AVLockOp op))
Register a user provided lock manager supporting the operations specified by AVLockOp.
int coded_width
Bitstream width / height, may be different from width/height if lowres enabled.
int buffer_hints
codec suggestion on buffer type if != 0
enum AVMediaType avcodec_get_type(enum CodecID codec_id)
Get the type of the given codec.
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
void(* flush)(AVCodecContext *)
Flush buffers.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int buffer_count
internal buffer count used by default get/release/reget_buffer().
#define AV_LOG_WARNING
Something somehow does not look correct.
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
planar GBR 4:4:4 27bpp, little endian
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
void * opaque
for some private data of the user
struct AVCodecContext * owner
the AVCodecContext which ff_thread_get_buffer() was last called on
int avcodec_is_open(AVCodecContext *s)
InternalBuffer * buffer
internal buffers used by default get/release/reget_buffer().
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
#define CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void ff_thread_free(AVCodecContext *avctx)
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int(* decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt)
four components are given, that's all.
const char * avcodec_configuration(void)
Return the libavcodec build-time configuration.
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
#define CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
A dummy ID pointing at the start of various fake codecs.
char * text
0 terminated plain UTF-8 text
static void * codec_mutex
static void video_free_buffers(AVCodecContext *s)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height)
Copy image src to dst.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
static int volatile entangled_thread_counter
#define av_assert0(cond)
assert() equivalent, that is always enabled.
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
enum AVSampleFormat sample_fmt
audio sample format
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int av_log_get_level(void)
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
uint8_t * base[AV_NUM_DATA_POINTERS]
Opaque data information usually continuous.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
uint8_t * data[AV_NUM_DATA_POINTERS]
unsigned avcodec_version(void)
Return the LIBAVCODEC_VERSION_INT constant.
static AVCodec * first_avcodec
int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
static void audio_free_buffers(AVCodecContext *avctx)
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic)
int64_t pts
presentation timestamp in time_base units (time when frame should be shown to user) If AV_NOPTS_VALUE...
#define LIBAVCODEC_VERSION_INT
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
Submit a new frame to a decoding thread.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat 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.
AVCodec * av_codec_next(AVCodec *c)
If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec...
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat 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.
void ff_thread_await_progress(AVFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define FF_BUFFER_TYPE_INTERNAL
AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
#define CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
const char * avcodec_license(void)
Return the libavcodec license.
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
audio conversion routines
Y , 16bpp, little-endian.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
A dummy ID pointing at the start of subtitle codecs.
int(* close)(AVCodecContext *)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
const uint64_t * channel_layouts
array of support channel layouts, or NULL if unknown. array is terminated by 0
static AVHWAccel * first_hwaccel
int width
width and height of the video frame
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
Log a generic warning message about a missing feature.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Multithreading support functions.
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS])
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
unsigned int avpriv_toupper4(unsigned int x)
int qmax
maximum quantizer
AVCodec * avcodec_find_encoder(enum CodecID id)
Find a registered encoder with a matching codec ID.
int active_thread_type
Which multithreading methods are in use by the codec.
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
int capabilities
Codec capabilities.
int ff_thread_init(AVCodecContext *s)
uint8_t * base[AV_NUM_DATA_POINTERS]
pointer to the first allocated byte of the picture.
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
Decode the video frame of size avpkt->size from avpkt->data into picture.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
#define CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
simple assert() macros that are a bit more flexible than ISO C assert().
int64_t av_gcd(int64_t a, int64_t b)
Return the greatest common divisor of a and b.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
AVCodec * avcodec_find_decoder(enum CodecID id)
Find a registered decoder with a matching codec ID.
int(* encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
planar GBR 4:4:4 27bpp, big endian
void * thread_opaque
thread opaque Can be used by execute() to store some per AVCodecContext stuff.
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB]
The array of all the pixel format descriptors.
#define AV_NUM_DATA_POINTERS
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
#define CODEC_FLAG_EMU_EDGE
Don't draw edges.
static av_always_inline void emms_c(void)
Empty mmx state.
int rc_buffer_size
decoder bitstream buffer size
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define INTERNAL_BUFFER_SIZE
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
struct AVRational AVRational
rational number numerator/denominator
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int bit_rate
the average bitrate
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
AVPicture pict
data+linesize for the bitmap of this subtitle.
#define FF_THREAD_FRAME
Decode more than one frame at once.
AVLockOp
Lock operation used by lockmgr.
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int width
picture width / height.
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
int type
type of the buffer (to keep track of who has to deallocate data[*])
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
#define FF_PROFILE_UNKNOWN
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
const char * av_get_pix_fmt_name(enum PixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt)
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} ...
int64_t reordered_opaque
opaque 64bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque
static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
int mb_decision
macroblock decision mode
Usually treated as AVMEDIA_TYPE_DATA.
void av_log_ask_for_sample(void *avc, const char *msg,...)
Opaque data information usually sparse.
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
static pthread_mutex_t * mutex
static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
int av_get_bits_per_sample(enum CodecID codec_id)
Return codec bits per sample.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
planar GBR 4:4:4 30bpp, big endian
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int format
format of the frame, -1 if unknown or unset Values correspond to enum PixelFormat for video frames...
int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVFrame *pict)
Encode a video frame from pict into buf.
int frame_size
Samples per packet, initialized when calling 'init'.
#define attribute_align_arg
enum CodecID id
Codec implemented by the hardware accelerator.
void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
static av_always_inline int codec_is_decoder(AVCodec *codec)
enum AVMediaType codec_type
AVHWAccel * ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.
void(* init_static_data)(struct AVCodec *codec)
Initialize codec static data, called from avcodec_register().
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
int av_opt_set_dict(void *obj, AVDictionary **options)
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
int sample_rate
samples per second
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
uint8_t * data[AV_NUM_DATA_POINTERS]
static const OptionDef options[]
main external API structure.
int qmin
minimum quantizer
AVRational sample_aspect_ratio
sample aspect ratio for the video frame, 0/1 if unknown
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static int(* ff_lockmgr_cb)(void **mutex, enum AVLockOp op)
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t reordered_opaque
reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything)...
Describe the class of an AVClass context structure.
#define FF_MIN_BUFFER_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
rational number numerator/denominator
const char * name
short name for the profile
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
FAKE codec to indicate a raw MPEG-2 TS stream (only used by libavformat)
uint16_t step_minus1
Number of elements between 2 horizontally consecutive pixels minus 1.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define FF_BUFFER_HINTS_READABLE
void ff_thread_flush(AVCodecContext *avctx)
Wait for decoding threads to finish and reset internal state.
packed RGB 8:8:8, 24bpp, BGRBGR...
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
av_cold int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
int64_t pkt_pts
reordered pts from the last AVPacket that has been input into the decoder
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Encode a frame of audio.
#define CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Decode the audio frame of size avpkt->size from avpkt->data into frame.
void avcodec_default_free_buffers(AVCodecContext *avctx)
av_cold void dsputil_static_init(void)
const AVClass * priv_class
AVClass for the private context.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A dummy id pointing at the start of audio codecs.
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
struct AVPacket::@10 * side_data
Additional packet data that can be provided by the container.
Audio format conversion routines.
uint8_t max_lowres
maximum value for lowres supported by the decoder
int64_t pkt_dts
dts from the last AVPacket that has been input into the decoder
AVPacket * pkt
Current packet as passed into the decoder, to avoid having to pass the packet into every function...
void av_opt_free(void *obj)
Free all string and binary options in obj.
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
common internal api header.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int avpriv_lock_avformat(void)
static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static void avcodec_init(void)
uint32_t start_display_time
AVSampleFormat
all in native-endian format
8 bit with PIX_FMT_RGB32 palette
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
int avcodec_default_execute2(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
CodecID
Identify the syntax and semantics of the bitstream.
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
void avcodec_flush_buffers(AVCodecContext *avctx)
Flush buffers, should be called when seeking or when switching to a different stream.
int channels
number of audio channels
const int * supported_samplerates
array of supported audio samplerates, or NULL if unknown, array is terminated by 0 ...
struct AVCodecInternal * internal
Private context used for internal data.
char * ass
0 terminated ASS/SSA compatible event line.
static void * avformat_mutex
int key_frame
1 -> keyframe, 0-> not
static int get_bit_rate(AVCodecContext *ctx)
static const struct @46 tab
TwinVQ codebooks.
planar GBR 4:4:4 30bpp, little endian
void avcodec_register(AVCodec *codec)
Register the codec codec and initialize libavcodec.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align)
Fill audio frame data and linesize.
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub)
void av_register_hwaccel(AVHWAccel *hwaccel)
Register the hardware accelerator hwaccel.
int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
Determine whether pix_fmt is a hardware accelerated format.
int frame_number
audio or video frame number
static int op(uint8_t **dst, const uint8_t *dst_end, const uint8_t **buf, const uint8_t *buf_end, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
#define FFSWAP(type, a, b)
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int avpriv_unlock_avformat(void)
int(* init)(AVCodecContext *)
uint8_t ** extended_data
pointers to the data planes/channels.
AVHWAccel * av_hwaccel_next(AVHWAccel *hwaccel)
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL...
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
int(* encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
int linesize[AV_NUM_DATA_POINTERS]
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
uint8_t * subtitle_header
Header containing style information for text subtitles.