Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
b84f2a35
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,发现更多精彩内容 >>
提交
b84f2a35
编写于
12月 16, 2003
作者:
F
Fabrice Bellard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pts and dts support in parser API
Originally committed as revision 2619 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
ac3d5cac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
6 deletion
+50
-6
libavcodec/avcodec.h
libavcodec/avcodec.h
+15
-4
libavcodec/parser.c
libavcodec/parser.c
+35
-2
未找到文件。
libavcodec/avcodec.h
浏览文件 @
b84f2a35
...
...
@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000408
#define FFMPEG_VERSION "0.4.8"
#define LIBAVCODEC_BUILD 469
6
#define LIBAVCODEC_BUILD 469
7
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION
...
...
@@ -1932,8 +1932,18 @@ typedef struct AVCodecParserContext {
/* video info */
int
pict_type
;
/* XXX: put it back in AVCodecContext */
int
repeat_pict
;
/* XXX: put it back in AVCodecContext */
int64_t
pts
;
/* in us, if given by the codec (used by raw mpeg4) */
int64_t
dts
;
/* in us, if given by the codec (used by raw mpeg4) */
int64_t
pts
;
/* pts of the current frame */
int64_t
dts
;
/* dts of the current frame */
/* private data */
int64_t
last_pts
;
int64_t
last_dts
;
#define AV_PARSER_PTS_NB 4
int
cur_frame_start_index
;
int64_t
cur_frame_offset
[
AV_PARSER_PTS_NB
];
int64_t
cur_frame_pts
[
AV_PARSER_PTS_NB
];
int64_t
cur_frame_dts
[
AV_PARSER_PTS_NB
];
}
AVCodecParserContext
;
typedef
struct
AVCodecParser
{
...
...
@@ -1955,7 +1965,8 @@ AVCodecParserContext *av_parser_init(int codec_id);
int
av_parser_parse
(
AVCodecParserContext
*
s
,
AVCodecContext
*
avctx
,
uint8_t
**
poutbuf
,
int
*
poutbuf_size
,
const
uint8_t
*
buf
,
int
buf_size
);
const
uint8_t
*
buf
,
int
buf_size
,
int64_t
pts
,
int64_t
dts
);
void
av_parser_close
(
AVCodecParserContext
*
s
);
extern
AVCodecParser
mpegvideo_parser
;
...
...
libavcodec/parser.c
浏览文件 @
b84f2a35
...
...
@@ -68,23 +68,56 @@ AVCodecParserContext *av_parser_init(int codec_id)
int
av_parser_parse
(
AVCodecParserContext
*
s
,
AVCodecContext
*
avctx
,
uint8_t
**
poutbuf
,
int
*
poutbuf_size
,
const
uint8_t
*
buf
,
int
buf_size
)
const
uint8_t
*
buf
,
int
buf_size
,
int64_t
pts
,
int64_t
dts
)
{
int
index
;
int
index
,
i
,
k
;
uint8_t
dummy_buf
[
FF_INPUT_BUFFER_PADDING_SIZE
];
if
(
buf_size
==
0
)
{
/* padding is always necessary even if EOF, so we add it here */
memset
(
dummy_buf
,
0
,
sizeof
(
dummy_buf
));
buf
=
dummy_buf
;
}
else
{
/* add a new packet descriptor */
k
=
(
s
->
cur_frame_start_index
+
1
)
&
(
AV_PARSER_PTS_NB
-
1
);
s
->
cur_frame_start_index
=
k
;
s
->
cur_frame_offset
[
k
]
=
s
->
cur_offset
;
s
->
cur_frame_pts
[
k
]
=
pts
;
s
->
cur_frame_dts
[
k
]
=
dts
;
/* fill first PTS/DTS */
if
(
s
->
cur_offset
==
0
)
{
s
->
last_pts
=
pts
;
s
->
last_dts
=
dts
;
}
}
/* WARNING: the returned index can be negative */
index
=
s
->
parser
->
parser_parse
(
s
,
avctx
,
poutbuf
,
poutbuf_size
,
buf
,
buf_size
);
/* update the file pointer */
if
(
*
poutbuf_size
)
{
/* fill the data for the current frame */
s
->
frame_offset
=
s
->
last_frame_offset
;
s
->
pts
=
s
->
last_pts
;
s
->
dts
=
s
->
last_dts
;
/* offset of the next frame */
s
->
last_frame_offset
=
s
->
cur_offset
+
index
;
/* find the packet in which the new frame starts. It
is tricky because of MPEG video start codes
which can begin in one packet and finish in
another packet. In the worst case, an MPEG
video start code could be in 4 different
packets. */
k
=
s
->
cur_frame_start_index
;
for
(
i
=
0
;
i
<
AV_PARSER_PTS_NB
;
i
++
)
{
if
(
s
->
last_frame_offset
>=
s
->
cur_frame_offset
[
k
])
break
;
k
=
(
k
-
1
)
&
(
AV_PARSER_PTS_NB
-
1
);
}
s
->
last_pts
=
s
->
cur_frame_pts
[
k
];
s
->
last_dts
=
s
->
cur_frame_dts
[
k
];
}
if
(
index
<
0
)
index
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录