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
30
32 {
33 int max_frames, first_frames = 0,
frames;
34 const uint8_t *buf, *buf2, *end;
36
37 max_frames = 0;
40
41 for(; buf < end; buf++) {
42 if(buf > p->
buf && !(buf[0] == 0x0B && buf[1] == 0x77)
43 && !(buf[0] == 0x77 && buf[1] == 0x0B) )
44 continue;
45 buf2 = buf;
46
48 uint8_t buf3[4096];
49 uint8_t bitstream_id;
52
53 if(!memcmp(buf2, "\x1\x10", 2)) {
54 if (buf2 + 16 > end)
55 break;
56 buf2+=16;
57 }
58 if (buf[0] == 0x77 && buf[1] == 0x0B) {
62 }
65 }else
69 break;
71 break;
72 if (buf[0] == 0x77 && buf[1] == 0x0B) {
77 }
79 break;
80 } else {
82 break;
83 }
84 if (bitstream_id > 10)
87 }
91 }
92 if(
codec_id != expected_codec_id)
return 0;
93 // keep this in sync with mp3 probe, both need to avoid
94 // issues with MPEG-files!
98 else if(max_frames>=1) return 1;
99 else return 0;
100 }
101
102 #if CONFIG_AC3_DEMUXER
104 {
106 }
107
112 .p.extensions = "ac3",
114 .read_probe = ac3_probe,
119 };
120 #endif
121
122 #if CONFIG_EAC3_DEMUXER
124 {
126 }
127
132 .p.extensions = "eac3,ec3",
134 .read_probe = eac3_probe,
139 };
140 #endif