Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
17c88cb0
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,发现更多精彩内容 >>
提交
17c88cb0
编写于
10月 16, 2004
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
user setable preload and max_mux_delay
Originally committed as revision 3602 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
1f631450
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
15 deletion
+25
-15
ffmpeg.c
ffmpeg.c
+12
-0
libavformat/avformat.h
libavformat/avformat.h
+3
-1
libavformat/mpeg.c
libavformat/mpeg.c
+9
-13
tests/libav.regression.ref
tests/libav.regression.ref
+1
-1
未找到文件。
ffmpeg.c
浏览文件 @
17c88cb0
...
...
@@ -205,6 +205,8 @@ static int audio_codec_tag = 0;
static
int
mux_rate
=
0
;
static
int
mux_packet_size
=
0
;
static
float
mux_preload
=
0
.
5
;
static
float
mux_max_delay
=
0
.
7
;
static
int64_t
recording_time
=
0
;
static
int64_t
start_time
=
0
;
...
...
@@ -3328,6 +3330,8 @@ static void opt_output_file(const char *filename)
oc
->
packet_size
=
mux_packet_size
;
oc
->
mux_rate
=
mux_rate
;
oc
->
preload
=
(
int
)(
mux_preload
*
AV_TIME_BASE
);
oc
->
max_delay
=
(
int
)(
mux_max_delay
*
AV_TIME_BASE
);
/* reset some options */
file_oformat
=
NULL
;
...
...
@@ -3692,6 +3696,12 @@ static void opt_target(const char *arg)
mux_packet_size
=
2324
;
mux_rate
=
2352
*
75
*
8
;
/* We have to offset the PTS, so that it is consistent with the SCR.
SCR starts at 36000, but the first two packs contain only padding
and the first pack from the other stream, respectively, may also have
been written before.
So the real data starts at SCR 36000+3*1200. */
mux_preload
=
(
36000
+
3
*
1200
)
/
90000
.
0
;
//0.44
}
else
if
(
!
strcmp
(
arg
,
"svcd"
))
{
opt_video_codec
(
"mpeg2video"
);
...
...
@@ -3916,6 +3926,8 @@ const OptionDef options[] = {
/* muxer options */
{
"muxrate"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_rate
},
"set mux rate"
,
"rate"
},
{
"packetsize"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_packet_size
},
"set packet size"
,
"size"
},
{
"muxdelay"
,
OPT_FLOAT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_max_delay
},
"set the maximum demux-decode delay"
,
"seconds"
},
{
"muxpreload"
,
OPT_FLOAT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_preload
},
"set the initial demux-decode delay"
,
"seconds"
},
{
NULL
,
},
};
...
...
libavformat/avformat.h
浏览文件 @
17c88cb0
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#define LIBAVFORMAT_BUILD 46
19
#define LIBAVFORMAT_BUILD 46
20
#define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVFORMAT_VERSION FFMPEG_VERSION
...
...
@@ -310,6 +310,8 @@ typedef struct AVFormatContext {
int
mux_rate
;
int
packet_size
;
int
preload
;
int
max_delay
;
}
AVFormatContext
;
typedef
struct
AVPacketList
{
...
...
libavformat/mpeg.c
浏览文件 @
17c88cb0
...
...
@@ -19,7 +19,6 @@
#include "avformat.h"
#define MAX_PAYLOAD_SIZE 4096
#define PRELOAD 45000 //0.5sec
//#define DEBUG_SEEK
#undef NDEBUG
...
...
@@ -904,6 +903,7 @@ static int output_packet(AVFormatContext *ctx, int flush){
int
ignore_constraints
=
0
;
int64_t
scr
=
s
->
last_scr
;
PacketDesc
*
timestamp_packet
;
const
int64_t
max_delay
=
av_rescale
(
ctx
->
max_delay
,
90000
,
AV_TIME_BASE
);
retry:
for
(
i
=
0
;
i
<
ctx
->
nb_streams
;
i
++
){
...
...
@@ -912,6 +912,7 @@ retry:
const
int
avail_data
=
fifo_size
(
&
stream
->
fifo
,
stream
->
fifo
.
rptr
);
const
int
space
=
stream
->
max_buffer_size
-
stream
->
buffer_index
;
int
rel_space
=
1024
*
space
/
stream
->
max_buffer_size
;
PacketDesc
*
next_pkt
=
stream
->
premux_packet
;
if
(
s
->
packet_size
>
avail_data
&&
!
flush
)
return
0
;
...
...
@@ -922,6 +923,9 @@ retry:
if
(
space
<
s
->
packet_size
&&
!
ignore_constraints
)
continue
;
if
(
next_pkt
&&
next_pkt
->
dts
-
scr
>
max_delay
)
continue
;
if
(
rel_space
>
best_score
){
best_score
=
rel_space
;
best_i
=
i
;
...
...
@@ -1019,22 +1023,14 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
StreamInfo
*
stream
=
st
->
priv_data
;
int64_t
pts
,
dts
;
PacketDesc
*
pkt_desc
;
const
int
preload
=
av_rescale
(
ctx
->
preload
,
90000
,
AV_TIME_BASE
);
pts
=
pkt
->
pts
;
dts
=
pkt
->
dts
;
if
(
s
->
is_vcd
)
{
/* We have to offset the PTS, so that it is consistent with the SCR.
SCR starts at 36000, but the first two packs contain only padding
and the first pack from the other stream, respectively, may also have
been written before.
So the real data starts at SCR 36000+3*1200. */
if
(
pts
!=
AV_NOPTS_VALUE
)
pts
+=
36000
+
3600
;
if
(
dts
!=
AV_NOPTS_VALUE
)
dts
+=
36000
+
3600
;
}
else
{
if
(
pts
!=
AV_NOPTS_VALUE
)
pts
+=
PRELOAD
;
if
(
dts
!=
AV_NOPTS_VALUE
)
dts
+=
PRELOAD
;
}
if
(
pts
!=
AV_NOPTS_VALUE
)
pts
+=
preload
;
if
(
dts
!=
AV_NOPTS_VALUE
)
dts
+=
preload
;
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
*
stream
->
next_packet
=
pkt_desc
=
av_mallocz
(
sizeof
(
PacketDesc
));
...
...
tests/libav.regression.ref
浏览文件 @
17c88cb0
...
...
@@ -7,7 +7,7 @@ ffmpeg regression test
./data/b-libav.asf CRC=750f18c7
1cbf838e659d7fc3d3e33f4187b91f6c *./data/b-libav.rm
360251 ./data/b-libav.rm
7aeebe6bf43c0c1219e41ce082a47051
*./data/b-libav.mpg
90784a1b9589095f20fc6bcc0cc23cc4
*./data/b-libav.mpg
387072 ./data/b-libav.mpg
./data/b-libav.mpg CRC=16c74225
57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录