[FFmpeg-soc] [soc]: r3312 - in mxf: mxf.h mxfenc.c

spyfeng subversion at mplayerhq.hu
Fri Aug 15 10:02:28 CEST 2008


Author: spyfeng
Date: Fri Aug 15 10:02:28 2008
New Revision: 3312

Log:
add function mxf_write_uuid() to write uids without storing in context and avoiding malloc mem.
this patch modify write preface set uid.
the follow patch will modify writing other metadata set uids.
and, at the finally, will remove mxf_generate_reference() and related strcuts.


Modified:
   mxf/mxf.h
   mxf/mxfenc.c

Modified: mxf/mxf.h
==============================================================================
--- mxf/mxf.h	(original)
+++ mxf/mxf.h	Fri Aug 15 10:02:28 2008
@@ -37,6 +37,7 @@ enum MXFMetadataSetType {
     Descriptor,
     Track,
     CryptoContext,
+    Preface,
 };
 
 typedef struct {

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Fri Aug 15 10:02:28 2008
@@ -77,6 +77,7 @@ typedef struct {
     enum CodecType type;
 } MXFDescriptorWriteTableEntry;
 
+static const uint8_t uuid_base[]            = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
 static const uint8_t umid_base[]            = { 0x06,0x0A,0x2B,0x34,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x00,0x13,0x00,0x00,0x00 };
 
 /**
@@ -212,6 +213,13 @@ static int mxf_generate_reference(AVForm
     return 0;
 }
 
+static void mxf_write_uuid(ByteIOContext *pb, enum CodecID type, int value)
+{
+    put_buffer(pb, uuid_base, 12);
+    put_be16(pb, type);
+    put_be16(pb, value);
+}
+
 static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
 {
     // Determine the best BER size
@@ -321,13 +329,11 @@ static int mxf_write_preface(AVFormatCon
     klv_encode_ber_length(pb, 130 + 16 * mxf->essence_container_count);
 
     // write preface set uid
-    mxf_generate_uuid(s, uid);
     mxf_write_local_tag(pb, 16, 0x3C0A);
-    put_buffer(pb, uid, 16);
-
+    mxf_write_uuid(pb, Preface, 0);
 #ifdef DEBUG
     PRINT_KEY(s, "preface key", klv->key);
-    PRINT_KEY(s, "preface uid", uid);
+    PRINT_KEY(s, "preface uid", pb->buf_ptr - 16);
 #endif
 
     // write create date as unknown



More information about the FFmpeg-soc mailing list