Go to the documentation of this file.
45 0xff, 0xab, 0xcd, 0xef, 0x12, 0x34, 0x56, 0x78,
75 0, (
const void **)&
pix_fmts, &num_pix_fmts);
105 for (
int i = 0;
i < n_frames;
i++) {
112 memset(
frame->data[1], 64, (
size_t)
frame->linesize[1] * chroma_h);
114 memset(
frame->data[2], 64, (
size_t)
frame->linesize[2] * chroma_h);
186 for (k = 0; k < n; k++)
204 const uint8_t *buf,
int buf_size)
228 const uint8_t *buf,
int buf_size,
int chunk_size,
229 uint8_t **all_out,
size_t *all_size)
232 const uint8_t *
p = buf;
233 int remaining = buf_size;
242 chunk_size = buf_size ? buf_size : 1;
244 while (remaining > 0) {
245 int feed = remaining < chunk_size ? remaining : chunk_size;
255 snprintf(label,
sizeof(label),
"%s[%d]",
tag, n++);
270 p += consumed > 0 ? consumed :
feed;
271 remaining -= consumed > 0 ? consumed :
feed;
284 snprintf(label,
sizeof(label),
"%s[%d]",
tag, n++);
302 int main(
int argc,
char **argv)
304 const char *codec_name = argc > 1 ? argv[1] :
"h261";
305 int width = argc > 2 ? atoi(argv[2]) : 176;
306 int height = argc > 3 ? atoi(argv[3]) : 144;
309 uint8_t *encoded =
NULL;
313 uint8_t *bulk_data =
NULL, *split_data =
NULL;
314 size_t bulk_sz = 0, split_sz = 0;
341 if (!encoded || encoded_size == 0) {
357 &bulk_data, &bulk_sz);
366 (
int)encoded_size / 2, &split_data, &split_sz);
372 if (bulk_sz != split_sz || memcmp(bulk_data, split_data, bulk_sz) != 0) {
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVPixelFormat
Pixel format.
int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Read encoded data from the encoder.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
__device__ int printf(const char *,...)
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static void feed(AVFilterContext *ctx, int ch, const float *in_samples, float *out_samples, float *in_frame, float *out_dist_frame, float *windowed_frame, float *drc_frame, float *spectrum_buf, float *energy, float *target_gain, float *envelope, float *factors)
This structure describes decoded (raw) audio or video data.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
static void print_parse_result(const char *label, const uint8_t *out, int out_size)
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
static int parse_stream(AVCodecContext *avctx, enum AVCodecID codec_id, const char *tag, const uint8_t *buf, int buf_size, int chunk_size, uint8_t **all_out, size_t *all_size)
AVCodecParserContext * av_parser_init(int codec_id)
static uint8_t * encode_frames(const AVCodec *enc, int width, int height, int n_frames, size_t *out_size)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint8_t garbage[]
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define AV_CEIL_RSHIFT(a, b)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Rational number (pair of numerator and denominator).
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
int main(int argc, char **argv)
AVCodecID
Identify the syntax and semantics of the bitstream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out, int *out_num)
Retrieve a list of all supported values for a given configuration type.
static enum AVPixelFormat pix_fmts[4][4]
#define i(width, name, range_min, range_max)
#define AV_NOPTS_VALUE
Undefined timestamp value.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_log_set_level(int level)
Set the log level.
int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Supply a raw video or audio frame to the encoder.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AV_INPUT_BUFFER_PADDING_SIZE
main external API structure.
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
Parse a packet.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
This structure stores compressed data.
int width
picture width / height.
static int parse_once(AVCodecContext *avctx, enum AVCodecID codec_id, const char *label, const uint8_t *buf, int buf_size)
void av_parser_close(AVCodecParserContext *s)
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.