Changeset d596c8e310c0788ade456e86f76735fb069b0b5a
- Timestamp:
- 04/02/04 00:31:46
(5 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1075851106 +0000
- git-parent:
[9f3bc4291301d37358d8d9b2525409c734800211]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1075851106 +0000
- Message:
* modules/audio_output/file.c: added --audiofile-channels=integer option to specify the number of channels wanted in the output file.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb5c5386 |
rd596c8e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: file.c,v 1.27 2004/01/25 18:53:07 gbazin Exp $ |
|---|
| | 5 | * $Id: file.c,v 1.28 2004/02/03 23:31:46 gbazin Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Christophe Massiot <massiot@via.ecp.fr> |
|---|
| … | … | |
| 70 | 70 | }; |
|---|
| 71 | 71 | |
|---|
| | 72 | #define CHANNELS_MAX 6 |
|---|
| | 73 | static int pi_channels_maps[CHANNELS_MAX+1] = |
|---|
| | 74 | { |
|---|
| | 75 | 0, |
|---|
| | 76 | AOUT_CHAN_CENTER, |
|---|
| | 77 | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT, |
|---|
| | 78 | AOUT_CHAN_CENTER | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT, |
|---|
| | 79 | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT |
|---|
| | 80 | | AOUT_CHAN_REARRIGHT, |
|---|
| | 81 | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| | 82 | | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT, |
|---|
| | 83 | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| | 84 | | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE |
|---|
| | 85 | }; |
|---|
| | 86 | |
|---|
| 72 | 87 | /***************************************************************************** |
|---|
| 73 | 88 | * Local prototypes. |
|---|
| … | … | |
| 80 | 95 | * Module descriptor |
|---|
| 81 | 96 | *****************************************************************************/ |
|---|
| 82 | | #define FORMAT_TEXT N_("Output Format") |
|---|
| | 97 | #define FORMAT_TEXT N_("Output format") |
|---|
| 83 | 98 | #define FORMAT_LONGTEXT N_("One of \"u8\", \"s8\", \"u16\", \"s16\", " \ |
|---|
| 84 | | "\"u16_le\", \"s16_le\", \"u16_be\", " \ |
|---|
| 85 | | "\"s16_be\", \"fixed32\", \"float32\" or \"spdif\"") |
|---|
| | 99 | "\"u16_le\", \"s16_le\", \"u16_be\", \"s16_be\", \"fixed32\", " \ |
|---|
| | 100 | "\"float32\" or \"spdif\"") |
|---|
| | 101 | #define CHANNELS_TEXT N_("Output channels number") |
|---|
| | 102 | #define CHANNELS_LONGTEXT N_("By default, all the channels of the incoming " \ |
|---|
| | 103 | "will be saved but you can restrict the number of channels here.") |
|---|
| | 104 | |
|---|
| 86 | 105 | #define WAV_TEXT N_("Add wave header") |
|---|
| 87 | 106 | #define WAV_LONGTEXT N_("Instead of writing a raw file, you can add a wav " \ |
|---|
| … | … | |
| 102 | 121 | VLC_FOURCC('s','p','i','f') }; |
|---|
| 103 | 122 | |
|---|
| 104 | | #define FILE_TEXT N_("Output File") |
|---|
| | 123 | #define FILE_TEXT N_("Output file") |
|---|
| 105 | 124 | #define FILE_LONGTEXT N_("File to which the audio samples will be written to") |
|---|
| 106 | 125 | |
|---|
| … | … | |
| 111 | 130 | FORMAT_TEXT, FORMAT_LONGTEXT, VLC_TRUE ); |
|---|
| 112 | 131 | change_string_list( format_list, 0, 0 ); |
|---|
| 113 | | add_file( "audiofile", "audiofile.wav", NULL, FILE_TEXT, |
|---|
| | 132 | add_integer( "audiofile-channels", 0, NULL, |
|---|
| | 133 | CHANNELS_TEXT, CHANNELS_LONGTEXT, VLC_TRUE ); |
|---|
| | 134 | add_file( "audiofile-file", "audiofile.wav", NULL, FILE_TEXT, |
|---|
| 114 | 135 | FILE_LONGTEXT, VLC_FALSE ); |
|---|
| 115 | 136 | add_bool( "audiofile-wav", 1, NULL, WAV_TEXT, WAV_LONGTEXT, VLC_TRUE ); |
|---|
| … | … | |
| 127 | 148 | { |
|---|
| 128 | 149 | aout_instance_t * p_aout = (aout_instance_t *)p_this; |
|---|
| 129 | | char * psz_name = config_GetPsz( p_this, "audiofile" ); |
|---|
| 130 | | char * psz_format = config_GetPsz( p_aout, "audiofile-format" ); |
|---|
| | 150 | char * psz_name, * psz_format; |
|---|
| 131 | 151 | char ** ppsz_compare = format_list; |
|---|
| 132 | | int i = 0; |
|---|
| 133 | | |
|---|
| 134 | | /* Allocate structure */ |
|---|
| | 152 | vlc_value_t val; |
|---|
| | 153 | int i_channels, i = 0; |
|---|
| | 154 | |
|---|
| | 155 | var_Create( p_this, "audiofile-file", VLC_VAR_STRING|VLC_VAR_DOINHERIT ); |
|---|
| | 156 | var_Get( p_this, "audiofile-file", &val ); |
|---|
| | 157 | psz_name = val.psz_string; |
|---|
| | 158 | if( !psz_name || !*psz_name ) |
|---|
| | 159 | { |
|---|
| | 160 | msg_Err( p_aout, "you need to specify an output file name" ); |
|---|
| | 161 | if( psz_name ) free( psz_name ); |
|---|
| | 162 | return VLC_EGENERIC; |
|---|
| | 163 | } |
|---|
| | 164 | |
|---|
| | 165 | /* Allocate structure */ |
|---|
| 135 | 166 | p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 136 | 167 | if( p_aout->output.p_sys == NULL ) |
|---|
| … | … | |
| 145 | 176 | { |
|---|
| 146 | 177 | free( p_aout->output.p_sys ); |
|---|
| 147 | | return -1; |
|---|
| | 178 | return VLC_EGENERIC; |
|---|
| 148 | 179 | } |
|---|
| 149 | 180 | |
|---|
| 150 | 181 | p_aout->output.pf_play = Play; |
|---|
| | 182 | |
|---|
| | 183 | /* Audio format */ |
|---|
| | 184 | var_Create( p_this, "audiofile-format", VLC_VAR_STRING|VLC_VAR_DOINHERIT ); |
|---|
| | 185 | var_Get( p_this, "audiofile-format", &val ); |
|---|
| | 186 | psz_format = val.psz_string; |
|---|
| 151 | 187 | |
|---|
| 152 | 188 | while ( *ppsz_compare != NULL ) |
|---|
| … | … | |
| 165 | 201 | fclose( p_aout->output.p_sys->p_file ); |
|---|
| 166 | 202 | free( p_aout->output.p_sys ); |
|---|
| 167 | | return -1; |
|---|
| | 203 | return VLC_EGENERIC; |
|---|
| 168 | 204 | } |
|---|
| 169 | 205 | |
|---|
| … | … | |
| 182 | 218 | } |
|---|
| 183 | 219 | |
|---|
| 184 | | p_aout->output.p_sys->b_add_wav_header = |
|---|
| 185 | | config_GetInt( p_this, "audiofile-wav" ); |
|---|
| | 220 | /* Channels number */ |
|---|
| | 221 | var_Create( p_this, "audiofile-channels", |
|---|
| | 222 | VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); |
|---|
| | 223 | var_Get( p_this, "audiofile-channels", &val ); |
|---|
| | 224 | i_channels = val.i_int; |
|---|
| | 225 | |
|---|
| | 226 | if( i_channels > 0 && i_channels <= CHANNELS_MAX ) |
|---|
| | 227 | { |
|---|
| | 228 | p_aout->output.output.i_physical_channels = |
|---|
| | 229 | pi_channels_maps[i_channels]; |
|---|
| | 230 | } |
|---|
| | 231 | |
|---|
| | 232 | /* WAV header */ |
|---|
| | 233 | var_Create( p_this, "audiofile-wav", VLC_VAR_BOOL|VLC_VAR_DOINHERIT ); |
|---|
| | 234 | var_Get( p_this, "audiofile-wav", &val ); |
|---|
| | 235 | p_aout->output.p_sys->b_add_wav_header = val.b_bool; |
|---|
| 186 | 236 | |
|---|
| 187 | 237 | if( p_aout->output.p_sys->b_add_wav_header ) |
|---|