aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2008-07-31 13:11:07 +0000
committerPeter Ross <pross@xvid.org>2008-07-31 13:11:07 +0000
commitce1ee094d7f0b12565f659a3d298469b21fcf348 (patch)
tree2d3b7b824114d5ffdfaa72d134215150121c7943 /ffmpeg.c
parent9e82a113e56b5bcc97bff32bdfce48ab24b7c267 (diff)
downloadffmpeg-ce1ee094d7f0b12565f659a3d298469b21fcf348.tar.gz
Add opt handler for pending "-sample_fmt" option
Originally committed as revision 14486 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 62802ddc91..ee9a4883b2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -32,6 +32,7 @@
#include "libswscale/swscale.h"
#include "libavformat/framehook.h"
#include "libavcodec/opt.h"
+#include "libavcodec/audioconvert.h"
#include "libavutil/fifo.h"
#include "libavutil/avstring.h"
#include "libavformat/os_support.h"
@@ -103,6 +104,7 @@ static int frame_width = 0;
static int frame_height = 0;
static float frame_aspect_ratio = 0;
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
+static enum SampleFormat audio_sample_fmt = SAMPLE_FMT_NONE;
static int frame_padtop = 0;
static int frame_padbottom = 0;
static int frame_padleft = 0;
@@ -2455,13 +2457,13 @@ static void opt_frame_pad_right(const char *arg)
}
}
-static void list_pix_fmts(void)
+static void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
{
int i;
- char pix_fmt_str[128];
- for (i=-1; i < PIX_FMT_NB; i++) {
- avcodec_pix_fmt_string (pix_fmt_str, sizeof(pix_fmt_str), i);
- fprintf(stdout, "%s\n", pix_fmt_str);
+ char fmt_str[128];
+ for (i=-1; i < nb_fmts; i++) {
+ get_fmt_string (fmt_str, sizeof(fmt_str), i);
+ fprintf(stdout, "%s\n", fmt_str);
}
}
@@ -2470,7 +2472,7 @@ static void opt_frame_pix_fmt(const char *arg)
if (strcmp(arg, "list"))
frame_pix_fmt = avcodec_get_pix_fmt(arg);
else {
- list_pix_fmts();
+ list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);
av_exit(0);
}
}
@@ -2524,6 +2526,16 @@ static int opt_thread_count(const char *opt, const char *arg)
return 0;
}
+static void opt_audio_sample_fmt(const char *arg)
+{
+ if (strcmp(arg, "list"))
+ audio_sample_fmt = avcodec_get_sample_fmt(arg);
+ else {
+ list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB);
+ av_exit(0);
+ }
+}
+
static int opt_audio_rate(const char *opt, const char *arg)
{
audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);