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
02a951b9
Commit
02a951b9
authored
Jun 26, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apetag: export attached covers as video streams.
parent
b72767df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
apetag.c
libavformat/apetag.c
+24
-1
No files found.
libavformat/apetag.c
View file @
02a951b9
...
...
@@ -24,6 +24,7 @@
#include "libavutil/dict.h"
#include "avformat.h"
#include "apetag.h"
#include "internal.h"
#define APE_TAG_VERSION 2000
#define APE_TAG_FOOTER_BYTES 32
...
...
@@ -56,6 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s)
return
-
1
;
if
(
flags
&
APE_TAG_FLAG_IS_BINARY
)
{
uint8_t
filename
[
1024
];
enum
CodecID
id
;
AVStream
*
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -65,6 +67,27 @@ static int ape_tag_read_field(AVFormatContext *s)
av_log
(
s
,
AV_LOG_WARNING
,
"Skipping binary tag '%s'.
\n
"
,
key
);
return
0
;
}
av_dict_set
(
&
st
->
metadata
,
key
,
filename
,
0
);
if
((
id
=
ff_guess_image2_codec
(
filename
))
!=
CODEC_ID_NONE
)
{
AVPacket
pkt
;
int
ret
;
ret
=
av_get_packet
(
s
->
pb
,
&
pkt
,
size
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Error reading cover art.
\n
"
);
return
ret
;
}
st
->
disposition
|=
AV_DISPOSITION_ATTACHED_PIC
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
st
->
codec
->
codec_id
=
id
;
st
->
attached_pic
=
pkt
;
st
->
attached_pic
.
stream_index
=
st
->
index
;
st
->
attached_pic
.
flags
|=
AV_PKT_FLAG_KEY
;
}
else
{
st
->
codec
->
extradata
=
av_malloc
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
st
->
codec
->
extradata
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -73,8 +96,8 @@ static int ape_tag_read_field(AVFormatContext *s)
return
AVERROR
(
EIO
);
}
st
->
codec
->
extradata_size
=
size
;
av_dict_set
(
&
st
->
metadata
,
key
,
filename
,
0
);
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_ATTACHMENT
;
}
}
else
{
value
=
av_malloc
(
size
+
1
);
if
(
!
value
)
...
...
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