Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Reynaldo H. Verdejo Pinochet authored on 2014/12/09 06:32:22... | ... |
@@ -195,13 +195,38 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av, |
195 | 195 |
av_dict_copy(&recommended, *opts, 0); |
196 | 196 |
av_opt_set_dict2(av->priv_data, opts, AV_OPT_SEARCH_CHILDREN); |
197 | 197 |
av_opt_set_dict2(av, opts, AV_OPT_SEARCH_CHILDREN); |
198 |
+ |
|
198 | 199 |
if (av_dict_count(*opts)) |
199 | 200 |
av_log(NULL, AV_LOG_WARNING, |
200 | 201 |
"Something is wrong, %d options are not set!\n", |
201 | 202 |
av_dict_count(*opts)); |
202 | 203 |
|
203 |
- if (config->stream_use_defaults) { |
|
204 |
- //TODO: reident |
|
204 |
+ if (!config->stream_use_defaults) { |
|
205 |
+ switch(av->codec_type) { |
|
206 |
+ case AVMEDIA_TYPE_AUDIO: |
|
207 |
+ if (av->bit_rate == 0) |
|
208 |
+ report_config_error(config->filename, config->line_num, |
|
209 |
+ AV_LOG_ERROR, &config->errors, |
|
210 |
+ "audio bit rate is not set\n"); |
|
211 |
+ if (av->sample_rate == 0) |
|
212 |
+ report_config_error(config->filename, config->line_num, |
|
213 |
+ AV_LOG_ERROR, &config->errors, |
|
214 |
+ "audio sample rate is not set\n"); |
|
215 |
+ break; |
|
216 |
+ case AVMEDIA_TYPE_VIDEO: |
|
217 |
+ if (av->width == 0 || av->height == 0) |
|
218 |
+ report_config_error(config->filename, config->line_num, |
|
219 |
+ AV_LOG_ERROR, &config->errors, |
|
220 |
+ "video size is not set\n"); |
|
221 |
+ break; |
|
222 |
+ default: |
|
223 |
+ av_assert0(0); |
|
224 |
+ } |
|
225 |
+ goto done; |
|
226 |
+ } |
|
227 |
+ |
|
228 |
+ /* stream_use_defaults = true */ |
|
229 |
+ |
|
205 | 230 |
/* compute default parameters */ |
206 | 231 |
switch(av->codec_type) { |
207 | 232 |
case AVMEDIA_TYPE_AUDIO: |
... | ... |
@@ -287,29 +312,8 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av, |
287 | 287 |
default: |
288 | 288 |
abort(); |
289 | 289 |
} |
290 |
- } else { |
|
291 |
- switch(av->codec_type) { |
|
292 |
- case AVMEDIA_TYPE_AUDIO: |
|
293 |
- if (av->bit_rate == 0) |
|
294 |
- report_config_error(config->filename, config->line_num, |
|
295 |
- AV_LOG_ERROR, &config->errors, |
|
296 |
- "audio bit rate is not set\n"); |
|
297 |
- if (av->sample_rate == 0) |
|
298 |
- report_config_error(config->filename, config->line_num, |
|
299 |
- AV_LOG_ERROR, &config->errors, |
|
300 |
- "audio sample rate is not set\n"); |
|
301 |
- break; |
|
302 |
- case AVMEDIA_TYPE_VIDEO: |
|
303 |
- if (av->width == 0 || av->height == 0) |
|
304 |
- report_config_error(config->filename, config->line_num, |
|
305 |
- AV_LOG_ERROR, &config->errors, |
|
306 |
- "video size is not set\n"); |
|
307 |
- break; |
|
308 |
- default: |
|
309 |
- av_assert0(0); |
|
310 |
- } |
|
311 |
- } |
|
312 | 290 |
|
291 |
+done: |
|
313 | 292 |
st = av_mallocz(sizeof(AVStream)); |
314 | 293 |
if (!st) |
315 | 294 |
return; |