Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
30bc6613
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,发现更多精彩内容 >>
提交
30bc6613
编写于
8月 15, 2005
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support fixing missing pts by parsing future frames
Originally committed as revision 4526 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
af9da83b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
74 addition
and
11 deletion
+74
-11
ffmpeg.c
ffmpeg.c
+5
-0
ffplay.c
ffplay.c
+6
-0
libavformat/avformat.h
libavformat/avformat.h
+4
-2
libavformat/utils.c
libavformat/utils.c
+59
-9
未找到文件。
ffmpeg.c
浏览文件 @
30bc6613
...
...
@@ -211,6 +211,7 @@ static int frame_skip_cmp= FF_CMP_DCTMAX;
extern
int
loop_input
;
/* currently a hack */
static
int
loop_output
=
AVFMT_NOOUTPUTLOOP
;
static
int
gray_only
=
0
;
static
int
genpts
=
0
;
static
int
gop_size
=
12
;
static
int
intra_only
=
0
;
...
...
@@ -3031,6 +3032,9 @@ static void opt_input_file(const char *filename)
print_error
(
filename
,
err
);
exit
(
1
);
}
if
(
genpts
)
ic
->
flags
|=
AVFMT_FLAG_GENPTS
;
/* If not enough info to get the stream parameters, we decode the
first frames to get it. (used in mpeg case for example) */
...
...
@@ -4340,6 +4344,7 @@ const OptionDef options[] = {
{
"skip_cmp"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
|
OPT_VIDEO
,
{(
void
*
)
&
frame_skip_cmp
},
"frame skip compare function"
,
"compare function"
},
{
"gray"
,
OPT_BOOL
|
OPT_EXPERT
|
OPT_VIDEO
,
{
(
void
*
)
&
gray_only
},
"encode/decode grayscale"
},
{
"newvideo"
,
OPT_VIDEO
,
{(
void
*
)
opt_new_video_stream
},
"add a new video stream to the current output stream"
},
{
"genpts"
,
OPT_BOOL
|
OPT_EXPERT
|
OPT_VIDEO
,
{
(
void
*
)
&
genpts
},
"generate pts"
},
/* audio options */
{
"ab"
,
HAS_ARG
|
OPT_AUDIO
,
{(
void
*
)
opt_audio_bitrate
},
"set audio bitrate (in kbit/s)"
,
"bitrate"
,
},
...
...
ffplay.c
浏览文件 @
30bc6613
...
...
@@ -210,6 +210,7 @@ static int step = 0;
static
int
thread_count
=
1
;
static
int
workaround_bugs
=
1
;
static
int
fast
=
0
;
static
int
genpts
=
0
;
static
int
lowres
=
0
;
static
int
idct
=
FF_IDCT_AUTO
;
static
enum
AVDiscard
skip_frame
=
AVDISCARD_DEFAULT
;
...
...
@@ -1802,6 +1803,10 @@ static int decode_thread(void *arg)
#else
use_play
=
0
;
#endif
if
(
genpts
)
ic
->
flags
|=
AVFMT_FLAG_GENPTS
;
if
(
!
use_play
)
{
err
=
av_find_stream_info
(
ic
);
if
(
err
<
0
)
{
...
...
@@ -2356,6 +2361,7 @@ const OptionDef options[] = {
{
"bug"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
workaround_bugs
},
"workaround bugs"
,
""
},
{
"vismv"
,
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
opt_vismv
},
"visualize motion vectors"
,
""
},
{
"fast"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
fast
},
"non spec compliant optimizations"
,
""
},
{
"genpts"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
genpts
},
"generate pts"
,
""
},
{
"lowres"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
lowres
},
""
,
""
},
{
"skiploop"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
skip_loop_filter
},
""
,
""
},
{
"skipframe"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
skip_frame
},
""
,
""
},
...
...
libavformat/avformat.h
浏览文件 @
30bc6613
...
...
@@ -5,8 +5,8 @@
extern
"C"
{
#endif
#define LIBAVFORMAT_VERSION_INT ((49<<16)+(
0
<<8)+0)
#define LIBAVFORMAT_VERSION 49.
0
.0
#define LIBAVFORMAT_VERSION_INT ((49<<16)+(
1
<<8)+0)
#define LIBAVFORMAT_VERSION 49.
1
.0
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
...
...
@@ -332,6 +332,8 @@ typedef struct AVFormatContext {
/* number of times to loop output in formats that support it */
int
loop_output
;
int
flags
;
#define AVFMT_FLAG_GENPTS 0x0001 ///< generate pts if missing even if it requires parsing future frames
}
AVFormatContext
;
typedef
struct
AVPacketList
{
...
...
libavformat/utils.c
浏览文件 @
30bc6613
...
...
@@ -955,16 +955,66 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
int
av_read_frame
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
AVPacketList
*
pktl
;
int
eof
=
0
;
const
int
genpts
=
s
->
flags
&
AVFMT_FLAG_GENPTS
;
pktl
=
s
->
packet_buffer
;
if
(
pktl
)
{
/* read packet from packet buffer, if there is data */
*
pkt
=
pktl
->
pkt
;
s
->
packet_buffer
=
pktl
->
next
;
av_free
(
pktl
);
return
0
;
}
else
{
return
av_read_frame_internal
(
s
,
pkt
);
for
(;;){
pktl
=
s
->
packet_buffer
;
if
(
pktl
)
{
AVPacket
*
next_pkt
=
&
pktl
->
pkt
;
AVStream
*
st
=
s
->
streams
[
next_pkt
->
stream_index
];
if
(
genpts
&&
next_pkt
->
dts
!=
AV_NOPTS_VALUE
){
while
(
pktl
&&
next_pkt
->
pts
==
AV_NOPTS_VALUE
){
if
(
pktl
->
pkt
.
stream_index
==
next_pkt
->
stream_index
&&
next_pkt
->
dts
<
pktl
->
pkt
.
dts
&&
pktl
->
pkt
.
pts
!=
pktl
->
pkt
.
dts
//not b frame
/*&& pktl->pkt.dts != AV_NOPTS_VALUE*/
){
next_pkt
->
pts
=
pktl
->
pkt
.
dts
;
}
pktl
=
pktl
->
next
;
}
pktl
=
s
->
packet_buffer
;
}
if
(
next_pkt
->
pts
!=
AV_NOPTS_VALUE
||
next_pkt
->
dts
==
AV_NOPTS_VALUE
||
!
genpts
||
eof
){
/* read packet from packet buffer, if there is data */
*
pkt
=
*
next_pkt
;
s
->
packet_buffer
=
pktl
->
next
;
av_free
(
pktl
);
return
0
;
}
}
if
(
genpts
){
AVPacketList
**
plast_pktl
=
&
s
->
packet_buffer
;
int
ret
=
av_read_frame_internal
(
s
,
pkt
);
if
(
ret
<
0
){
if
(
pktl
&&
ret
!=
-
EAGAIN
){
eof
=
1
;
continue
;
}
else
return
ret
;
}
/* duplicate the packet */
if
(
av_dup_packet
(
pkt
)
<
0
)
return
AVERROR_NOMEM
;
while
(
*
plast_pktl
)
plast_pktl
=
&
(
*
plast_pktl
)
->
next
;
//FIXME maybe maintain pointer to the last?
pktl
=
av_mallocz
(
sizeof
(
AVPacketList
));
if
(
!
pktl
)
return
AVERROR_NOMEM
;
/* add the packet in the buffered packet list */
*
plast_pktl
=
pktl
;
pktl
->
pkt
=
*
pkt
;
}
else
{
assert
(
!
s
->
packet_buffer
);
return
av_read_frame_internal
(
s
,
pkt
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录