[FFmpeg-soc] [soc]: r2815 - mxf/mxfenc.c

spyfeng subversion at mplayerhq.hu
Fri Jul 18 17:09:25 CEST 2008


Author: spyfeng
Date: Fri Jul 18 17:09:25 2008
New Revision: 2815

Log:
add memory free for MXFContext strcut and rename  the function to mxf_free();


Modified:
   mxf/mxfenc.c

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Fri Jul 18 17:09:25 2008
@@ -164,7 +164,7 @@ typedef struct MXFContext {
     int64_t header_footer_partition_offset;
     AVRandomState random_state;
     MXFReferenceContext *reference;
-    char track_number_sign[sizeof(mxf_essence_element_key)];
+    char *track_number_sign;
     UID *track_essence_element_key;
 } MXFContext;
 
@@ -289,7 +289,7 @@ static int utf8len(const uint8_t *b){
     return len;
 }
 
-static void mxf_free_refs(AVFormatContext *s)
+static void mxf_free(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
     int i;
@@ -304,6 +304,8 @@ static void mxf_free_refs(AVFormatContex
     }
     av_freep(&mxf->reference->sequence);
     av_freep(&mxf->reference->structural_component);
+    av_freep(&mxf->track_essence_element_key);
+    av_freep(&mxf->track_number_sign);
 }
 
 static const MXFDataDefinitionUL *mxf_get_data_definition_ul(const MXFDataDefinitionUL *uls, enum CodecType type)
@@ -501,6 +503,11 @@ static int mxf_write_package(AVFormatCon
     if (set_ref->structural_component)
         return -1;
 
+    //malloc memory for track number sign
+    mxf->track_number_sign = av_mallocz(sizeof(mxf_essence_element_key)/sizeof(MXFEssenceElementKey));
+    if (!mxf->track_number_sign)
+        return -1;
+
     //malloc memory for essence element key of each track
     mxf->track_essence_element_key = av_mallocz(s->nb_streams * sizeof(UID));
     if (!mxf->track_essence_element_key)
@@ -839,7 +846,7 @@ static int mux_write_footer(AVFormatCont
     put_flush_packet(pb);
 
     mxf_update_header_partition(s, this_partition);
-    mxf_free_refs(s);
+    mxf_free(s);
     return 0;
 }
 



More information about the FFmpeg-soc mailing list