[FFmpeg-devel] [PATCH 3/9] wtv: move duplicated guids into wtv.c

Peter Ross pross at xvid.org
Tue Nov 6 04:01:42 CET 2012


---
 libavformat/wtv.c    |    6 ++++++
 libavformat/wtv.h    |    3 +++
 libavformat/wtvdec.c |    6 +++---
 libavformat/wtvenc.c |   14 ++++----------
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index 40b755c..5b1e61b 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -32,6 +32,12 @@ const ff_asf_guid ff_data_guid =
     {0x95,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
 const ff_asf_guid ff_SBE2_STREAM_DESC_EVENT =
     {0xED,0xA4,0x13,0x23,0x2D,0xBF,0x4F,0x45,0xAD,0x8A,0xD9,0x5B,0xA7,0xF9,0x1F,0xEE};
+const ff_asf_guid ff_stream1_guid =
+    {0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
+const ff_asf_guid ff_sync_guid =
+    {0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
+const ff_asf_guid ff_index_guid =
+    {0x96,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
 const ff_asf_guid ff_mediatype_audio =
     {'a','u','d','s',FF_MEDIASUBTYPE_BASE_GUID};
 const ff_asf_guid ff_mediatype_video =
diff --git a/libavformat/wtv.h b/libavformat/wtv.h
index 864cc18..efe90d6 100644
--- a/libavformat/wtv.h
+++ b/libavformat/wtv.h
@@ -40,6 +40,9 @@ extern const ff_asf_guid ff_wtv_guid;
 extern const ff_asf_guid ff_timestamp_guid;
 extern const ff_asf_guid ff_data_guid;
 extern const ff_asf_guid ff_SBE2_STREAM_DESC_EVENT;
+extern const ff_asf_guid ff_stream1_guid;
+extern const ff_asf_guid ff_sync_guid;
+extern const ff_asf_guid ff_index_guid;
 extern const ff_asf_guid ff_mediatype_audio;
 extern const ff_asf_guid ff_mediatype_video;
 extern const ff_asf_guid ff_format_none;
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 60b229f..c030ab6 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -879,9 +879,9 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
             !ff_guidcmp(g, (const ff_asf_guid){0x4E,0x7F,0x4C,0x5B,0xC4,0xD0,0x38,0x4B,0xA8,0x3E,0x21,0x7F,0x7B,0xBF,0x52,0xE7}) ||
             !ff_guidcmp(g, (const ff_asf_guid){0x63,0x36,0xEB,0xFE,0xA1,0x7E,0xD9,0x11,0x83,0x08,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) ||
             !ff_guidcmp(g, (const ff_asf_guid){0x70,0xE9,0xF1,0xF8,0x89,0xA4,0x4C,0x4D,0x83,0x73,0xB8,0x12,0xE0,0xD5,0xF8,0x1E}) ||
-            !ff_guidcmp(g, (const ff_asf_guid){0x96,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) ||
-            !ff_guidcmp(g, (const ff_asf_guid){0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) ||
-            !ff_guidcmp(g, (const ff_asf_guid){0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) ||
+            !ff_guidcmp(g, ff_index_guid) ||
+            !ff_guidcmp(g, ff_sync_guid) ||
+            !ff_guidcmp(g, ff_stream1_guid) ||
             !ff_guidcmp(g, (const ff_asf_guid){0xF7,0x10,0x02,0xB9,0xEE,0x7C,0xED,0x4E,0xBD,0x7F,0x05,0x40,0x35,0x86,0x18,0xA1})) {
             //ignore known guids
         } else
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 2629bef..1efa9c6 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -52,12 +52,6 @@ static const uint8_t legacy_attrib[] =
 
 static const ff_asf_guid sub_wtv_guid =
     {0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid stream1_guid =
-    {0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid sync_guid =
-    {0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid index_guid =
-    {0x96,0xc3,0xd2,0xc2,0x7e,0x9a,0xda,0x11,0x8b,0xf7,0x00,0x07,0xe9,0x5e,0xad,0x8d};
 
 enum WtvFileIndex {
     WTV_TIMELINE_TABLE_0_HEADER_EVENTS = 0,
@@ -137,7 +131,7 @@ static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int
     avio_wl32(pb, stream_id);
     avio_wl64(pb, wctx->serial);
 
-    if ((stream_id & 0x80000000) && guid != &index_guid) {
+    if ((stream_id & 0x80000000) && guid != &ff_index_guid) {
         WtvChunkEntry *t = wctx->index + wctx->nb_index;
         av_assert0(wctx->nb_index < MAX_NB_INDEX);
         t->pos       = wctx->last_chunk_pos;
@@ -179,7 +173,7 @@ static void write_index(AVFormatContext *s)
     WtvContext *wctx = s->priv_data;
     int i;
 
-    write_chunk_header2(s, &index_guid, 0x80000000);
+    write_chunk_header2(s, &ff_index_guid, 0x80000000);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
 
@@ -263,7 +257,7 @@ static int write_stream_codec(AVFormatContext *s, AVStream * st)
 {
     AVIOContext *pb = s->pb;
     int ret;
-    write_chunk_header2(s, &stream1_guid, 0x80000000 | 0x01);
+    write_chunk_header2(s, &ff_stream1_guid, 0x80000000 | 0x01);
 
     avio_wl32(pb,  0x01);
     write_pad(pb, 4);
@@ -286,7 +280,7 @@ static void write_sync(AVFormatContext *s)
     int64_t last_chunk_pos = wctx->last_chunk_pos;
     wctx->sync_pos = avio_tell(pb) - wctx->timeline_start_pos;
 
-    write_chunk_header(s, &sync_guid, 0x18, 0);
+    write_chunk_header(s, &ff_sync_guid, 0x18, 0);
     write_pad(pb, 24);
 
     finish_chunk(s);
-- 
1.7.10.4

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121106/54a41446/attachment.asc>


More information about the ffmpeg-devel mailing list