History

swr/auto_matrix: add clean layout function

Michael Niedermayer committed 14 years ago

Commit c8ffab01 parent ebc854e1 file · +9 −1Browse files

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

Unified · Split

libswresample/rematrix.c+9−1
@@ -102,6 +102,11 @@ static int even(int64_t layout){ · 101 unmodified lines
102 return 0;102 return 0;
103}103}
104 104
105static int clean_layout(SwrContext *s, int64_t layout){
106
107 return layout;
108}
109
105static int sane_layout(int64_t layout){110static int sane_layout(int64_t layout){
106 if(!(layout & AV_CH_LAYOUT_SURROUND)) // at least 1 front speaker111 if(!(layout & AV_CH_LAYOUT_SURROUND)) // at least 1 front speaker
107 return 0;112 return 0;
@@ -123,16 +128,19 @@ static int auto_matrix(SwrContext *s) · 15 unmodified lines
123{128{
124 int i, j, out_i;129 int i, j, out_i;
125 double matrix[64][64]={{0}};130 double matrix[64][64]={{0}};
126 int64_t unaccounted, in_ch_layout = s->in_ch_layout, out_ch_layout = s->out_ch_layout;131 int64_t unaccounted, in_ch_layout, out_ch_layout;
127 double maxcoef=0;132 double maxcoef=0;
128 char buf[128];133 char buf[128];
129 const int matrix_encoding = s->matrix_encoding;134 const int matrix_encoding = s->matrix_encoding;
130 135
136 in_ch_layout = clean_layout(s, s->in_ch_layout);
131 if(!sane_layout(in_ch_layout)){137 if(!sane_layout(in_ch_layout)){
132 av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout);138 av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout);
133 av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf);139 av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf);
134 return AVERROR(EINVAL);140 return AVERROR(EINVAL);
135 }141 }
142
143 out_ch_layout = clean_layout(s, s->out_ch_layout);
136 if(!sane_layout(out_ch_layout)){144 if(!sane_layout(out_ch_layout)){
137 av_get_channel_layout_string(buf, sizeof(buf), -1, s->out_ch_layout);145 av_get_channel_layout_string(buf, sizeof(buf), -1, s->out_ch_layout);
138 av_log(s, AV_LOG_ERROR, "Output channel layout '%s' is not supported\n", buf);146 av_log(s, AV_LOG_ERROR, "Output channel layout '%s' is not supported\n", buf);

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