Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
2c8d4388
Commit
2c8d4388
authored
16 years ago
by
Zhentan Feng
Committed by
Carl Eugen Hoyos
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ok-ed parts from patch by zhentan feng.
Originally committed as revision 14839 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
6f18fe8c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/mxfenc.c
+71
-2
71 additions, 2 deletions
libavformat/mxfenc.c
with
71 additions
and
2 deletions
libavformat/mxfenc.c
+
71
−
2
View file @
2c8d4388
...
...
@@ -38,6 +38,16 @@ typedef struct {
UID
uid
;
}
MXFLocalTagPair
;
typedef
struct
{
UID
track_essence_element_key
;
}
MXFStreamContext
;
typedef
struct
MXFContext
{
int64_t
header_byte_count
;
int64_t
header_byte_count_offset
;
int64_t
header_footer_partition_offset
;
int
essence_container_count
;
}
MXFContext
;
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
};
...
...
@@ -56,6 +66,11 @@ static void mxf_write_uuid(ByteIOContext *pb, enum CodecID type, int value)
put_be16
(
pb
,
value
);
}
static
void
mxf_write_umid
(
ByteIOContext
*
pb
,
enum
CodecID
type
,
int
value
)
{
put_buffer
(
pb
,
umid_base
,
16
);
mxf_write_uuid
(
pb
,
type
,
value
);
}
static
int
klv_encode_ber_length
(
ByteIOContext
*
pb
,
uint64_t
len
)
{
// Determine the best BER size
...
...
@@ -114,9 +129,14 @@ static void mxf_write_local_tag(ByteIOContext *pb, int value_size, int tag)
put_be16
(
pb
,
value_size
);
}
static
void
mxf_write_metadata_key
(
ByteIOContext
*
pb
,
unsigned
int
value
)
{
put_buffer
(
pb
,
header_metadata_key
,
13
);
put_be24
(
pb
,
value
);
}
static
void
mxf_free
(
AVFormatContext
*
s
)
{
MXFContext
*
mxf
=
s
->
priv_data
;
AVStream
*
st
;
int
i
;
...
...
@@ -124,7 +144,6 @@ static void mxf_free(AVFormatContext *s)
st
=
s
->
streams
[
i
];
av_freep
(
&
st
->
priv_data
);
}
av_freep
(
&
mxf
->
essence_container_uls
);
}
static
const
MXFDataDefinitionUL
*
mxf_get_data_definition_ul
(
enum
CodecType
type
)
...
...
@@ -152,6 +171,56 @@ static int mux_write_packet(AVFormatContext *s, AVPacket *pkt)
return
0
;
}
static
int
mxf_write_header_metadata_sets
(
AVFormatContext
*
s
)
{
AVStream
*
st
;
MXFStreamContext
*
sc
=
NULL
;
int
i
;
if
(
mxf_write_preface
(
s
)
<
0
)
return
-
1
;
if
(
mxf_write_identification
(
s
)
<
0
)
return
-
1
;
if
(
mxf_write_content_storage
(
s
)
<
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
;
// set pts information
if
(
st
->
codec
->
codec_type
==
CODEC_TYPE_VIDEO
)
{
av_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
time_base
.
den
);
}
else
if
(
st
->
codec
->
codec_type
==
CODEC_TYPE_AUDIO
)
{
av_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
}
}
if
(
mxf_build_structural_metadata
(
s
,
MaterialPackage
)
<
0
)
return
-
1
;
if
(
mxf_build_structural_metadata
(
s
,
SourcePackage
)
<
0
)
return
-
1
;
return
0
;
}
static
int
mxf_update_header_partition
(
AVFormatContext
*
s
,
int64_t
footer_partition_offset
)
{
MXFContext
*
mxf
=
s
->
priv_data
;
ByteIOContext
*
pb
=
s
->
pb
;
url_fseek
(
pb
,
mxf
->
header_byte_count_offset
,
SEEK_SET
);
put_be64
(
pb
,
mxf
->
header_byte_count
);
put_flush_packet
(
pb
);
url_fseek
(
pb
,
mxf
->
header_footer_partition_offset
,
SEEK_SET
);
put_be64
(
pb
,
footer_partition_offset
);
put_flush_packet
(
pb
);
return
0
;
}
AVOutputFormat
mxf_muxer
=
{
"mxf"
,
NULL_IF_CONFIG_SMALL
(
"Material eXchange Format"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment