1 /*
2 * MLP and TrueHD demuxer
3 * Copyright (c) 2001 Fabrice Bellard
4 * Copyright (c) 2005 Alex Beregszaszi
5 * Copyright (c) 2015 Carl Eugen Hoyos
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #include "config_components.h"
25
33
35 {
36 const uint8_t *buf, *last_buf = p->
buf, *end = p->
buf + p->
buf_size;
37 int valid = 0,
size = 0;
38 int nsubframes = 0;
39
40 for (buf = p->
buf; buf + 8 <= end; buf++) {
42 if (last_buf +
size == buf) {
43 valid += 1 + nsubframes / 8;
44 }
45 nsubframes = 0;
46 last_buf = buf;
48 }
else if (buf - last_buf ==
size) {
49 nsubframes++;
51 }
52 }
53 if (valid >= 100)
55 return 0;
56 }
57
59 {
61
64
69
75 break;
78 break;
79 }
80
83 }
84
87 }
88
89 return 0;
90 }
91
92 #if CONFIG_MLP_DEMUXER
94 {
96 }
97
101 .read_probe = mlp_probe,
105 .extensions = "mlp",
109 };
110 #endif
111
112 #if CONFIG_TRUEHD_DEMUXER
114 {
116 }
117
121 .read_probe = thd_probe,
125 .extensions = "thd",
129 };
130 #endif