[FFmpeg-soc] [soc]: r2985 - mxf/mxfenc.c
spyfeng
subversion at mplayerhq.hu
Sat Aug 2 08:13:24 CEST 2008
Author: spyfeng
Date: Sat Aug 2 08:13:24 2008
New Revision: 2985
Log:
malloc mem for st->priv_data before building structural metadata.
remove useless variables.
Modified:
mxf/mxfenc.c
Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c (original)
+++ mxf/mxfenc.c Sat Aug 2 08:13:24 2008
@@ -658,7 +658,6 @@ static int mxf_write_track(AVFormatConte
static int mxf_write_sequence(AVFormatContext *s, KLVPacket *klv, int stream_index)
{
MXFContext *mxf = s->priv_data;
- MXFReferenceContext *refs = &mxf->reference;
ByteIOContext *pb = s->pb;
AVStream *st;
MXFStreamContext *sc;
@@ -698,7 +697,6 @@ static int mxf_write_sequence(AVFormatCo
static int mxf_write_structural_component(AVFormatContext *s, KLVPacket *klv, int stream_index, enum MXFMetadataSetType type)
{
MXFContext *mxf = s->priv_data;
- MXFReferenceContext *refs = &mxf->reference;
ByteIOContext *pb = s->pb;
AVStream *st;
MXFStreamContext *sc;
@@ -883,8 +881,6 @@ static const MXFDescriptorWriteTableEntr
static int mxf_build_structural_metadata(AVFormatContext *s, KLVPacket* klv, enum MXFMetadataSetType type)
{
- AVStream *st;
- MXFStreamContext *sc = NULL;
int i;
const MXFDescriptorWriteTableEntry *desc = NULL;
@@ -896,12 +892,6 @@ static int mxf_build_structural_metadata
}
for (i = 0;i < s->nb_streams; i++) {
- st = s->streams[i];
- sc = av_mallocz(sizeof(MXFStreamContext));
- if (!sc)
- return AVERROR(ENOMEM);
- st->priv_data = sc;
-
if (mxf_write_track(s, klv, i, type) < 0)
return -1;
@@ -928,7 +918,10 @@ static int mxf_build_structural_metadata
static int mxf_write_header_metadata_sets(AVFormatContext *s)
{
+ AVStream *st;
+ MXFStreamContext *sc = NULL;
KLVPacket klv;
+ int i;
memcpy(klv.key, header_metadata_key, 13);
if (mxf_write_preface(s, &klv) < 0)
return -1;
@@ -939,6 +932,14 @@ static int mxf_write_header_metadata_set
if (mxf_write_content_storage(s, &klv) < 0)
return -1;
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ sc = av_mallocz(sizeof(MXFStreamContext));
+ if (!sc)
+ return AVERROR(ENOMEM);
+ st->priv_data = sc;
+ }
+
if (mxf_build_structural_metadata(s, &klv, MaterialPackage) < 0)
return -1;
@@ -949,7 +950,6 @@ static int mxf_write_header_metadata_set
static int mxf_add_essence_container_ul(MXFContext *mxf, const MXFCodecUL *codec_ul)
{
- int i;
mxf->essence_container_uls = av_realloc(mxf->essence_container_uls, (mxf->essence_container_count + 1) * 16);
if (!mxf->essence_container_uls)
return -1;
@@ -1055,7 +1055,6 @@ fail:
static int mux_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index];
MXFStreamContext *sc = st->priv_data;
@@ -1086,7 +1085,6 @@ static int mxf_update_header_partition(A
static int mux_write_footer(AVFormatContext *s)
{
- MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb;
int64_t this_partition = url_ftell(pb);
More information about the FFmpeg-soc
mailing list