Originally committed as revision 24976 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -103,7 +103,7 @@ OBJS-$(CONFIG_ISS_DEMUXER) += iss.o |
| 103 | 103 |
OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o |
| 104 | 104 |
OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o |
| 105 | 105 |
OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o |
| 106 |
-OBJS-$(CONFIG_M4V_DEMUXER) += raw.o |
|
| 106 |
+OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o raw.o |
|
| 107 | 107 |
OBJS-$(CONFIG_M4V_MUXER) += raw.o |
| 108 | 108 |
OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ |
| 109 | 109 |
riff.o isom.o rmdec.o rm.o |
| 110 | 110 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,62 @@ |
| 0 |
+/* |
|
| 1 |
+ * RAW MPEG-4 video demuxer |
|
| 2 |
+ * Copyright (c) 2006 Thijs Vermeir <thijs.vermeir@barco.com> |
|
| 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 "avformat.h" |
|
| 22 |
+#include "raw.h" |
|
| 23 |
+ |
|
| 24 |
+#define VISUAL_OBJECT_START_CODE 0x000001b5 |
|
| 25 |
+#define VOP_START_CODE 0x000001b6 |
|
| 26 |
+ |
|
| 27 |
+static int mpeg4video_probe(AVProbeData *probe_packet) |
|
| 28 |
+{
|
|
| 29 |
+ uint32_t temp_buffer= -1; |
|
| 30 |
+ int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; |
|
| 31 |
+ int i; |
|
| 32 |
+ |
|
| 33 |
+ for(i=0; i<probe_packet->buf_size; i++){
|
|
| 34 |
+ temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; |
|
| 35 |
+ if ((temp_buffer & 0xffffff00) != 0x100) |
|
| 36 |
+ continue; |
|
| 37 |
+ |
|
| 38 |
+ if (temp_buffer == VOP_START_CODE) VOP++; |
|
| 39 |
+ else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; |
|
| 40 |
+ else if (temp_buffer < 0x120) VO++; |
|
| 41 |
+ else if (temp_buffer < 0x130) VOL++; |
|
| 42 |
+ else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) |
|
| 43 |
+ && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; |
|
| 44 |
+ } |
|
| 45 |
+ |
|
| 46 |
+ if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) |
|
| 47 |
+ return AVPROBE_SCORE_MAX/2; |
|
| 48 |
+ return 0; |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+AVInputFormat m4v_demuxer = {
|
|
| 52 |
+ "m4v", |
|
| 53 |
+ NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
|
|
| 54 |
+ 0, |
|
| 55 |
+ mpeg4video_probe, /** probing for MPEG-4 data */ |
|
| 56 |
+ ff_raw_video_read_header, |
|
| 57 |
+ ff_raw_read_partial_packet, |
|
| 58 |
+ .flags= AVFMT_GENERIC_INDEX, |
|
| 59 |
+ .extensions = "m4v", |
|
| 60 |
+ .value = CODEC_ID_MPEG4, |
|
| 61 |
+}; |
| ... | ... |
@@ -241,35 +241,6 @@ int ff_raw_video_read_header(AVFormatContext *s, |
| 241 | 241 |
} |
| 242 | 242 |
#endif |
| 243 | 243 |
|
| 244 |
-#if CONFIG_M4V_DEMUXER |
|
| 245 |
-#define VISUAL_OBJECT_START_CODE 0x000001b5 |
|
| 246 |
-#define VOP_START_CODE 0x000001b6 |
|
| 247 |
- |
|
| 248 |
-static int mpeg4video_probe(AVProbeData *probe_packet) |
|
| 249 |
-{
|
|
| 250 |
- uint32_t temp_buffer= -1; |
|
| 251 |
- int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; |
|
| 252 |
- int i; |
|
| 253 |
- |
|
| 254 |
- for(i=0; i<probe_packet->buf_size; i++){
|
|
| 255 |
- temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; |
|
| 256 |
- if ((temp_buffer & 0xffffff00) != 0x100) |
|
| 257 |
- continue; |
|
| 258 |
- |
|
| 259 |
- if (temp_buffer == VOP_START_CODE) VOP++; |
|
| 260 |
- else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; |
|
| 261 |
- else if (temp_buffer < 0x120) VO++; |
|
| 262 |
- else if (temp_buffer < 0x130) VOL++; |
|
| 263 |
- else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) |
|
| 264 |
- && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; |
|
| 265 |
- } |
|
| 266 |
- |
|
| 267 |
- if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) |
|
| 268 |
- return AVPROBE_SCORE_MAX/2; |
|
| 269 |
- return 0; |
|
| 270 |
-} |
|
| 271 |
-#endif |
|
| 272 |
- |
|
| 273 | 244 |
#if CONFIG_H264_DEMUXER |
| 274 | 245 |
static int h264_probe(AVProbeData *p) |
| 275 | 246 |
{
|
| ... | ... |
@@ -735,20 +706,6 @@ AVOutputFormat cavsvideo_muxer = {
|
| 735 | 735 |
}; |
| 736 | 736 |
#endif |
| 737 | 737 |
|
| 738 |
-#if CONFIG_M4V_DEMUXER |
|
| 739 |
-AVInputFormat m4v_demuxer = {
|
|
| 740 |
- "m4v", |
|
| 741 |
- NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
|
|
| 742 |
- 0, |
|
| 743 |
- mpeg4video_probe, /** probing for MPEG-4 data */ |
|
| 744 |
- ff_raw_video_read_header, |
|
| 745 |
- ff_raw_read_partial_packet, |
|
| 746 |
- .flags= AVFMT_GENERIC_INDEX, |
|
| 747 |
- .extensions = "m4v", |
|
| 748 |
- .value = CODEC_ID_MPEG4, |
|
| 749 |
-}; |
|
| 750 |
-#endif |
|
| 751 |
- |
|
| 752 | 738 |
#if CONFIG_M4V_MUXER |
| 753 | 739 |
AVOutputFormat m4v_muxer = {
|
| 754 | 740 |
"m4v", |