summaryrefslogtreecommitdiffstats
path: root/ffmpeg/build/ffmpeg-r23349_webm_fix.diff
blob: 55c1d05e7f431ccceee8988d1883a191f656585c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
diff -uarN ffmpeg-r23349.orig/Changelog ffmpeg-r23349/Changelog
--- ffmpeg-r23349.orig/Changelog	2010-05-27 21:42:32.000000000 +0200
+++ ffmpeg-r23349/Changelog	2010-05-27 22:07:07.000000000 +0200
@@ -4,10 +4,10 @@
 
 version <next>:
 
-- WebM support in Matroska demuxer
+- WebM support in Matroska muxer and demuxer
 - low overhead Ogg muxing
 - MMS-TCP support
-- VP8 decoding via libvpx
+- VP8 decoding/encoding via libvpx
 - CODEC_CAP_EXPERIMENTAL added
 
 
diff -uarN ffmpeg-r23349.orig/configure ffmpeg-r23349/configure
--- ffmpeg-r23349.orig/configure	2010-05-27 21:42:32.000000000 +0200
+++ ffmpeg-r23349/configure	2010-05-27 22:13:29.000000000 +0200
@@ -1352,6 +1352,7 @@
 libtheora_encoder_deps="libtheora"
 libvorbis_encoder_deps="libvorbis"
 libvpx_decoder_deps="libvpx"
+libvpx_encoder_deps="libvpx"
 libx264_encoder_deps="libx264"
 libxvid_encoder_deps="libxvid"
 
@@ -2621,7 +2622,8 @@
 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
-enabled libvpx     && require2 libvpx "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver" -lvpx
+enabled libvpx     && require2 libvpx "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver" -lvpx &&
+                      require2 libvpx "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver" -lvpx
 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
                       { check_cpp_condition x264.h "X264_BUILD >= 90" ||
                         die "ERROR: libx264 version must be >= 0.90."; }
diff -uarN ffmpeg-r23349.orig/libavcodec/Makefile ffmpeg-r23349/libavcodec/Makefile
--- ffmpeg-r23349.orig/libavcodec/Makefile	2010-05-27 21:42:32.000000000 +0200
+++ ffmpeg-r23349/libavcodec/Makefile	2010-05-27 21:50:46.000000000 +0200
@@ -538,6 +538,7 @@
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)          += libvorbis.o
 OBJS-$(CONFIG_LIBVPX_DECODER)             += libvpxdec.o
+OBJS-$(CONFIG_LIBVPX_ENCODER)             += libvpxenc.o
 OBJS-$(CONFIG_LIBX264_ENCODER)            += libx264.o
 OBJS-$(CONFIG_LIBXVID_ENCODER)            += libxvidff.o libxvid_rc.o
 
diff -uarN ffmpeg-r23349.orig/libavformat/matroskadec.c ffmpeg-r23349/libavformat/matroskadec.c
--- ffmpeg-r23349.orig/libavformat/matroskadec.c	2010-05-27 21:42:32.000000000 +0200
+++ ffmpeg-r23349/libavformat/matroskadec.c	2010-05-27 22:05:06.000000000 +0200
@@ -825,10 +825,8 @@
 }
 
 
-/*
- * Autodetecting...
- */
-static int matroska_probe(AVProbeData *p)
+static int ebml_probe(AVProbeData *p, const char probe_data[], const int probe
+_data_size)
 {
     uint64_t total = 0;
     int len_mask = 0x80, size = 1, n = 1, i;
@@ -868,6 +866,24 @@
     return AVPROBE_SCORE_MAX/2;
 }
 
+/*
+ * Autodetecting...
+ */
+#if CONFIG_MATROSKA_DEMUXER
+static int matroska_probe(AVProbeData *p)
+{
+    static const char probe_data[] = "matroska";
+    return ebml_probe(p, probe_data, sizeof(probe_data));
+}
+#endif
+#if CONFIG_WEBM_DEMUXER
+static int webm_probe(AVProbeData *p)
+{
+    static const char probe_data[] = "webm";
+    return ebml_probe(p, probe_data, sizeof(probe_data));
+}
+#endif
+
 static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska,
                                                  int num)
 {
diff -uarN ffmpeg-r23349.orig/libavformat/matroskaenc.c ffmpeg-r23349/libavformat/matroskaenc.c
--- ffmpeg-r23349.orig/libavformat/matroskaenc.c	2010-05-27 21:42:32.000000000 +0200
+++ ffmpeg-r23349/libavformat/matroskaenc.c	2010-05-27 21:54:37.000000000 +0200
@@ -585,9 +585,17 @@
 
         switch (codec->codec_type) {
             case AVMEDIA_TYPE_VIDEO:
+#if CONFIG_WEBM_MUXER
+                if (codec->codec_id != CODEC_ID_VP8 &&
+                    !strcmp("webm", s->oformat->name)) {
+                    av_log(s, AV_LOG_INFO, "WebM only supports VP8 video.\n");
+                    return -1;
+                }
+#endif
                 put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
                 put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, av_q2d(codec->time_base)*1E9);
 
+#if CONFIG_MATROSKA_MUXER
                 if (!native_id &&
                       ff_codec_get_tag(codec_movvideo_tags, codec->codec_id) &&
                     (!ff_codec_get_tag(ff_codec_bmp_tags,   codec->codec_id)