Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2016/05/16 03:35:14... | ... |
@@ -301,6 +301,7 @@ OBJS-$(CONFIG_MPL2_DEMUXER) += mpl2dec.o subtitles.o |
301 | 301 |
OBJS-$(CONFIG_MSF_DEMUXER) += msf.o |
302 | 302 |
OBJS-$(CONFIG_MPSUB_DEMUXER) += mpsubdec.o subtitles.o |
303 | 303 |
OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o |
304 |
+OBJS-$(CONFIG_MTAF_DEMUXER) += mtaf.o |
|
304 | 305 |
OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o |
305 | 306 |
OBJS-$(CONFIG_MUSX_DEMUXER) += musx.o |
306 | 307 |
OBJS-$(CONFIG_MV_DEMUXER) += mvdec.o |
... | ... |
@@ -209,6 +209,7 @@ void av_register_all(void) |
209 | 209 |
REGISTER_DEMUXER (MPSUB, mpsub); |
210 | 210 |
REGISTER_DEMUXER (MSF, msf); |
211 | 211 |
REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); |
212 |
+ REGISTER_DEMUXER (MTAF, mtaf); |
|
212 | 213 |
REGISTER_DEMUXER (MTV, mtv); |
213 | 214 |
REGISTER_DEMUXER (MUSX, musx); |
214 | 215 |
REGISTER_DEMUXER (MV, mv); |
215 | 216 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,81 @@ |
0 |
+/* |
|
1 |
+ * MTAF demuxer |
|
2 |
+ * Copyright (c) 2016 Paul B Mahol |
|
3 |
+ * |
|
4 |
+ * This file is part of FFmpeg. |
|
5 |
+ * |
|
6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
8 |
+ * License as published by the Free Software Foundation; either |
|
9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
10 |
+ * |
|
11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
+ * Lesser General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+#include "libavutil/channel_layout.h" |
|
22 |
+#include "libavutil/intreadwrite.h" |
|
23 |
+#include "avformat.h" |
|
24 |
+#include "internal.h" |
|
25 |
+ |
|
26 |
+static int mtaf_probe(AVProbeData *p) |
|
27 |
+{ |
|
28 |
+ if (p->buf_size < 0x44) |
|
29 |
+ return 0; |
|
30 |
+ |
|
31 |
+ if (AV_RL32(p->buf) != MKTAG('M','T','A','F') || |
|
32 |
+ AV_RL32(p->buf + 0x40) != MKTAG('H','E','A','D')) |
|
33 |
+ return 0; |
|
34 |
+ |
|
35 |
+ return AVPROBE_SCORE_MAX; |
|
36 |
+} |
|
37 |
+ |
|
38 |
+static int mtaf_read_header(AVFormatContext *s) |
|
39 |
+{ |
|
40 |
+ int stream_count; |
|
41 |
+ AVStream *st; |
|
42 |
+ |
|
43 |
+ st = avformat_new_stream(s, NULL); |
|
44 |
+ if (!st) |
|
45 |
+ return AVERROR(ENOMEM); |
|
46 |
+ |
|
47 |
+ avio_skip(s->pb, 0x5c); |
|
48 |
+ st->duration = avio_rl32(s->pb); |
|
49 |
+ avio_skip(s->pb, 1); |
|
50 |
+ stream_count = avio_r8(s->pb); |
|
51 |
+ if (!stream_count) |
|
52 |
+ return AVERROR_INVALIDDATA; |
|
53 |
+ |
|
54 |
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
|
55 |
+ st->codecpar->codec_id = AV_CODEC_ID_ADPCM_MTAF; |
|
56 |
+ st->codecpar->channels = 2 * stream_count; |
|
57 |
+ st->codecpar->sample_rate = 48000; |
|
58 |
+ st->codecpar->block_align = 0x110 * st->codecpar->channels / 2; |
|
59 |
+ avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); |
|
60 |
+ |
|
61 |
+ avio_seek(s->pb, 0x800, SEEK_SET); |
|
62 |
+ |
|
63 |
+ return 0; |
|
64 |
+} |
|
65 |
+ |
|
66 |
+static int mtaf_read_packet(AVFormatContext *s, AVPacket *pkt) |
|
67 |
+{ |
|
68 |
+ AVCodecParameters *par = s->streams[0]->codecpar; |
|
69 |
+ |
|
70 |
+ return av_get_packet(s->pb, pkt, par->block_align); |
|
71 |
+} |
|
72 |
+ |
|
73 |
+AVInputFormat ff_mtaf_demuxer = { |
|
74 |
+ .name = "mtaf", |
|
75 |
+ .long_name = NULL_IF_CONFIG_SMALL("Konami PS2 MTAF"), |
|
76 |
+ .read_probe = mtaf_probe, |
|
77 |
+ .read_header = mtaf_read_header, |
|
78 |
+ .read_packet = mtaf_read_packet, |
|
79 |
+ .extensions = "mtaf", |
|
80 |
+}; |
... | ... |
@@ -30,7 +30,7 @@ |
30 | 30 |
#include "libavutil/version.h" |
31 | 31 |
|
32 | 32 |
#define LIBAVFORMAT_VERSION_MAJOR 57 |
33 |
-#define LIBAVFORMAT_VERSION_MINOR 36 |
|
33 |
+#define LIBAVFORMAT_VERSION_MINOR 37 |
|
34 | 34 |
#define LIBAVFORMAT_VERSION_MICRO 100 |
35 | 35 |
|
36 | 36 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |