Originally committed as revision 23357 to svn://svn.ffmpeg.org/ffmpeg/trunk
David Conrad authored on 2010/05/28 06:23:04... | ... |
@@ -109,6 +109,8 @@ library: |
109 | 109 |
@tab Format used in various Interplay computer games. |
110 | 110 |
@item IV8 @tab @tab X |
111 | 111 |
@tab A format generated by IndigoVision 8000 video server. |
112 |
+@item IVF (On2) @tab @tab X |
|
113 |
+ @tab A format used by libvpx |
|
112 | 114 |
@item LMLM4 @tab @tab X |
113 | 115 |
@tab Used by Linux Media Labs MPEG-4 PCI boards |
114 | 116 |
@item Matroska @tab X @tab X |
... | ... |
@@ -99,6 +99,7 @@ OBJS-$(CONFIG_INGENIENT_DEMUXER) += raw.o |
99 | 99 |
OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o |
100 | 100 |
OBJS-$(CONFIG_ISS_DEMUXER) += iss.o |
101 | 101 |
OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o |
102 |
+OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o |
|
102 | 103 |
OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o |
103 | 104 |
OBJS-$(CONFIG_M4V_DEMUXER) += raw.o |
104 | 105 |
OBJS-$(CONFIG_M4V_MUXER) += raw.o |
... | ... |
@@ -105,6 +105,7 @@ void av_register_all(void) |
105 | 105 |
REGISTER_MUXER (IPOD, ipod); |
106 | 106 |
REGISTER_DEMUXER (ISS, iss); |
107 | 107 |
REGISTER_DEMUXER (IV8, iv8); |
108 |
+ REGISTER_DEMUXER (IVF, ivf); |
|
108 | 109 |
REGISTER_DEMUXER (LMLM4, lmlm4); |
109 | 110 |
REGISTER_MUXDEMUX (M4V, m4v); |
110 | 111 |
REGISTER_MUXER (MD5, md5); |
... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
#define AVFORMAT_AVFORMAT_H |
23 | 23 |
|
24 | 24 |
#define LIBAVFORMAT_VERSION_MAJOR 52 |
25 |
-#define LIBAVFORMAT_VERSION_MINOR 66 |
|
25 |
+#define LIBAVFORMAT_VERSION_MINOR 67 |
|
26 | 26 |
#define LIBAVFORMAT_VERSION_MICRO 0 |
27 | 27 |
|
28 | 28 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
29 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,91 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2010 David Conrad |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "avformat.h" |
|
21 |
+#include "riff.h" |
|
22 |
+#include "libavutil/intreadwrite.h" |
|
23 |
+ |
|
24 |
+static int probe(AVProbeData *p) |
|
25 |
+{ |
|
26 |
+ if (AV_RL32(p->buf) == MKTAG('D','K','I','F') |
|
27 |
+ && !AV_RL16(p->buf+4) && AV_RL16(p->buf+6) == 32) |
|
28 |
+ return AVPROBE_SCORE_MAX-2; |
|
29 |
+ |
|
30 |
+ return 0; |
|
31 |
+} |
|
32 |
+ |
|
33 |
+static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
|
34 |
+{ |
|
35 |
+ AVStream *st; |
|
36 |
+ AVRational time_base; |
|
37 |
+ |
|
38 |
+ get_le32(s->pb); // DKIF |
|
39 |
+ get_le16(s->pb); // version |
|
40 |
+ get_le16(s->pb); // header size |
|
41 |
+ |
|
42 |
+ st = av_new_stream(s, 0); |
|
43 |
+ if (!st) |
|
44 |
+ return AVERROR(ENOMEM); |
|
45 |
+ |
|
46 |
+ |
|
47 |
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
|
48 |
+ st->codec->codec_tag = get_le32(s->pb); |
|
49 |
+ st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag); |
|
50 |
+ st->codec->width = get_le16(s->pb); |
|
51 |
+ st->codec->height = get_le16(s->pb); |
|
52 |
+ time_base.den = get_le32(s->pb); |
|
53 |
+ time_base.num = get_le32(s->pb); |
|
54 |
+ st->duration = get_le64(s->pb); |
|
55 |
+ |
|
56 |
+ st->need_parsing = AVSTREAM_PARSE_HEADERS; |
|
57 |
+ |
|
58 |
+ if (!time_base.den || !time_base.num) { |
|
59 |
+ av_log(s, AV_LOG_ERROR, "Invalid frame rate\n"); |
|
60 |
+ return AVERROR_INVALIDDATA; |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ av_set_pts_info(st, 64, time_base.num, time_base.den); |
|
64 |
+ |
|
65 |
+ return 0; |
|
66 |
+} |
|
67 |
+ |
|
68 |
+static int read_packet(AVFormatContext *s, AVPacket *pkt) |
|
69 |
+{ |
|
70 |
+ int ret, size = get_le32(s->pb); |
|
71 |
+ int64_t pts = get_le64(s->pb); |
|
72 |
+ |
|
73 |
+ ret = av_get_packet(s->pb, pkt, size); |
|
74 |
+ pkt->stream_index = 0; |
|
75 |
+ pkt->pts = pts; |
|
76 |
+ pkt->pos -= 12; |
|
77 |
+ |
|
78 |
+ return ret; |
|
79 |
+} |
|
80 |
+ |
|
81 |
+AVInputFormat ivf_demuxer = { |
|
82 |
+ "ivf", |
|
83 |
+ NULL_IF_CONFIG_SMALL("On2 IVF"), |
|
84 |
+ 0, |
|
85 |
+ probe, |
|
86 |
+ read_header, |
|
87 |
+ read_packet, |
|
88 |
+ .flags= AVFMT_GENERIC_INDEX, |
|
89 |
+ .codec_tag = (const AVCodecTag*[]){ff_codec_bmp_tags, 0}, |
|
90 |
+}; |