Switch to unified view

a/mpd2src/flacencoder.cpp b/mpd2src/flacencoder.cpp
...
...
97
        unsigned samples = samples_left > SAMPLES_BUF_SIZE ? SAMPLES_BUF_SIZE
97
        unsigned samples = samples_left > SAMPLES_BUF_SIZE ? SAMPLES_BUF_SIZE
98
                                                           : samples_left;
98
                                                           : samples_left;
99
99
100
        // convert the packed little-endian 16-bit PCM samples into an
100
        // convert the packed little-endian 16-bit PCM samples into an
101
        // interleaved FLAC__int32 buffer for libFLAC
101
        // interleaved FLAC__int32 buffer for libFLAC
102
        //
103
        // NOTE: we assume 44:16:2 + needswap, which is not correct,
104
        // we should use the parameters from audioReader. Works for
105
        // now because scmakempdsender configures mpd to perform the
106
        // conversion.
102
        for (unsigned i = 0; i < samples; i++) {
107
        for (unsigned i = 0; i < samples; i++) {
103
            // inefficient but simple and works on big- or little-endian
108
            // inefficient but simple and works on big- or little-endian
104
            // machines.
109
            // machines.
105
            m_samplesBuf[i] = (FLAC__int32)
110
            m_samplesBuf[i] = (FLAC__int32)
106
                            (((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8)
111
                (((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8)
107
                            | (FLAC__int16)buffer[2*i]);
112
                 | (FLAC__int16)buffer[2*i]);
108
        }
113
        }
109
114
110
        // feed samples to encoder
115
        // feed samples to encoder
111
        if (!FLAC__stream_encoder_process_interleaved(m_encoder, m_samplesBuf,
116
        if (!FLAC__stream_encoder_process_interleaved(m_encoder, m_samplesBuf,
112
                                                      samples / 2)) {
117
                                                      samples / 2)) {