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
c6026e43
Commit
c6026e43
authored
Mar 16, 2009
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix trkn metadata parsing
Originally committed as revision 18001 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
0fb44a4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
mov.c
libavformat/mov.c
+21
-12
No files found.
libavformat/mov.c
View file @
c6026e43
...
...
@@ -79,6 +79,19 @@ typedef struct MOVParseTableEntry {
static
const
MOVParseTableEntry
mov_default_parse_table
[];
static
int
mov_metadata_trkn
(
MOVContext
*
c
,
ByteIOContext
*
pb
,
unsigned
len
)
{
char
buf
[
16
];
get_be16
(
pb
);
// unknown
snprintf
(
buf
,
sizeof
(
buf
),
"%d"
,
get_be16
(
pb
));
av_metadata_set
(
&
c
->
fc
->
metadata
,
"track"
,
buf
);
get_be16
(
pb
);
// total tracks
return
0
;
}
static
int
mov_read_udta_string
(
MOVContext
*
c
,
ByteIOContext
*
pb
,
MOVAtom
atom
)
{
#ifdef MOV_EXPORT_ALL_METADATA
...
...
@@ -87,6 +100,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
char
str
[
1024
],
key2
[
16
],
language
[
4
]
=
{
0
};
const
char
*
key
=
NULL
;
uint16_t
str_size
;
int
(
*
parse
)(
MOVContext
*
,
ByteIOContext
*
,
unsigned
)
=
NULL
;
switch
(
atom
.
type
)
{
case
MKTAG
(
0xa9
,
'n'
,
'a'
,
'm'
):
key
=
"title"
;
break
;
...
...
@@ -101,6 +115,8 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
case
MKTAG
(
0xa9
,
'g'
,
'e'
,
'n'
):
key
=
"genre"
;
break
;
case
MKTAG
(
0xa9
,
't'
,
'o'
,
'o'
):
case
MKTAG
(
0xa9
,
'e'
,
'n'
,
'c'
):
key
=
"muxer"
;
break
;
case
MKTAG
(
't'
,
'r'
,
'k'
,
'n'
):
key
=
"track"
;
parse
=
mov_metadata_trkn
;
break
;
}
if
(
c
->
itunes_metadata
&&
atom
.
size
>
8
)
{
...
...
@@ -132,6 +148,10 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return
-
1
;
str_size
=
FFMIN3
(
sizeof
(
str
)
-
1
,
str_size
,
atom
.
size
);
if
(
parse
)
parse
(
c
,
pb
,
str_size
);
else
{
get_buffer
(
pb
,
str
,
str_size
);
str
[
str_size
]
=
0
;
av_metadata_set
(
&
c
->
fc
->
metadata
,
key
,
str
);
...
...
@@ -139,6 +159,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
snprintf
(
key2
,
sizeof
(
key2
),
"%s-%s"
,
key
,
language
);
av_metadata_set
(
&
c
->
fc
->
metadata
,
key2
,
str
);
}
}
#ifdef DEBUG_METADATA
av_log
(
c
->
fc
,
AV_LOG_DEBUG
,
"lang
\"
%3s
\"
"
,
language
);
av_log
(
c
->
fc
,
AV_LOG_DEBUG
,
"tag
\"
%s
\"
value
\"
%s
\"
atom
\"
%.4s
\"
%d %lld
\n
"
,
...
...
@@ -1428,17 +1449,6 @@ static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return
0
;
}
static
int
mov_read_trkn
(
MOVContext
*
c
,
ByteIOContext
*
pb
,
MOVAtom
atom
)
{
char
track
[
16
];
get_be32
(
pb
);
// type
get_be32
(
pb
);
// unknown
snprintf
(
track
,
sizeof
(
track
),
"%d"
,
get_be32
(
pb
));
av_metadata_set
(
&
c
->
fc
->
metadata
,
"track"
,
track
);
dprintf
(
c
->
fc
,
"%.4s %s
\n
"
,
(
char
*
)
&
atom
.
type
,
track
);
return
0
;
}
static
int
mov_read_tkhd
(
MOVContext
*
c
,
ByteIOContext
*
pb
,
MOVAtom
atom
)
{
int
i
;
...
...
@@ -1790,7 +1800,6 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{
MKTAG
(
't'
,
'r'
,
'a'
,
'k'
),
mov_read_trak
},
{
MKTAG
(
't'
,
'r'
,
'a'
,
'f'
),
mov_read_default
},
{
MKTAG
(
't'
,
'r'
,
'e'
,
'x'
),
mov_read_trex
},
{
MKTAG
(
't'
,
'r'
,
'k'
,
'n'
),
mov_read_trkn
},
{
MKTAG
(
't'
,
'r'
,
'u'
,
'n'
),
mov_read_trun
},
{
MKTAG
(
'u'
,
'd'
,
't'
,
'a'
),
mov_read_default
},
{
MKTAG
(
'w'
,
'a'
,
'v'
,
'e'
),
mov_read_wave
},
...
...
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