Originally committed as revision 4066 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authored on 2005/03/23 11:10:23... | ... |
@@ -254,7 +254,7 @@ static char *video_standard = "ntsc"; |
254 | 254 |
|
255 | 255 |
static char *audio_grab_format = "audio_device"; |
256 | 256 |
static char *audio_device = NULL; |
257 |
-static int audio_volume = 100; // |
|
257 |
+static int audio_volume = 256; |
|
258 | 258 |
|
259 | 259 |
static int using_stdin = 0; |
260 | 260 |
static int using_vhook = 0; |
... | ... |
@@ -1212,12 +1212,11 @@ static int output_packet(AVInputStream *ist, int ist_index, |
1212 | 1212 |
|
1213 | 1213 |
// preprocess audio (volume) |
1214 | 1214 |
if (ist->st->codec.codec_type == CODEC_TYPE_AUDIO) { |
1215 |
- if (audio_volume != 100) { |
|
1215 |
+ if (audio_volume != 256) { |
|
1216 | 1216 |
short *volp; |
1217 |
- int v; |
|
1218 | 1217 |
volp = samples; |
1219 | 1218 |
for(i=0;i<(data_size / sizeof(short));i++) { |
1220 |
- v = (*volp) * audio_volume / 100; |
|
1219 |
+ int v = ((*volp) * audio_volume + 128) >> 8; |
|
1221 | 1220 |
if (v < -32768) v = -32768; |
1222 | 1221 |
if (v > 32767) v = 32767; |
1223 | 1222 |
*volp++ = v; |
... | ... |
@@ -4091,7 +4090,7 @@ const OptionDef options[] = { |
4091 | 4091 |
{ "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" }, |
4092 | 4092 |
{ "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" }, |
4093 | 4093 |
{ "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" }, |
4094 |
- { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (100=normal)" , "volume" }, // |
|
4094 |
+ { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, // |
|
4095 | 4095 |
|
4096 | 4096 |
/* grab options */ |
4097 | 4097 |
{ "vd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_device}, "set video grab device", "device" }, |