Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3b82be9e
Commit
3b82be9e
authored
Sep 21, 2016
by
Mark Reid
Committed by
Michael Niedermayer
Oct 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libavformat/mxfdec: export track name metadata
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
e3196b68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
35 deletions
+44
-35
mxfdec.c
libavformat/mxfdec.c
+44
-35
No files found.
libavformat/mxfdec.c
View file @
3b82be9e
...
...
@@ -155,6 +155,7 @@ typedef struct {
MXFSequence
*
sequence
;
/* mandatory, and only one */
UID
sequence_ref
;
int
track_id
;
char
*
name
;
uint8_t
track_number
[
4
];
AVRational
edit_rate
;
int
intra_only
;
...
...
@@ -328,6 +329,9 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int freectx)
av_freep
(
&
((
MXFTaggedValue
*
)
*
ctx
)
->
name
);
av_freep
(
&
((
MXFTaggedValue
*
)
*
ctx
)
->
value
);
break
;
case
Track
:
av_freep
(
&
((
MXFTrack
*
)
*
ctx
)
->
name
);
break
;
case
IndexTableSegment
:
seg
=
(
MXFIndexTableSegment
*
)
*
ctx
;
av_freep
(
&
seg
->
temporal_offset_entries
);
...
...
@@ -707,6 +711,41 @@ static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
return
0
;
}
static
inline
int
mxf_read_utf16_string
(
AVIOContext
*
pb
,
int
size
,
char
**
str
,
int
be
)
{
int
ret
;
size_t
buf_size
;
if
(
size
<
0
)
return
AVERROR
(
EINVAL
);
buf_size
=
size
+
size
/
2
+
1
;
*
str
=
av_malloc
(
buf_size
);
if
(
!*
str
)
return
AVERROR
(
ENOMEM
);
if
(
be
)
ret
=
avio_get_str16be
(
pb
,
size
,
*
str
,
buf_size
);
else
ret
=
avio_get_str16le
(
pb
,
size
,
*
str
,
buf_size
);
if
(
ret
<
0
)
{
av_freep
(
str
);
return
ret
;
}
return
ret
;
}
#define READ_STR16(type, big_endian) \
static int mxf_read_utf16 ## type ##_string(AVIOContext *pb, int size, char** str) \
{ \
return mxf_read_utf16_string(pb, size, str, big_endian); \
}
READ_STR16
(
be
,
1
)
READ_STR16
(
le
,
0
)
#undef READ_STR16
static
int
mxf_read_content_storage
(
void
*
arg
,
AVIOContext
*
pb
,
int
tag
,
int
size
,
UID
uid
,
int64_t
klv_offset
)
{
MXFContext
*
mxf
=
arg
;
...
...
@@ -780,6 +819,9 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid
case
0x4804
:
avio_read
(
pb
,
track
->
track_number
,
4
);
break
;
case
0x4802
:
mxf_read_utf16be_string
(
pb
,
size
,
&
track
->
name
);
break
;
case
0x4b01
:
track
->
edit_rate
.
num
=
avio_rb32
(
pb
);
track
->
edit_rate
.
den
=
avio_rb32
(
pb
);
...
...
@@ -825,41 +867,6 @@ static int mxf_read_essence_group(void *arg, AVIOContext *pb, int tag, int size,
return
0
;
}
static
inline
int
mxf_read_utf16_string
(
AVIOContext
*
pb
,
int
size
,
char
**
str
,
int
be
)
{
int
ret
;
size_t
buf_size
;
if
(
size
<
0
)
return
AVERROR
(
EINVAL
);
buf_size
=
size
+
size
/
2
+
1
;
*
str
=
av_malloc
(
buf_size
);
if
(
!*
str
)
return
AVERROR
(
ENOMEM
);
if
(
be
)
ret
=
avio_get_str16be
(
pb
,
size
,
*
str
,
buf_size
);
else
ret
=
avio_get_str16le
(
pb
,
size
,
*
str
,
buf_size
);
if
(
ret
<
0
)
{
av_freep
(
str
);
return
ret
;
}
return
ret
;
}
#define READ_STR16(type, big_endian) \
static int mxf_read_utf16 ## type ##_string(AVIOContext *pb, int size, char** str) \
{ \
return mxf_read_utf16_string(pb, size, str, big_endian); \
}
READ_STR16
(
be
,
1
)
READ_STR16
(
le
,
0
)
#undef READ_STR16
static
int
mxf_read_package
(
void
*
arg
,
AVIOContext
*
pb
,
int
tag
,
int
size
,
UID
uid
,
int64_t
klv_offset
)
{
MXFPackage
*
package
=
arg
;
...
...
@@ -2038,6 +2045,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
mxf_add_umid_metadata
(
&
st
->
metadata
,
"file_package_umid"
,
source_package
);
if
(
source_package
->
name
&&
source_package
->
name
[
0
])
av_dict_set
(
&
st
->
metadata
,
"file_package_name"
,
source_package
->
name
,
0
);
if
(
material_track
->
name
&&
material_track
->
name
[
0
])
av_dict_set
(
&
st
->
metadata
,
"track_name"
,
material_track
->
name
,
0
);
mxf_parse_physical_source_package
(
mxf
,
source_track
,
st
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment