36#define FRAME_SIZE 1536
37#define FRAMES_PER_PACKET 4
116 printf(
"skip %"PRIu32
"/%"PRIu32
" reason %d/%d\n",
125 printf(
"packet %d: pts %"PRId64
" size %d skip %"PRIu32
"/%"PRIu32
126 " reason %d/%d\n", n,
pkt->pts,
pkt->size,
134 samples +=
frame->nb_samples;
144 samples +=
frame->nb_samples;
148 printf(
"packets %d, decoded samples %"PRId64
"\n", n, samples);
161 static const struct {
166 { 2000, 0, 0, 0, 0 },
167 { 3500, 0, 0, 0, 0 },
168 { 1000, 0, 0, 0, 1100 },
169 { 3500, 100, 1, 1, 0 },
174 fprintf(stderr,
"Usage: %s <ac3 file>\n", argv[0]);
Libavcodec external API header.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define i(width, name, range_min, range_max)
#define FRAMES_PER_PACKET
__device__ int printf(const char *,...)
static const FFInputFormat test_demuxer
static int read_header(FFV1Context *f, RangeCoder *c)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommends skipping the specified number of samples.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
#define AVERROR_EOF
End of file.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
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.
void av_log_set_level(int level)
Set the log level.
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx)
Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap...
static uint8_t * file_buf
static uint8_t reason_start
static int read_packet(AVFormatContext *s, AVPacket *pkt)
static uint8_t reason_end
static int read_header(AVFormatContext *s)
static uint32_t skip_start
static uint32_t next_skip_start
#define FF_ARRAY_ELEMS(a)
main external API structure.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
enum AVStreamParseType need_parsing