1 /*
2 * SMPTE 302M decoder
3 * Copyright (c) 2008 Laurent Aimar <fenrir@videolan.org>
4 * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
28
29 #define AES3_HEADER_LEN 4
30
32 int buf_size)
33 {
34 uint32_t h;
36
40 }
41
42 /*
43 * AES3 header :
44 * size: 16
45 * number channels 2
46 * channel_id 8
47 * bits per samples 2
48 * alignments 4
49 */
50
52 frame_size = (h >> 16) & 0xffff;
53 channels = ((h >> 14) & 0x0003) * 2 + 2;
54 bits = ((h >> 4) & 0x0003) * 4 + 16;
55
59 }
60
61 /* Set output properties */
63 if (bits > 16)
65 else
67
69 switch(channels) {
70 case 2:
72 break;
73 case 4:
75 break;
76 case 6:
78 break;
79 case 8:
81 }
84 32 * (48000 / (buf_size * 8 /
87
89 }
90
93 {
96 int buf_size = avpkt->
size;
98
100 if (frame_size < 0)
102
105
106 /* get output buffer */
111
113
115 uint32_t *o = (uint32_t *)frame->
data[0];
116 for (; buf_size > 6; buf_size -= 7) {
124 buf += 7;
125 }
127 uint32_t *o = (uint32_t *)frame->
data[0];
128 for (; buf_size > 5; buf_size -= 6) {
135 buf += 6;
136 }
137 } else {
138 uint16_t *o = (uint16_t *)frame->
data[0];
139 for (; buf_size > 4; buf_size -= 5) {
145 buf += 5;
146 }
147 }
148
149 *got_frame_ptr = 1;
150
152 }
153
161 };