[FFmpeg-soc] [soc]: r662 - matroska/matroskaenc.c

Aurelien Jacobs aurel at gnuage.org
Fri Aug 10 03:35:56 CEST 2007


On Fri, 10 Aug 2007 01:37:20 +0200 (CEST)
conrad <subversion at mplayerhq.hu> wrote:

> Author: conrad
> Date: Fri Aug 10 01:37:19 2007
> New Revision: 662
> 
> Log:
> Use a MD5 hash of some frames to write the segment uid
> 
> 
> Modified:
>    matroska/matroskaenc.c
> 
> Modified: matroska/matroskaenc.c
> ==============================================================================
> --- matroska/matroskaenc.c	(original)
> +++ matroska/matroskaenc.c	Fri Aug 10 01:37:19 2007
> @@ -61,6 +63,8 @@ typedef struct MatroskaMuxContext {
>      mkv_seekhead    *main_seekhead;
>      mkv_seekhead    *cluster_seekhead;
>      mkv_cues        *cues;
> +
> +    struct AVMD5    *md5_ctx;
>  } MatroskaMuxContext;
>  
>  static void put_ebml_id(ByteIOContext *pb, unsigned int id)
> @@ -547,6 +551,9 @@ static int mkv_write_header(AVFormatCont
>      ByteIOContext *pb = &s->pb;
>      offset_t ebml_header, segment_info;
>  
> +    mkv->md5_ctx = av_mallocz(av_md5_size);
> +    av_md5_init(mkv->md5_ctx);
> +
>      ebml_header = start_ebml_master(pb, EBML_ID_HEADER);
>      put_ebml_uint   (pb, EBML_ID_EBMLVERSION        ,           1);
> 
> [...]
> 
>      end_ebml_master(pb, mkv->segment);
> +    av_free(mkv->md5_ctx);
>      return 0;
>  }

Here, using a pointer along with av_malloc/av_free seems pointless.
You should probably put the struct AVMD5 directly into
MatroskaMuxContext (instead of a pointer), and remove the
av_malloc/av_free.

Aurel



More information about the FFmpeg-soc mailing list