Revision 2309923c libavcodec/aac.c

View differences:

libavcodec/aac.c
190 190

  
191 191
        avctx->channel_layout = aac_channel_layout[channel_config - 1];
192 192
    } else {
193
    /* Allocate or free elements depending on if they are in the
194
     * current program configuration.
195
     *
196
     * Set up default 1:1 output mapping.
197
     *
198
     * For a 5.1 stream the output order will be:
199
     *    [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ]
200
     */
193
        /* Allocate or free elements depending on if they are in the
194
         * current program configuration.
195
         *
196
         * Set up default 1:1 output mapping.
197
         *
198
         * For a 5.1 stream the output order will be:
199
         *    [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ]
200
         */
201 201

  
202
    for (i = 0; i < MAX_ELEM_ID; i++) {
203
        for (type = 0; type < 4; type++) {
204
            if (che_pos[type][i]) {
205
                if (!ac->che[type][i] && !(ac->che[type][i] = av_mallocz(sizeof(ChannelElement))))
206
                    return AVERROR(ENOMEM);
207
                if (type != TYPE_CCE) {
208
                    ac->output_data[channels++] = ac->che[type][i]->ch[0].ret;
209
                    if (type == TYPE_CPE) {
210
                        ac->output_data[channels++] = ac->che[type][i]->ch[1].ret;
202
        for (i = 0; i < MAX_ELEM_ID; i++) {
203
            for (type = 0; type < 4; type++) {
204
                if (che_pos[type][i]) {
205
                    if (!ac->che[type][i] && !(ac->che[type][i] = av_mallocz(sizeof(ChannelElement))))
206
                        return AVERROR(ENOMEM);
207
                    if (type != TYPE_CCE) {
208
                        ac->output_data[channels++] = ac->che[type][i]->ch[0].ret;
209
                        if (type == TYPE_CPE) {
210
                            ac->output_data[channels++] = ac->che[type][i]->ch[1].ret;
211
                        }
211 212
                    }
212
                }
213
            } else
214
                av_freep(&ac->che[type][i]);
213
                } else
214
                    av_freep(&ac->che[type][i]);
215
            }
215 216
        }
216
    }
217 217

  
218 218
        memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
219 219
        ac->tags_mapped = 4 * MAX_ELEM_ID;

Also available in: Unified diff