Revision 9d9b9d32 libavcodec/dca.c

View differences:

libavcodec/dca.c
66 66
 * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
67 67
 * S  -> back, when both rear and back are configured move one of them to the side channel
68 68
 * OV -> center back
69
 * All 2 channel configurations -> CHANNEL_LAYOUT_STEREO
69
 * All 2 channel configurations -> CH_LAYOUT_STEREO
70 70
 */
71 71

  
72 72
static const int64_t dca_core_channel_layout[] = {
73
    CHANNEL_FRONT_CENTER,                                               ///< 1, A
74
    CHANNEL_LAYOUT_STEREO,                                              ///< 2, A + B (dual mono)
75
    CHANNEL_LAYOUT_STEREO,                                              ///< 2, L + R (stereo)
76
    CHANNEL_LAYOUT_STEREO,                                              ///< 2, (L+R) + (L-R) (sum-difference)
77
    CHANNEL_LAYOUT_STEREO,                                              ///< 2, LT +RT (left and right total)
78
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER,                         ///< 3, C+L+R
79
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_CENTER,                          ///< 3, L+R+S
80
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER,     ///< 4, C + L + R+ S
81
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT,         ///< 4, L + R+ SL+SR
82
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT,                                       ///< 5, C + L + R+ SL+SR
83
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
84
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER,                   ///< 6, C + L + R+ LR + RR + OV
85
    CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_BACK_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT,  ///< 6, CF+ CR+LF+ RF+LR + RR
86
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
87
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
88
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_CENTER|CHANNEL_BACK_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
73
    CH_FRONT_CENTER,                                               ///< 1, A
74
    CH_LAYOUT_STEREO,                                              ///< 2, A + B (dual mono)
75
    CH_LAYOUT_STEREO,                                              ///< 2, L + R (stereo)
76
    CH_LAYOUT_STEREO,                                              ///< 2, (L+R) + (L-R) (sum-difference)
77
    CH_LAYOUT_STEREO,                                              ///< 2, LT +RT (left and right total)
78
    CH_LAYOUT_STEREO|CH_FRONT_CENTER,                         ///< 3, C+L+R
79
    CH_LAYOUT_STEREO|CH_BACK_CENTER,                          ///< 3, L+R+S
80
    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_CENTER,     ///< 4, C + L + R+ S
81
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT,         ///< 4, L + R+ SL+SR
82
    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT,                                       ///< 5, C + L + R+ SL+SR
83
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
84
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER,                   ///< 6, C + L + R+ LR + RR + OV
85
    CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_BACK_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT,  ///< 6, CF+ CR+LF+ RF+LR + RR
86
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
87
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
88
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
89 89

  
90 90
    /* The following entries adds the LFE layouts, this way we can reuse the table for the AVCodec channel_layouts member*/
91
    CHANNEL_FRONT_CENTER|CHANNEL_LOW_FREQUENCY,
92
    CHANNEL_LAYOUT_STEREO|CHANNEL_LOW_FREQUENCY,
93
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_LOW_FREQUENCY,
94
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
95
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
96
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
97
    CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
98
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LOW_FREQUENCY,
99
    CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
100
    CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_BACK_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
101
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
102
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
103
    CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_CENTER|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
91
    CH_FRONT_CENTER|CH_LOW_FREQUENCY,
92
    CH_LAYOUT_STEREO|CH_LOW_FREQUENCY,
93
    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_LOW_FREQUENCY,
94
    CH_LAYOUT_STEREO|CH_BACK_CENTER|CH_LOW_FREQUENCY,
95
    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_CENTER|CH_LOW_FREQUENCY,
96
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
97
    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
98
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LOW_FREQUENCY,
99
    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER|CH_LOW_FREQUENCY,
100
    CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_BACK_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
101
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
102
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
103
    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
104 104
    0,
105 105
};
106 106

  
......
1211 1211
    if(avctx->request_channels == 2 && s->prim_channels > 2) {
1212 1212
        channels = 2;
1213 1213
        s->output = DCA_STEREO;
1214
        avctx->channel_layout = CHANNEL_LAYOUT_STEREO;
1214
        avctx->channel_layout = CH_LAYOUT_STEREO;
1215 1215
    }
1216 1216
    if (s->amode<16)
1217 1217
        avctx->channel_layout = dca_core_channel_layout[s->amode];
1218 1218

  
1219
    if (s->lfe) avctx->channel_layout |= CHANNEL_LOW_FREQUENCY;
1219
    if (s->lfe) avctx->channel_layout |= CH_LOW_FREQUENCY;
1220 1220

  
1221 1221
    /* There is nothing that prevents a dts frame to change channel configuration
1222 1222
       but FFmpeg doesn't support that so only set the channels if it is previously

Also available in: Unified diff