[FFmpeg-soc] [soc]: r3456 - mxf/mxfenc.c
spyfeng
subversion at mplayerhq.hu
Tue Aug 19 16:58:28 CEST 2008
Author: spyfeng
Date: Tue Aug 19 16:58:28 2008
New Revision: 3456
Log:
extract common code from mxf_write_sequence() and mxf_write_structural_componment() into mxf_write_common_fields()
Modified:
mxf/mxfenc.c
Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c (original)
+++ mxf/mxfenc.c Tue Aug 19 16:58:28 2008
@@ -532,11 +532,24 @@ static int mxf_write_track(AVFormatConte
return 0;
}
+static void mxf_write_common_fields( ByteIOContext *pb, AVStream *st)
+{
+ const MXFDataDefinitionUL * data_def_ul;
+
+ // find data define uls
+ data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type);
+ mxf_write_local_tag(pb, 16, 0x0201);
+ put_buffer(pb, data_def_ul->uid, 16);
+
+ // write duration
+ mxf_write_local_tag(pb, 8, 0x0202);
+ put_be64(pb, st->duration);
+}
+
static int mxf_write_sequence(AVFormatContext *s, int stream_index, enum MXFMetadataSetType type)
{
ByteIOContext *pb = s->pb;
AVStream *st;
- const MXFDataDefinitionUL * data_def_ul;
mxf_write_metadata_key(pb, 0x010f00);
#ifdef DEBUG
@@ -552,13 +565,7 @@ static int mxf_write_sequence(AVFormatCo
#ifdef DEBUG
PRINT_KEY(s, "sequence uid", pb->buf_ptr - 16);
#endif
- // find data define uls
- data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type);
- mxf_write_local_tag(pb, 16, 0x0201);
- put_buffer(pb, data_def_ul->uid, 16);
-
- mxf_write_local_tag(pb, 8, 0x0202);
- put_be64(pb, st->duration);
+ mxf_write_common_fields(pb, st);
// write structural component
mxf_write_local_tag(pb, 16 + 8, 0x1001);
@@ -571,7 +578,6 @@ static int mxf_write_structural_componen
{
ByteIOContext *pb = s->pb;
AVStream *st;
- const MXFDataDefinitionUL * data_def_ul;
int i;
mxf_write_metadata_key(pb, 0x011100);
@@ -589,18 +595,12 @@ static int mxf_write_structural_componen
#ifdef DEBUG
PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16);
#endif
- data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type);
- mxf_write_local_tag(pb, 16, 0x0201);
- put_buffer(pb, data_def_ul->uid, 16);
+ mxf_write_common_fields(pb, st);
// write start_position
mxf_write_local_tag(pb, 8, 0x1201);
put_be64(pb, 0);
- // write duration
- mxf_write_local_tag(pb, 8, 0x0202);
- put_be64(pb, st->duration);
-
mxf_write_local_tag(pb, 32, 0x1101);
if (type == SourcePackage) {
// write source package uid, end of the reference
More information about the FFmpeg-soc
mailing list