Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
b514ed3c
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,发现更多精彩内容 >>
提交
b514ed3c
编写于
2月 07, 2005
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dont kill the buffers while the decoder is using them
Originally committed as revision 3949 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
090fa657
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
0 deletion
+14
-0
ffplay.c
ffplay.c
+14
-0
未找到文件。
ffplay.c
浏览文件 @
b514ed3c
...
...
@@ -144,6 +144,9 @@ typedef struct VideoState {
SDL_mutex
*
pictq_mutex
;
SDL_cond
*
pictq_cond
;
SDL_mutex
*
video_decoder_mutex
;
SDL_mutex
*
audio_decoder_mutex
;
// QETimer *video_timer;
char
filename
[
1024
];
int
width
,
height
,
xleft
,
ytop
;
...
...
@@ -899,9 +902,11 @@ static int video_thread(void *arg)
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
)
pts
=
(
double
)
pkt
->
dts
/
AV_TIME_BASE
;
SDL_LockMutex
(
is
->
video_decoder_mutex
);
len1
=
avcodec_decode_video
(
&
is
->
video_st
->
codec
,
frame
,
&
got_picture
,
pkt
->
data
,
pkt
->
size
);
SDL_UnlockMutex
(
is
->
video_decoder_mutex
);
// if (len1 < 0)
// break;
if
(
got_picture
)
{
...
...
@@ -1026,9 +1031,11 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, double *pts_pt
for
(;;)
{
/* NOTE: the audio packet can contain several frames */
while
(
is
->
audio_pkt_size
>
0
)
{
SDL_LockMutex
(
is
->
audio_decoder_mutex
);
len1
=
avcodec_decode_audio
(
&
is
->
audio_st
->
codec
,
(
int16_t
*
)
audio_buf
,
&
data_size
,
is
->
audio_pkt_data
,
is
->
audio_pkt_size
);
SDL_UnlockMutex
(
is
->
audio_decoder_mutex
);
if
(
len1
<
0
)
{
/* if error, we skip the frame */
is
->
audio_pkt_size
=
0
;
...
...
@@ -1414,7 +1421,9 @@ static int decode_thread(void *arg)
}
if
(
is
->
video_stream
>=
0
)
{
packet_queue_flush
(
&
is
->
videoq
);
SDL_LockMutex
(
is
->
video_decoder_mutex
);
avcodec_flush_buffers
(
&
ic
->
streams
[
video_index
]
->
codec
);
SDL_UnlockMutex
(
is
->
video_decoder_mutex
);
}
}
is
->
seek_req
=
0
;
...
...
@@ -1494,6 +1503,9 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
/* start video display */
is
->
pictq_mutex
=
SDL_CreateMutex
();
is
->
pictq_cond
=
SDL_CreateCond
();
is
->
audio_decoder_mutex
=
SDL_CreateMutex
();
is
->
video_decoder_mutex
=
SDL_CreateMutex
();
/* add the refresh timer to draw the picture */
schedule_refresh
(
is
,
40
);
...
...
@@ -1525,6 +1537,8 @@ static void stream_close(VideoState *is)
}
SDL_DestroyMutex
(
is
->
pictq_mutex
);
SDL_DestroyCond
(
is
->
pictq_cond
);
SDL_DestroyMutex
(
is
->
audio_decoder_mutex
);
SDL_DestroyMutex
(
is
->
video_decoder_mutex
);
}
void
stream_cycle_channel
(
VideoState
*
is
,
int
codec_type
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录