26 const char *
name,
const uint8_t *input,
int input_size)
34 memcpy(padded, input, input_size);
36 input_size ? padded :
NULL, input_size,
38 printf(
"%s: input %d, consumed %d, output %d",
name, input_size,
ret, output_size);
40 printf(
", duration %d, bitrate %" PRId64
", ",
42 for (
int i = 0;
i < output_size;
i++)
52 uint8_t blocks[2 * 2 * 18] = { 0 };
58 ctx->codec_id = codec;
66 parse(parser,
ctx,
"exact", blocks, block_size);
67 parse(parser,
ctx,
"split start", blocks, block_size - 1);
68 parse(parser,
ctx,
"split end", blocks + block_size - 1, 1);
73 parse(parser,
ctx,
"combined", blocks, 2 * block_size);
74 parse(parser,
ctx,
"remainder", blocks + block_size, block_size);
76 parse(parser,
ctx,
"truncated block", blocks, block_size - 1);
86 parse(parser,
ctx,
"complete frames", blocks, 2 * block_size);
static void parse(AVCodecParserContext *parser, AVCodecContext *ctx, const char *name, const uint8_t *input, int input_size)
static int test_parser(enum AVCodecID codec, int channels, int frame_size)
static AVFormatContext * ctx
Libavcodec external API header.
#define PARSER_FLAG_COMPLETE_FRAMES
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
static const uint8_t frame_size[4]
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVCodecID
Identify the syntax and semantics of the bitstream.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
AVCodecParserContext * av_parser_init(enum AVCodecID codec_id)
void av_parser_close(AVCodecParserContext *s)
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.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define AV_NOPTS_VALUE
Undefined timestamp value.
main external API structure.
int duration
Duration of the current frame.