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
22 #include "config_components.h"
23
29
31 {
32 int max_frames, first_frames = 0,
frames;
33 const uint8_t *buf, *buf2, *end;
35
36 max_frames = 0;
39
40 for(; buf < end; buf++) {
41 if(buf > p->
buf && !(buf[0] == 0x0B && buf[1] == 0x77)
42 && !(buf[0] == 0x77 && buf[1] == 0x0B) )
43 continue;
44 buf2 = buf;
45
47 uint8_t buf3[4096];
48 uint8_t bitstream_id;
51
52 if(!memcmp(buf2, "\x1\x10", 2)) {
53 if (buf2 + 16 > end)
54 break;
55 buf2+=16;
56 }
57 if (buf[0] == 0x77 && buf[1] == 0x0B) {
61 }
64 }else
68 break;
70 break;
71 if (buf[0] == 0x77 && buf[1] == 0x0B) {
76 }
78 break;
79 } else {
81 break;
82 }
83 if (bitstream_id > 10)
86 }
90 }
91 if(
codec_id != expected_codec_id)
return 0;
92 // keep this in sync with mp3 probe, both need to avoid
93 // issues with MPEG-files!
97 else if(max_frames>=1) return 1;
98 else return 0;
99 }
100
101 #if CONFIG_AC3_DEMUXER
103 {
105 }
106
110 .read_probe = ac3_probe,
114 .extensions = "ac3",
118 };
119 #endif
120
121 #if CONFIG_EAC3_DEMUXER
123 {
125 }
126
130 .read_probe = eac3_probe,
134 .extensions = "eac3",
138 };
139 #endif