Revision ce1ee094 ffmpeg.c

View differences:

ffmpeg.c
32 32
#include "libswscale/swscale.h"
33 33
#include "libavformat/framehook.h"
34 34
#include "libavcodec/opt.h"
35
#include "libavcodec/audioconvert.h"
35 36
#include "libavutil/fifo.h"
36 37
#include "libavutil/avstring.h"
37 38
#include "libavformat/os_support.h"
......
103 104
static int frame_height = 0;
104 105
static float frame_aspect_ratio = 0;
105 106
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
107
static enum SampleFormat audio_sample_fmt = SAMPLE_FMT_NONE;
106 108
static int frame_padtop  = 0;
107 109
static int frame_padbottom = 0;
108 110
static int frame_padleft  = 0;
......
2455 2457
    }
2456 2458
}
2457 2459

  
2458
static void list_pix_fmts(void)
2460
static void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
2459 2461
{
2460 2462
    int i;
2461
    char pix_fmt_str[128];
2462
    for (i=-1; i < PIX_FMT_NB; i++) {
2463
        avcodec_pix_fmt_string (pix_fmt_str, sizeof(pix_fmt_str), i);
2464
        fprintf(stdout, "%s\n", pix_fmt_str);
2463
    char fmt_str[128];
2464
    for (i=-1; i < nb_fmts; i++) {
2465
        get_fmt_string (fmt_str, sizeof(fmt_str), i);
2466
        fprintf(stdout, "%s\n", fmt_str);
2465 2467
    }
2466 2468
}
2467 2469

  
......
2470 2472
    if (strcmp(arg, "list"))
2471 2473
        frame_pix_fmt = avcodec_get_pix_fmt(arg);
2472 2474
    else {
2473
        list_pix_fmts();
2475
        list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);
2474 2476
        av_exit(0);
2475 2477
    }
2476 2478
}
......
2524 2526
    return 0;
2525 2527
}
2526 2528

  
2529
static void opt_audio_sample_fmt(const char *arg)
2530
{
2531
    if (strcmp(arg, "list"))
2532
        audio_sample_fmt = avcodec_get_sample_fmt(arg);
2533
    else {
2534
        list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB);
2535
        av_exit(0);
2536
    }
2537
}
2538

  
2527 2539
static int opt_audio_rate(const char *opt, const char *arg)
2528 2540
{
2529 2541
    audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);

Also available in: Unified diff