1 /*
2 * RAW AC-3 and E-AC-3 demuxer
3 * Copyright (c) 2007 Justin Ruggles <justin.ruggles@gmail.com>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
26
28 {
29 int max_frames, first_frames = 0, frames;
34
35 max_frames = 0;
38
39 for(; buf <
end; buf++) {
40 if(buf > p->
buf && !(buf[0] == 0x0B && buf[1] == 0x77)
41 && !(buf[0] == 0x77 && buf[1] == 0x0B) )
42 continue;
44
45 for(frames = 0; buf2 <
end; frames++) {
47 int i;
48 if(!memcmp(buf2, "\x1\x100円0円0円0円0円0円", 8))
49 buf2+=16;
50 if (buf[0] == 0x77 && buf[1] == 0x0B) {
51 for(i=0; i<8; i+=2) {
52 buf3[i ] = buf[i+1];
53 buf3[i+1] = buf[i ];
54 }
56 }else
59 break;
61 break;
62 if (buf[0] == 0x77 && buf[1] == 0x0B) {
65 buf3[i ] = buf[i+1];
66 buf3[i+1] = buf[i ];
67 }
68 }
70 break;
74 }
75 max_frames =
FFMAX(max_frames, frames);
77 first_frames = frames;
78 }
79 if(codec_id != expected_codec_id) return 0;
80 // keep this in sync with mp3 probe, both need to avoid
81 // issues with MPEG-files!
85 else if(max_frames>=1) return 1;
86 else return 0;
87 }
88
89 #if CONFIG_AC3_DEMUXER
91 {
93 }
94
98 .read_probe = ac3_probe,
102 .extensions = "ac3",
104 };
105 #endif
106
107 #if CONFIG_EAC3_DEMUXER
109 {
111 }
112
116 .read_probe = eac3_probe,
120 .extensions = "eac3",
122 };
123 #endif