Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
dd2a4bcf
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd2a4bcf
编写于
2月 25, 2012
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lavf: generic code for exporting attached pictures.
上级
a93b09cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
18 deletion
+44
-18
libavformat/avformat.h
libavformat/avformat.h
+16
-0
libavformat/utils.c
libavformat/utils.c
+28
-18
未找到文件。
libavformat/avformat.h
浏览文件 @
dd2a4bcf
...
...
@@ -530,6 +530,13 @@ typedef struct AVIndexEntry {
#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080
/**< stream for hearing impaired audiences */
#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100
/**< stream for visual impaired audiences */
#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200
/**< stream without voice */
/**
* The stream is stored in the file as an attached picture/"cover art" (e.g.
* APIC frame in ID3v2). The single packet associated with it will be returned
* among the first few packets read from the file unless seeking takes place.
* It can also be accessed at any time in AVStream.attached_pic.
*/
#define AV_DISPOSITION_ATTACHED_PIC 0x0400
/**
* Stream structure.
...
...
@@ -602,6 +609,15 @@ typedef struct AVStream {
*/
AVRational
avg_frame_rate
;
/**
* For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
* will contain the attached picture.
*
* decoding: set by libavformat, must not be modified by the caller.
* encoding: unused
*/
AVPacket
attached_pic
;
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
...
...
libavformat/utils.c
浏览文件 @
dd2a4bcf
...
...
@@ -498,10 +498,27 @@ static int init_input(AVFormatContext *s, const char *filename, AVDictionary **o
return
av_probe_input_buffer
(
s
->
pb
,
&
s
->
iformat
,
filename
,
s
,
0
,
0
);
}
static
AVPacket
*
add_to_pktbuf
(
AVPacketList
**
packet_buffer
,
AVPacket
*
pkt
,
AVPacketList
**
plast_pktl
){
AVPacketList
*
pktl
=
av_mallocz
(
sizeof
(
AVPacketList
));
if
(
!
pktl
)
return
NULL
;
if
(
*
packet_buffer
)
(
*
plast_pktl
)
->
next
=
pktl
;
else
*
packet_buffer
=
pktl
;
/* add the packet in the buffered packet list */
*
plast_pktl
=
pktl
;
pktl
->
pkt
=
*
pkt
;
return
&
pktl
->
pkt
;
}
int
avformat_open_input
(
AVFormatContext
**
ps
,
const
char
*
filename
,
AVInputFormat
*
fmt
,
AVDictionary
**
options
)
{
AVFormatContext
*
s
=
*
ps
;
int
ret
=
0
;
int
i
,
ret
=
0
;
AVDictionary
*
tmp
=
NULL
;
if
(
!
s
&&
!
(
s
=
avformat_alloc_context
()))
...
...
@@ -551,6 +568,14 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
if
((
ret
=
s
->
iformat
->
read_header
(
s
))
<
0
)
goto
fail
;
/* queue attached pictures */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
if
(
s
->
streams
[
i
]
->
disposition
&
AV_DISPOSITION_ATTACHED_PIC
)
{
AVPacket
copy
=
s
->
streams
[
i
]
->
attached_pic
;
copy
.
destruct
=
NULL
;
add_to_pktbuf
(
&
s
->
raw_packet_buffer
,
&
copy
,
&
s
->
raw_packet_buffer_end
);
}
if
(
s
->
pb
&&
!
s
->
data_offset
)
s
->
data_offset
=
avio_tell
(
s
->
pb
);
...
...
@@ -574,23 +599,6 @@ fail:
/*******************************************************/
static
AVPacket
*
add_to_pktbuf
(
AVPacketList
**
packet_buffer
,
AVPacket
*
pkt
,
AVPacketList
**
plast_pktl
){
AVPacketList
*
pktl
=
av_mallocz
(
sizeof
(
AVPacketList
));
if
(
!
pktl
)
return
NULL
;
if
(
*
packet_buffer
)
(
*
plast_pktl
)
->
next
=
pktl
;
else
*
packet_buffer
=
pktl
;
/* add the packet in the buffered packet list */
*
plast_pktl
=
pktl
;
pktl
->
pkt
=
*
pkt
;
return
&
pktl
->
pkt
;
}
int
av_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
int
ret
,
i
;
...
...
@@ -2547,6 +2555,8 @@ void avformat_free_context(AVFormatContext *s)
av_parser_close
(
st
->
parser
);
av_free_packet
(
&
st
->
cur_pkt
);
}
if
(
st
->
attached_pic
.
data
)
av_free_packet
(
&
st
->
attached_pic
);
av_dict_free
(
&
st
->
metadata
);
av_free
(
st
->
index_entries
);
av_free
(
st
->
codec
->
extradata
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录