[FFmpeg-devel] [PATCH 4/4] wtvenc: use ff_put_guid and remove local copy of this function

Peter Ross pross at xvid.org
Sat Nov 5 06:09:47 CET 2011


---
 libavformat/Makefile |    2 +-
 libavformat/wtvenc.c |   29 ++++++++++++-----------------
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f786223..f253b4d 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -318,7 +318,7 @@ OBJS-$(CONFIG_WSAUD_DEMUXER)             += westwood.o
 OBJS-$(CONFIG_WSVQA_DEMUXER)             += westwood.o
 OBJS-$(CONFIG_WTV_DEMUXER)               += wtvdec.o wtv.o asfdec.o asf.o asfcrypt.o \
                                             avlanguage.o mpegts.o isom.o riff.o
-OBJS-$(CONFIG_WTV_MUXER)                 += wtvenc.o wtv.o asf.o riff.o
+OBJS-$(CONFIG_WTV_MUXER)                 += wtvenc.o wtv.o asf.o asfenc.o riff.o
 OBJS-$(CONFIG_WV_DEMUXER)                += wv.o apetag.o
 OBJS-$(CONFIG_XA_DEMUXER)                += xa.o
 OBJS-$(CONFIG_XBIN_DEMUXER)              += bintext.o sauce.o
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 48de580..887ee72 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -30,6 +30,7 @@
 #include "avformat.h"
 #include "internal.h"
 #include "wtv.h"
+#include "asf.h"
 
 #define WTV_BIGSECTOR_SIZE (1 << WTV_BIGSECTOR_BITS)
 #define INDEX_BASE 0x2
@@ -112,12 +113,6 @@ static int write_pad(AVIOContext *pb, int size)
     return 0;
 }
 
-static void put_guid(AVIOContext *s, const ff_asf_guid *g)
-{
-    assert(sizeof(*g) == 16);
-    avio_write(s, *g, sizeof(*g));
- }
-
 static const ff_asf_guid *get_codec_guid(enum CodecID id, const AVCodecGuid *av_guid)
 {
     int i;
@@ -137,7 +132,7 @@ static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int
     AVIOContext *pb = s->pb;
 
     wctx->last_chunk_pos = avio_tell(pb) - wctx->timeline_start_pos;
-    put_guid(pb, guid);
+    ff_put_guid(pb, guid);
     avio_wl32(pb, 32 + length);
     avio_wl32(pb, stream_id);
     avio_wl64(pb, wctx->serial);
@@ -190,7 +185,7 @@ static void write_index(AVFormatContext *s)
 
     for (i = 0; i < wctx->nb_index; i++) {
         WtvChunkEntry *t = wctx->index + i;
-        put_guid(pb,  t->guid);
+        ff_put_guid(pb,  t->guid);
         avio_wl64(pb, t->pos);
         avio_wl32(pb, t->stream_id);
         avio_wl32(pb, 0); // checksum?
@@ -234,10 +229,10 @@ static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
         return -1;
     }
 
-    put_guid(pb, media_type); // mediatype
-    put_guid(pb, &ff_mediasubtype_cpfilters_processed); // subtype
+    ff_put_guid(pb, media_type); // mediatype
+    ff_put_guid(pb, &ff_mediasubtype_cpfilters_processed); // subtype
     write_pad(pb, 12);
-    put_guid(pb,&ff_format_cpfilters_processed); // format type
+    ff_put_guid(pb,&ff_format_cpfilters_processed); // format type
     avio_wl32(pb, 0); // size
 
     hdr_pos_start = avio_tell(pb);
@@ -258,8 +253,8 @@ static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
     avio_seek(pb, -(hdr_size + 4), SEEK_CUR);
     avio_wl32(pb, hdr_size + 32);
     avio_seek(pb, hdr_size, SEEK_CUR);
-    put_guid(pb, g);           // actual_subtype
-    put_guid(pb, format_type); // actual_formattype
+    ff_put_guid(pb, g);           // actual_subtype
+    ff_put_guid(pb, format_type); // actual_formattype
 
     return 0;
 }
@@ -344,8 +339,8 @@ static int write_header(AVFormatContext *s)
     int i, pad, ret;
     AVStream *st;
 
-    put_guid(pb, &ff_wtv_guid);
-    put_guid(pb, &sub_wtv_guid);
+    ff_put_guid(pb, &ff_wtv_guid);
+    ff_put_guid(pb, &sub_wtv_guid);
 
     avio_wl32(pb, 0x01);
     avio_wl32(pb, 0x02);
@@ -498,7 +493,7 @@ static int write_root_table(AVFormatContext *s, int64_t sector_pos)
         int len = 0;
         int64_t len_pos;
 
-        put_guid(pb, &ff_dir_entry_guid);
+        ff_put_guid(pb, &ff_dir_entry_guid);
         len_pos = avio_tell(pb);
         avio_wl16(pb, 40 + h->header_size + filename_padding + 8); // maybe updated later
         write_pad(pb, 6);
@@ -572,7 +567,7 @@ static void write_table_entries_events(AVFormatContext *s)
 
 static void write_tag(AVIOContext *pb, const char *key, const char *value)
 {
-    put_guid(pb, &ff_metadata_guid);
+    ff_put_guid(pb, &ff_metadata_guid);
     avio_wl32(pb, 1);
     avio_wl32(pb, strlen(value)*2 + 2);
     avio_put_str16le(pb, key);
-- 
1.7.7.1

-- 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/20111105/ddf68a9a/attachment.asc>


More information about the ffmpeg-devel mailing list