Ubuntu Pastebin

Paste from aaa at Sat, 19 Mar 2016 13:30:31 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
decoded_frame = NULL;
    format_ctx = NULL;
    c = orig_c = NULL;
    codec = NULL;
    in_format = NULL;
    options = NULL;

    avcodec_register_all();

    if ((error = avformat_open_input(&format_ctx, argv[1], in_format, &options)) < 0) {
        fprintf(stderr, "Unable to open file %s (error %s)\n", argv[1], get_error_text(error));
        return EXIT_FAILURE;
    }

    if (avformat_find_stream_info(format_ctx, NULL)<0) {
        fprintf(stderr, "Unable to find stream info\n");
        return EXIT_FAILURE;
    }

    av_dump_format(format_ctx, 0, argv[1], 0);

    audio_stream = -1;
    for (i = 0; i < format_ctx->nb_streams; ++i)
        if (format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
            audio_stream = i;
            break;
        }
    if (audio_stream == -1) {
        fprintf(stderr, "Unable to find audio stream\n");
        return EXIT_FAILURE;
    }
Download as text