Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
b92c7a8f
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,发现更多精彩内容 >>
提交
b92c7a8f
编写于
2月 13, 2013
作者:
N
Nicolas George
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tools: add seek_print.
Useful for testing seek implementations.
上级
33796645
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
109 addition
and
0 deletion
+109
-0
.gitignore
.gitignore
+1
-0
libavformat/Makefile
libavformat/Makefile
+1
-0
tools/seek_print.c
tools/seek_print.c
+107
-0
未找到文件。
.gitignore
浏览文件 @
b92c7a8f
...
...
@@ -67,3 +67,4 @@
/tools/probetest
/tools/qt-faststart
/tools/trasher
/tools/seek_print
libavformat/Makefile
浏览文件 @
b92c7a8f
...
...
@@ -449,3 +449,4 @@ TOOLS = aviocat \
ismindex
\
pktdumper
\
probetest
\
seek_print
\
tools/seek_print.c
0 → 100644
浏览文件 @
b92c7a8f
/*
* Copyright (c) 2013 Nicolas George
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <unistd.h>
#include "config.h"
#if HAVE_UNISTD_H
#include <unistd.h>
/* getopt */
#endif
#include "libavformat/avformat.h"
#include "libavutil/timestamp.h"
#if !HAVE_GETOPT
#include "compat/getopt.c"
#endif
static
void
usage
(
int
ret
)
{
fprintf
(
ret
?
stderr
:
stdout
,
"Usage: seek_print file [command ...]
\n
"
"Commands:
\n
"
" read
\n
"
" seek:stream:min_ts:ts:max_ts:flags
\n
"
);
exit
(
ret
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
opt
,
ret
,
stream
,
flags
;
const
char
*
filename
;
AVFormatContext
*
avf
=
NULL
;
int64_t
min_ts
,
max_ts
,
ts
;
AVPacket
packet
;
while
((
opt
=
getopt
(
argc
,
argv
,
"h"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
usage
(
0
);
default:
usage
(
1
);
}
}
argc
-=
optind
;
argv
+=
optind
;
if
(
!
argc
)
usage
(
1
);
filename
=
*
argv
;
argv
++
;
argc
--
;
av_register_all
();
if
((
ret
=
avformat_open_input
(
&
avf
,
filename
,
NULL
,
NULL
))
<
0
)
{
fprintf
(
stderr
,
"%s: %s
\n
"
,
filename
,
av_err2str
(
ret
));
return
1
;
}
if
((
ret
=
avformat_find_stream_info
(
avf
,
NULL
))
<
0
)
{
fprintf
(
stderr
,
"%s: could not find codec parameters: %s
\n
"
,
filename
,
av_err2str
(
ret
));
return
1
;
}
for
(;
argc
;
argc
--
,
argv
++
)
{
if
(
!
strcmp
(
*
argv
,
"read"
))
{
ret
=
av_read_frame
(
avf
,
&
packet
);
if
(
ret
<
0
)
{
printf
(
"read: %d (%s)
\n
"
,
ret
,
av_err2str
(
ret
));
}
else
{
AVRational
*
tb
=
&
avf
->
streams
[
packet
.
stream_index
]
->
time_base
;
printf
(
"read: %d size=%d stream=%d dts=%s (%s) pts=%s (%s)
\n
"
,
ret
,
packet
.
size
,
packet
.
stream_index
,
av_ts2str
(
packet
.
dts
),
av_ts2timestr
(
packet
.
dts
,
tb
),
av_ts2str
(
packet
.
pts
),
av_ts2timestr
(
packet
.
pts
,
tb
));
av_free_packet
(
&
packet
);
}
}
else
if
(
sscanf
(
*
argv
,
"seek:%i:%"
PRIi64
":%"
PRIi64
":%"
PRIi64
":%i"
,
&
stream
,
&
min_ts
,
&
ts
,
&
max_ts
,
&
flags
)
==
5
)
{
ret
=
avformat_seek_file
(
avf
,
stream
,
min_ts
,
ts
,
max_ts
,
flags
);
printf
(
"seek: %d (%s)
\n
"
,
ret
,
av_err2str
(
ret
));
}
else
{
fprintf
(
stderr
,
"'%s': unknown command
\n
"
,
*
argv
);
return
1
;
}
}
avformat_close_input
(
&
avf
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录