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
7387506b
Commit
7387506b
authored
Aug 05, 2016
by
Chris Moeller
Committed by
Michael Niedermayer
Aug 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: read id3v2 comment tags
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
d950279c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
id3v2.c
libavformat/id3v2.c
+42
-0
No files found.
libavformat/id3v2.c
View file @
7387506b
...
@@ -399,6 +399,45 @@ error:
...
@@ -399,6 +399,45 @@ error:
av_free
(
key
);
av_free
(
key
);
}
}
/**
* Parse a comment tag.
*/
static
void
read_comment
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
int
taglen
,
AVDictionary
**
metadata
)
{
const
char
*
key
=
"comment"
;
uint8_t
*
dst
;
int
encoding
,
dict_flags
=
AV_DICT_DONT_OVERWRITE
|
AV_DICT_DONT_STRDUP_VAL
;
int
language
;
if
(
taglen
<
4
)
return
;
encoding
=
avio_r8
(
pb
);
language
=
avio_rl24
(
pb
);
taglen
-=
4
;
if
(
decode_str
(
s
,
pb
,
encoding
,
&
dst
,
&
taglen
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Error reading comment frame, skipped
\n
"
);
return
;
}
if
(
dst
&&
dst
[
0
])
{
key
=
(
const
char
*
)
dst
;
dict_flags
|=
AV_DICT_DONT_STRDUP_KEY
;
}
if
(
decode_str
(
s
,
pb
,
encoding
,
&
dst
,
&
taglen
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Error reading comment frame, skipped
\n
"
);
if
(
dict_flags
&
AV_DICT_DONT_STRDUP_KEY
)
av_freep
((
void
*
)
&
key
);
return
;
}
if
(
dst
)
av_dict_set
(
metadata
,
key
,
(
const
char
*
)
dst
,
dict_flags
);
}
/**
/**
* Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
* Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
*/
*/
...
@@ -908,6 +947,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
...
@@ -908,6 +947,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
/* check for text tag or supported special meta tag */
/* check for text tag or supported special meta tag */
}
else
if
(
tag
[
0
]
==
'T'
||
}
else
if
(
tag
[
0
]
==
'T'
||
!
memcmp
(
tag
,
"USLT"
,
4
)
||
!
memcmp
(
tag
,
"USLT"
,
4
)
||
!
memcmp
(
tag
,
"COMM"
,
4
)
||
(
extra_meta
&&
(
extra_meta
&&
(
extra_func
=
get_extra_meta_func
(
tag
,
isv34
))))
{
(
extra_func
=
get_extra_meta_func
(
tag
,
isv34
))))
{
pbx
=
pb
;
pbx
=
pb
;
...
@@ -975,6 +1015,8 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
...
@@ -975,6 +1015,8 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
read_ttag
(
s
,
pbx
,
tlen
,
metadata
,
tag
);
read_ttag
(
s
,
pbx
,
tlen
,
metadata
,
tag
);
else
if
(
!
memcmp
(
tag
,
"USLT"
,
4
))
else
if
(
!
memcmp
(
tag
,
"USLT"
,
4
))
read_uslt
(
s
,
pbx
,
tlen
,
metadata
);
read_uslt
(
s
,
pbx
,
tlen
,
metadata
);
else
if
(
!
memcmp
(
tag
,
"COMM"
,
4
))
read_comment
(
s
,
pbx
,
tlen
,
metadata
);
else
else
/* parse special meta tag */
/* parse special meta tag */
extra_func
->
read
(
s
,
pbx
,
tlen
,
tag
,
extra_meta
,
isv34
);
extra_func
->
read
(
s
,
pbx
,
tlen
,
tag
,
extra_meta
,
isv34
);
...
...
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