History

swresample: Check channel layouts and channels against each other and print human readable error messages

Michael Niedermayer committed 11 years ago

Commit 3c77bb51 parent 80a28c71 file · +12 −3Browse files

Showing the changes to libswresample (1 of 1 file). Show all

Unified · Split

libswresample/swresample.c+12−3
@@ -152,6 +152,7 @@ av_cold void swr_close(SwrContext *s){ · 151 unmodified lines
152 152
153av_cold int swr_init(struct SwrContext *s){153av_cold int swr_init(struct SwrContext *s){
154 int ret;154 int ret;
155 char l1[1024], l2[1024];
155 156
156 clear_context(s);157 clear_context(s);
157 158
@@ -277,10 +278,18 @@ av_cold int swr_init(struct SwrContext *s){ · 119 unmodified lines
277 return -1;278 return -1;
278 }279 }
279 280
281 av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
282 av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
283 if (s->out_ch_layout && s->out.ch_count != av_get_channel_layout_nb_channels(s->out_ch_layout)) {
284 av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified channel count %d\n", l2, s->out.ch_count);
285 return AVERROR(EINVAL);
286 }
287 if (s->in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s->in_ch_layout)) {
288 av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_count);
289 return AVERROR(EINVAL);
290 }
291
280 if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) {292 if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) {
281 char l1[1024], l2[1024];
282 av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
283 av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
284 av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s "293 av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s "
285 "but there is not enough information to do it\n", l1, l2);294 "but there is not enough information to do it\n", l1, l2);
286 return -1;295 return -1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t