#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
{
if (ret < 0) {
fprintf(stderr, "Error decoding video frame\n");
}
if (*got_frame) {
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
cached ? "(cached)" : "",
}
if (ret < 0) {
fprintf(stderr, "Error decoding audio frame\n");
}
if (*got_frame) {
printf("audio_frame%s n:%d nb_samples:%d pts:%s\n",
cached ? "(cached)" : "",
}
}
return decoded;
}
{
if (ret < 0) {
fprintf(stderr, "Could not find %s stream in input file '%s'\n",
} else {
st = fmt_ctx->
streams[*stream_idx];
if (!dec) {
fprintf(stderr, "Failed to find %s codec\n",
}
fprintf(stderr, "Failed to open %s codec\n",
}
}
return 0;
}
{
int i;
struct sample_fmt_entry {
} sample_fmt_entries[] = {
};
*fmt = NULL;
struct sample_fmt_entry *entry = &sample_fmt_entries[i];
if (sample_fmt == entry->sample_fmt) {
*fmt =
AV_NE(entry->fmt_be, entry->fmt_le);
return 0;
}
}
fprintf(stderr,
"sample format %s is not supported as output format\n",
return -1;
}
int main (
int argc,
char **argv)
{
int ret = 0, got_frame;
if (argc != 4) {
fprintf(stderr, "usage: %s input_file video_output_file audio_output_file\n"
"API example program to show how to read frames from an input file.\n"
"This program reads frames from a file, decodes them, and writes decoded\n"
"video frames to a rawvideo file named video_output_file, and decoded\n"
"audio frames to a rawaudio file named audio_output_file.\n"
"\n", argv[0]);
exit(1);
}
fprintf(stderr,
"Could not open source file %s\n",
src_filename);
exit(1);
}
fprintf(stderr, "Could not find stream information\n");
exit(1);
}
video_dec_ctx = video_stream->
codec;
ret = 1;
}
if (ret < 0) {
fprintf(stderr, "Could not allocate raw video buffer\n");
}
}
ret = 1;
}
}
fprintf(stderr, "Could not find audio or video stream in the input, aborting\n");
ret = 1;
}
if (!frame) {
fprintf(stderr, "Could not allocate frame\n");
}
if (video_stream)
do {
if (ret < 0)
break;
}
do {
} while (got_frame);
printf("Demuxing succeeded.\n");
if (video_stream) {
printf("Play the output video file with the command:\n"
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
}
printf("Warning: the sample format the decoder produced is planar "
"(%s). This example will output the first channel only.\n",
packed ? packed : "?");
n_channels = 1;
}
printf("Play the output audio file with the command:\n"
"ffplay -f %s -ac %d -ar %d %s\n",
}
if (video_dec_ctx)
return ret < 0;
}