58 min_size =
FFMAX(17 * min_size / 16 + 32, min_size);
77 min_size =
FFMAX(17 * min_size / 16 + 32, min_size);
111 static int initialized = 0;
113 if (initialized != 0)
127 return codec && codec->
decode;
157 #define INTERNAL_BUFFER_SIZE (32 + 1)
239 *width =
FFALIGN(*width, w_align);
240 *height =
FFALIGN(*height, h_align);
245 for (i = 0; i < 4; i++)
257 align =
FFMAX(linesize_align[0], linesize_align[3]);
258 linesize_align[1] <<= chroma_shift;
259 linesize_align[2] <<= chroma_shift;
260 align =
FFMAX3(align, linesize_align[1], linesize_align[2]);
261 *width =
FFALIGN(*width, align);
266 int buf_size,
int align)
268 int ch, planar, needed_size, ret = 0;
273 if (buf_size < needed_size)
287 sample_fmt, align)) < 0) {
317 frame->
data[0], buf_size, 0);
326 "internal audio buffer used\n", frame);
366 int h_chroma_shift, v_chroma_shift;
393 for (i = 0; i < 4; i++)
394 unaligned |= picture.
linesize[i] % stride_align[i];
401 for (i = 0; i < 3 && picture.
data[i + 1]; i++)
402 size[i] = picture.
data[i + 1] - picture.
data[i];
403 size[i] = tmpsize - (picture.
data[i] - picture.
data[0]);
405 memset(buf->
base, 0,
sizeof(buf->
base));
406 memset(buf->
data, 0,
sizeof(buf->
data));
408 for (i = 0; i < 4 && size[i]; i++) {
409 const int h_shift = i == 0 ? 0 : h_chroma_shift;
410 const int v_shift = i == 0 ? 0 : v_chroma_shift;
417 memset(buf->
base[i], 128, size[i]);
429 if (size[1] && !size[2])
478 default:
return AVERROR(EINVAL);
505 assert(i < avci->buffer_count);
569 for (i = 0; i < count; i++) {
570 int r = func(c, (
char *)arg + i * size);
581 for (i = 0; i < count; i++) {
582 int r = func(c, arg, i, 0);
607 memset(frame, 0,
sizeof(
AVFrame));
632 if (!frame || !*frame)
651 if ((!codec && !avctx->
codec)) {
655 if ((codec && avctx->
codec && codec != avctx->
codec)) {
657 "but %s passed to avcodec_open2().\n", avctx->
codec->
name, codec->
name);
661 codec = avctx->
codec;
677 av_log(avctx,
AV_LOG_ERROR,
"insufficient thread locking around avcodec_open/close()\n");
730 avctx->
codec = codec;
845 else if (channels != avctx->
channels) {
847 "channel layout does not match number of channels\n");
886 if (avpkt->
size < size)
952 int user_packet = !!avpkt->
data;
967 "with more than %d channels, but extended_data is not set.\n",
990 frame = padded_frame;
1001 ret = avctx->
codec->
encode2(avctx, avpkt, frame, got_packet_ptr);
1003 if (*got_packet_ptr) {
1016 if (!user_packet && avpkt->
size) {
1019 avpkt->
data = new_data;
1025 if (ret < 0 || !*got_packet_ptr) {
1047 #if FF_API_OLD_ENCODE_AUDIO
1055 int ret, samples_size, got_packet;
1059 pkt.
size = buf_size;
1073 "support this codec\n");
1076 nb_samples = (int64_t)buf_size * 8 /
1079 if (nb_samples >= INT_MAX)
1123 return ret ? ret : pkt.
size;
1128 #if FF_API_OLD_ENCODE_VIDEO
1133 int ret, got_packet = 0;
1142 pkt.
size = buf_size;
1159 return ret ? ret : pkt.
size;
1167 int *got_packet_ptr)
1170 int user_packet = !!avpkt->
data;
1172 *got_packet_ptr = 0;
1186 ret = avctx->
codec->
encode2(avctx, avpkt, frame, got_packet_ptr);
1188 if (!*got_packet_ptr)
1193 if (!user_packet && avpkt->
size) {
1196 avpkt->
data = new_data;
1202 if (ret < 0 || !*got_packet_ptr)
1234 if (!data || size < 4)
1236 flags = bytestream_get_le32(&data);
1241 avctx->
channels = bytestream_get_le32(&data);
1259 avctx->
width = bytestream_get_le32(&data);
1260 avctx->
height = bytestream_get_le32(&data);
1267 int *got_picture_ptr,
1272 *got_picture_ptr = 0;
1286 ret = avctx->
codec->
decode(avctx, picture, got_picture_ptr,
1300 if (*got_picture_ptr)
1312 #if FF_API_OLD_DECODE_AUDIO
1314 int *frame_size_ptr,
1318 int ret, got_frame = 0;
1322 "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
1324 "avcodec_decode_audio4()\n");
1330 if (ret >= 0 && got_frame) {
1336 if (*frame_size_ptr < data_size) {
1338 "the current frame (%d < %d)\n", *frame_size_ptr, data_size);
1344 if (planar && avctx->
channels > 1) {
1346 for (ch = 1; ch < avctx->
channels; ch++) {
1351 *frame_size_ptr = data_size;
1353 *frame_size_ptr = 0;
1365 int planar, channels;
1382 ret = avctx->
codec->
decode(avctx, frame, got_frame_ptr, avpkt);
1383 if (ret >= 0 && *got_frame_ptr) {
1410 ret = avctx->
codec->
decode(avctx, sub, got_sub_ptr, avpkt);
1445 av_log(avctx,
AV_LOG_ERROR,
"insufficient thread locking around avcodec_open/close()\n");
1491 return experimental;
1535 int bits_per_sample;
1557 int i,
len, ret = 0;
1559 for (i = 0; i < 4; i++) {
1560 len = snprintf(buf, buf_size,
1561 isprint(codec_tag & 0xFF) ?
"%c" :
"[%d]", codec_tag & 0xFF);
1563 buf_size = buf_size > len ? buf_size - len : 0;
1572 const char *codec_name;
1573 const char *profile =
NULL;
1587 codec_name = p->
name;
1592 codec_name =
"mpeg2ts";
1599 snprintf(buf1,
sizeof(buf1),
"%s / 0x%04X", tag_buf, enc->
codec_tag);
1605 snprintf(buf, buf_size,
1609 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1612 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1617 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1625 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1626 " [PAR %d:%d DAR %d:%d]",
1628 display_aspect_ratio.
num, display_aspect_ratio.
den);
1632 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1638 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1639 ", q=%d-%d", enc->
qmin, enc->
qmax);
1643 snprintf(buf, buf_size,
1647 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1650 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1656 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1661 snprintf(buf, buf_size,
"Data: %s", codec_name);
1664 snprintf(buf, buf_size,
"Subtitle: %s", codec_name);
1667 snprintf(buf, buf_size,
"Attachment: %s", codec_name);
1670 snprintf(buf, buf_size,
"Invalid Codec type %d", enc->
codec_type);
1675 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1678 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1683 snprintf(buf + strlen(buf), buf_size - strlen(buf),
1684 ", %d kb/s", bitrate / 1000);
1713 #define LICENSE_PREFIX "libavcodec license: "
1738 for (j = 0; j < 4; j++) {
1841 if (bps > 0 && ch > 0 && frame_bytes > 0)
1842 return (frame_bytes * 8) / (bps * ch);
1869 return 256 * sr / 245;
1874 return (480 << (sr / 22050)) / ch;
1882 case 20:
return 160;
1883 case 19:
return 144;
1884 case 29:
return 288;
1885 case 37:
return 480;
1889 case 38:
return 160;
1890 case 50:
return 240;
1895 if (frame_bytes > 0) {
1898 return 240 * (frame_bytes / 32);
1900 return 256 * (frame_bytes / 64);
1905 return frame_bytes * 8 /
bps;
1913 return (frame_bytes - 4 * ch) * 2 / ch;
1915 return (frame_bytes - 4) * 2 / ch;
1917 return (frame_bytes - 8) * 2 / ch;
1919 return (frame_bytes / 128) * 224 / ch;
1921 return (frame_bytes - 6 - ch) / ch;
1923 return (frame_bytes - 8) / ch;
1925 return (frame_bytes - 2 * ch) / ch;
1927 return 3 * frame_bytes / ch;
1929 return 6 * frame_bytes / ch;
1931 return 2 * (frame_bytes / (5 * ch));
1938 return frame_bytes / ch;
1940 return frame_bytes * 2 / ch;
1946 int blocks = frame_bytes / ba;
1949 return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8);
1951 return blocks * (((ba - 16) * 2 / 3 * 4) / ch);
1953 return blocks * (1 + (ba - 4 * ch) * 2 / ch);
1955 return blocks * (2 + (ba - 7 * ch) * 2 / ch);
1963 return 2 * (frame_bytes / ((bps * 2 / 8) * ch));
1965 return frame_bytes / ((
FFALIGN(ch, 2) *
bps) / 8);
1967 return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
2001 for (i = 0; i < size && !(
tab[i][0] == a &&
tab[i][1] ==
b); i++) ;
2008 "version to the newest one from Git. If the problem still "
2009 "occurs, it means that your file has a feature which has not "
2010 "been implemented.\n", feature);
2017 va_list argument_list;
2019 va_start(argument_list, msg);
2024 "of this file to ftp://upload.libav.org/incoming/ "
2025 "and contact the libav-devel mailing list.\n");
2027 va_end(argument_list);
2051 if (hwaccel->
id == codec_id
2052 && hwaccel->
pix_fmt == pix_fmt)
2097 return toupper(x & 0xFF)
2098 + (toupper((x >> 8) & 0xFF) << 8)
2099 + (toupper((x >> 16) & 0xFF) << 16)
2100 + (toupper((x >> 24) & 0xFF) << 24);
#define FF_SANE_NB_CHANNELS
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
const struct AVCodec * codec
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 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 ...
static AVCodec * find_encdec(enum AVCodecID id, int encoder)
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
void av_free_packet(AVPacket *pkt)
Free a packet.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
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.
A dummy id pointing at the start of audio codecs.
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
void ff_thread_report_progress(AVFrame *f, int progress, int field)
Notify later decoding threads when part of their reference picture is ready.
int coded_width
Bitstream width / height, may be different from width/height.
int buffer_hints
codec suggestion on buffer type if != 0
void(* flush)(AVCodecContext *)
Flush buffers.
int av_lockmgr_register(int(*cb)(void **mutex, enum AVLockOp op))
Register a user provided lock manager supporting the operations specified by AVLockOp.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
enum AVPixelFormat pix_fmt
#define AV_NUM_DATA_POINTERS
AVFrame * coded_frame
the picture in the bitstream
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
int buffer_count
internal buffer count used by default get/release/reget_buffer().
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
const char * avcodec_configuration(void)
Return the libavcodec build-time configuration.
void * opaque
for some private data of the user
#define FF_MIN_BUFFER_SIZE
struct AVCodecContext * owner
the AVCodecContext which ff_thread_get_buffer() was last called on
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
const char * avcodec_license(void)
Return the libavcodec license.
InternalBuffer * buffer
internal buffers used by default get/release/reget_buffer().
void av_register_hwaccel(AVHWAccel *hwaccel)
Register the hardware accelerator hwaccel.
enum AVPixelFormat pix_fmt
Supported pixel format.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
Pad last frame with silence.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void ff_thread_free(AVCodecContext *avctx)
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer with padding, reusing the given one if large enough.
A dummy ID pointing at the start of various fake codecs.
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
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 ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
int(* decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt)
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Encode a frame of audio.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
four components are given, that's all.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
AVLockOp
Lock operation used by lockmgr.
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 ...
int av_codec_is_decoder(const AVCodec *codec)
#define FF_BUFFER_TYPE_INTERNAL
void av_picture_copy(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height)
Copy image src to dst.
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 av_codec_is_encoder(const AVCodec *codec)
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...
static int volatile entangled_thread_counter
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const 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.
#define FFSWAP(type, a, b)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
enum AVSampleFormat sample_fmt
audio sample format
int av_log_get_level(void)
uint8_t * base[AV_NUM_DATA_POINTERS]
Opaque data information usually continuous.
8 bit with PIX_FMT_RGB32 palette
uint8_t * data[AV_NUM_DATA_POINTERS]
static AVCodec * first_avcodec
static void audio_free_buffers(AVCodecContext *avctx)
int64_t pts
presentation timestamp in time_base units (time when frame should be shown to user) If AV_NOPTS_VALUE...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define AV_PIX_FMT_RGB555
int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Encode a frame of video.
int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
Submit a new frame to a decoding thread.
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
Get the planar alternative form of the given sample format.
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
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.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
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.
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
#define FF_BUFFER_HINTS_READABLE
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...
void(* destruct)(struct AVPacket *)
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int(* close)(AVCodecContext *)
av_cold int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
const uint64_t * channel_layouts
array of support channel layouts, or NULL if unknown. array is terminated by 0
static AVHWAccel * first_hwaccel
planar GBR 4:4:4 27bpp, big-endian
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
AVHWAccel * av_hwaccel_next(AVHWAccel *hwaccel)
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL...
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define CODEC_CAP_SMALL_LAST_FRAME
AVCodecID
Identify the syntax and semantics of the bitstream.
int width
width and height of the video frame
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Multithreading support functions.
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.
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
#define AVERROR_EXPERIMENTAL
unsigned int avpriv_toupper4(unsigned int x)
int qmax
maximum quantizer
AVCodec * av_codec_next(const AVCodec *c)
If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec...
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
int active_thread_type
Which multithreading methods are in use by the codec.
int avcodec_is_open(AVCodecContext *s)
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.
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:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
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,...)
enum AVMediaType avcodec_get_type(enum AVCodecID codec_id)
Get the type of the given codec.
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
const char * name
Name of the codec implementation.
#define CODEC_FLAG_EMU_EDGE
void * thread_opaque
thread opaque Can be used by execute() to store some per AVCodecContext stuff.
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.
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int rc_buffer_size
decoder bitstream buffer size
#define CODEC_CAP_AUTO_THREADS
uint64_t channel_layout
Channel layout of the audio data.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int(* encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
#define INTERNAL_BUFFER_SIZE
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
struct AVRational AVRational
rational number numerator/denominator
#define CODEC_CAP_PARAM_CHANGE
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
audio channel layout utility functions
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
AVPicture pict
data+linesize for the bitmap of this subtitle.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
int width
picture width / height.
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic)
int type
type of the buffer (to keep track of who has to deallocate data[*])
#define CODEC_CAP_EXPERIMENTAL
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)
packed RGB 8:8:8, 24bpp, BGRBGR...
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
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.
enum AVPixelFormat pix_fmt
static pthread_mutex_t * mutex
static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
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.
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define FF_COMPLIANCE_EXPERIMENTAL
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
void avcodec_flush_buffers(AVCodecContext *avctx)
Flush buffers, should be called when seeking or when switching to a different stream.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
int frame_size
Number of samples per channel in an audio frame.
#define attribute_align_arg
#define PIX_FMT_HWACCEL
Pixel format is an HW accelerated format.
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
uint8_t * audio_data
The data for the last allocated audio frame.
int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat 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.
enum AVMediaType codec_type
void(* init_static_data)(struct AVCodec *codec)
Initialize codec static data, called from avcodec_register().
int av_opt_set_dict(void *obj, AVDictionary **options)
int sample_rate
samples per second
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
unsigned avcodec_get_edge_width(void)
Return the amount of padding in pixels which the get_buffer callback must provide around the edge of ...
uint8_t * data[AV_NUM_DATA_POINTERS]
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
planar GBR 4:4:4 30bpp, big-endian
main external API structure.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int qmin
minimum quantizer
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
AVRational sample_aspect_ratio
sample aspect ratio for the video frame, 0/1 if unknown/unspecified
int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
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
void avcodec_default_free_buffers(AVCodecContext *avctx)
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
static int(* ff_lockmgr_cb)(void **mutex, enum AVLockOp op)
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
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.
int sample_rate
Sample rate of the audio data.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
av_cold void ff_dsputil_static_init(void)
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
Log a generic warning message about a missing feature.
rational number numerator/denominator
const char * name
short name for the profile
uint16_t step_minus1
Number of elements between 2 horizontally consecutive pixels minus 1.
#define FF_INPUT_BUFFER_PADDING_SIZE
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
void ff_thread_flush(AVCodecContext *avctx)
Wait for decoding threads to finish and reset internal state.
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
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...
int64_t pkt_pts
pts copied from the AVPacket that was decoded to produce this frame
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
const AVClass * priv_class
AVClass for the private context.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
const OptionDef options[]
#define LIBAVCODEC_VERSION_INT
int64_t pkt_dts
dts copied from the AVPacket that triggered returning this frame
AVPacket * pkt
Current packet as passed into the decoder, to avoid having to pass the packet into every function...
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
#define CODEC_CAP_VARIABLE_FRAME_SIZE
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void av_opt_free(void *obj)
Free all string and binary options in obj.
common internal api header.
int avpriv_lock_avformat(void)
static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
static void avcodec_init(void)
planar GBR 4:4:4 27bpp, little-endian
uint32_t start_display_time
AVSampleFormat
Audio Sample Formats.
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
enum AVCodecID id
Codec implemented by the hardware accelerator.
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
int avcodec_default_execute2(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
FAKE codec to indicate a raw MPEG-2 TS stream (only used by libavformat)
as in Berlin toast format
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.
unsigned avcodec_version(void)
Return the LIBAVCODEC_VERSION_INT constant.
Y , 16bpp, little-endian.
char * ass
0 terminated ASS/SSA compatible event line.
static void * avformat_mutex
int key_frame
1 -> keyframe, 0-> not
struct AVPacket::@11 * side_data
Additional packet data that can be provided by the container.
static int get_bit_rate(AVCodecContext *ctx)
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.
static const struct twinvq_data tab
void avcodec_free_frame(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
void avcodec_register(AVCodec *codec)
Register the codec codec and initialize libavcodec.
int frame_number
Frame counter, set by libavcodec.
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int avpriv_unlock_avformat(void)
int(* init)(AVCodecContext *)
uint8_t ** extended_data
pointers to the data planes/channels.
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
AVPixelFormat
Pixel format.
This structure stores compressed data.
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub)
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
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
A dummy ID pointing at the start of subtitle codecs.
planar GBR 4:4:4 30bpp, little-endian
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
#define FF_PROFILE_UNKNOWN
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.
int last_audio_frame
An audio frame with less than required samples has been submitted and padded with silence...
uint8_t * subtitle_header
Header containing style information for text subtitles.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)
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.
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian