50 return (ret == ret_done) ? 0 : ret;
84 fprintf(stderr,
"Error decoding: %d\n", ret);
91 fprintf(stderr,
"Error decoding: %d\n", ret);
101 fprintf(stderr,
"Error flushing: %d\n", ret);
125 memset(dc, 0,
sizeof(*dc));
136 fprintf(stderr,
"Error opening input file: %d\n", ret);
Libavcodec external API header.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
int ds_open(DecodeContext *dc, const char *url, int stream_idx)
void ds_free(DecodeContext *dc)
int ds_run(DecodeContext *dc)
static int decode_read(DecodeContext *dc, int flush)
void(* flush)(AVBSFContext *ctx)
reference-counted frame API
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.
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.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
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.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
#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.
int64_t frame_num
Frame counter, set by libavcodec.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVStream ** streams
A list of all streams in the file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int index
stream index in AVFormatContext
AVDictionary * decoder_opts
int(* process_frame)(struct DecodeContext *dc, AVFrame *frame)
AVFormatContext * demuxer