[FFmpeg-cvslog] WTV:move the common variable used by wtvdec.c and wtvenc. c to a new file wtv.h and wtv.c.

zhentan feng git at videolan.org
Sun May 1 21:33:29 CEST 2011


ffmpeg | branch: master | zhentan feng <spyfeng at gmail.com> | Sun May  1 21:12:02 2011 +0200| [5ab826c165916a301ee748ee5a1d68cf788d5d2f] | committer: Michael Niedermayer

WTV:move the common variable used by wtvdec.c and wtvenc.c to a new file wtv.h and wtv.c.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ab826c165916a301ee748ee5a1d68cf788d5d2f
---

 libavformat/Makefile |    2 +-
 libavformat/wtv.c    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 libavformat/wtv.h    |   41 +++++++++++++++++++++++++++++++++++++++++
 libavformat/wtvdec.c |   29 +----------------------------
 4 files changed, 88 insertions(+), 29 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e92b299..a1a48b3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -299,7 +299,7 @@ OBJS-$(CONFIG_WEBM_MUXER)                += matroskaenc.o matroska.o \
                                             flacenc_header.o avlanguage.o
 OBJS-$(CONFIG_WSAUD_DEMUXER)             += westwood.o
 OBJS-$(CONFIG_WSVQA_DEMUXER)             += westwood.o
-OBJS-$(CONFIG_WTV_DEMUXER)               += wtvdec.o asf.o asfdec.o mpegts.o riff.o
+OBJS-$(CONFIG_WTV_DEMUXER)               += wtvdec.o wtv.o asf.o asfdec.o mpegts.o riff.o
 OBJS-$(CONFIG_WV_DEMUXER)                += wv.o apetag.o
 OBJS-$(CONFIG_XA_DEMUXER)                += xa.o
 OBJS-$(CONFIG_XWMA_DEMUXER)              += xwma.o riff.o
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
new file mode 100644
index 0000000..071546a
--- /dev/null
+++ b/libavformat/wtv.c
@@ -0,0 +1,45 @@
+/*
+ * Windows Television (WTV)
+ * Copyright (c) 2010-2011 Peter Ross <pross at xvid.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "wtv.h"
+
+/* WTV GUIDs*/
+const ff_asf_guid dir_entry_guid =
+    {0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D};
+const ff_asf_guid wtv_guid =
+    {0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
+const ff_asf_guid timestamp_guid =
+    {0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97};
+const ff_asf_guid data_guid =
+    {0x95,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
+const ff_asf_guid stream_guid =
+    {0xED,0xA4,0x13,0x23,0x2D,0xBF,0x4F,0x45,0xAD,0x8A,0xD9,0x5B,0xA7,0xF9,0x1F,0xEE};
+const ff_asf_guid mediatype_audio =
+    {'a','u','d','s',FF_MEDIASUBTYPE_BASE_GUID};
+const ff_asf_guid mediatype_video =
+    {'v','i','d','s',FF_MEDIASUBTYPE_BASE_GUID};
+const ff_asf_guid format_none =
+    {0xD6,0x17,0x64,0x0F,0x18,0xC3,0xD0,0x11,0xA4,0x3F,0x00,0xA0,0xC9,0x22,0x31,0x96};
+
+const AVCodecGuid video_guids[] = {
+    {CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
+    {CODEC_ID_NONE}
+};
diff --git a/libavformat/wtv.h b/libavformat/wtv.h
new file mode 100644
index 0000000..52c17b4
--- /dev/null
+++ b/libavformat/wtv.h
@@ -0,0 +1,41 @@
+/*
+ * Windows Television (WTV)
+ * Copyright (c) 2010-2011 Peter Ross <pross at xvid.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_WTV_H
+#define AVFORMAT_WTV_H
+
+#include "riff.h"
+#include "asf.h"
+
+#define WTV_SECTOR_BITS    12
+#define WTV_SECTOR_SIZE    (1 << WTV_SECTOR_BITS)
+#define WTV_BIGSECTOR_BITS 18
+
+extern const ff_asf_guid dir_entry_guid;
+extern const ff_asf_guid wtv_guid;
+extern const ff_asf_guid timestamp_guid;
+extern const ff_asf_guid data_guid;
+extern const ff_asf_guid stream_guid;
+extern const ff_asf_guid mediatype_audio;
+extern const ff_asf_guid mediatype_video;
+extern const ff_asf_guid format_none;
+extern const AVCodecGuid video_guids[];
+#endif /* AVFORMAT_WTV_H */
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 795ea39..f2f76db 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -29,8 +29,7 @@
 #include "libavutil/intfloat_readwrite.h"
 #include "avformat.h"
 #include "internal.h"
-#include "riff.h"
-#include "asf.h"
+#include "wtv.h"
 #include "mpegts.h"
 #include <strings.h>
 
@@ -47,10 +46,6 @@
  *
  */
 
-#define WTV_SECTOR_BITS    12
-#define WTV_SECTOR_SIZE    (1 << WTV_SECTOR_BITS)
-#define WTV_BIGSECTOR_BITS 18
-
 typedef struct {
     AVIOContext *pb_filesystem;  /** file system (AVFormatContext->pb) */
 
@@ -241,9 +236,6 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
     return pb;
 }
 
-static const ff_asf_guid dir_entry_guid =
-    {0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D};
-
 /**
  * Open file using filename
  * @param[in]  buf       directory buffer
@@ -324,16 +316,8 @@ typedef struct {
 } WtvContext;
 
 /* WTV GUIDs */
-static const ff_asf_guid wtv_guid =
-    {0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
 static const ff_asf_guid metadata_guid =
     {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53};
-static const ff_asf_guid timestamp_guid =
-    {0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97};
-static const ff_asf_guid data_guid =
-    {0x95,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid stream_guid =
-    {0xED,0xA4,0x13,0x23,0x2D,0xBF,0x4F,0x45,0xAD,0x8A,0xD9,0x5B,0xA7,0xF9,0x1F,0xEE};
 static const ff_asf_guid stream2_guid =
     {0xA2,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
 static const ff_asf_guid EVENTID_SubtitleSpanningEvent =
@@ -358,10 +342,6 @@ static const ff_asf_guid EVENTID_AudioTypeSpanningEvent =
 /* Windows media GUIDs */
 
 /* Media types */
-static const ff_asf_guid mediatype_audio =
-    {'a','u','d','s',FF_MEDIASUBTYPE_BASE_GUID};
-static const ff_asf_guid mediatype_video =
-    {'v','i','d','s',FF_MEDIASUBTYPE_BASE_GUID};
 static const ff_asf_guid mediasubtype_mpeg1payload =
     {0x81,0xEB,0x36,0xE4,0x4F,0x52,0xCE,0x11,0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70};
 static const ff_asf_guid mediatype_mpeg2_sections =
@@ -392,13 +372,6 @@ static const ff_asf_guid format_videoinfo2 =
     {0xA0,0x76,0x2A,0xF7,0x0A,0xEB,0xD0,0x11,0xAC,0xE4,0x00,0x00,0xC0,0xCC,0x16,0xBA};
 static const ff_asf_guid format_mpeg2_video =
     {0xE3,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA};
-static const ff_asf_guid format_none =
-    {0xD6,0x17,0x64,0x0F,0x18,0xC3,0xD0,0x11,0xA4,0x3F,0x00,0xA0,0xC9,0x22,0x31,0x96};
-
-static const AVCodecGuid video_guids[] = {
-    {CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
-    {CODEC_ID_NONE}
-};
 
 static int read_probe(AVProbeData *p)
 {



More information about the ffmpeg-cvslog mailing list