~ubuntu-branches/ubuntu/precise/libav/precise-updates

« back to all changes in this revision

Viewing changes to libavcodec/resample.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:30:00 UTC
  • mfrom: (1.2.8) (1.1.13 experimental)
  • Revision ID: package-import@ubuntu.com-20120112223000-cmfo7w78q13i2fd9
Tags: 4:0.8~beta2-1ubuntu1
* Merge from debian, remaining changes:
  - don't build against libdirac, lame, libopenjpeg, librtmp, 
    x264, and xvid  (all in universe)

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
               MAX_CHANNELS);
163
163
        return NULL;
164
164
    }
165
 
    if (output_channels > 2 &&
166
 
        !(output_channels == 6 && input_channels == 2) &&
167
 
        output_channels != input_channels) {
 
165
    if (output_channels != input_channels &&
 
166
        (input_channels  > 2 ||
 
167
         output_channels > 2 &&
 
168
         !(output_channels == 6 && input_channels == 2))) {
168
169
        av_log(NULL, AV_LOG_ERROR,
169
170
               "Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n");
170
171
        return NULL;
187
188
 
188
189
    s->sample_fmt[0]  = sample_fmt_in;
189
190
    s->sample_fmt[1]  = sample_fmt_out;
190
 
    s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3;
191
 
    s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3;
 
191
    s->sample_size[0] = av_get_bytes_per_sample(s->sample_fmt[0]);
 
192
    s->sample_size[1] = av_get_bytes_per_sample(s->sample_fmt[1]);
192
193
 
193
194
    if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
194
195
        if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
213
214
        }
214
215
    }
215
216
 
216
 
#define TAPS 16
217
217
    s->resample_context = av_resample_init(output_rate, input_rate,
218
218
                                           filter_length, log2_phase_count,
219
219
                                           linear, cutoff);