Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
91a28b0e
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,发现更多精彩内容 >>
提交
91a28b0e
编写于
2月 07, 2012
作者:
J
Justin Ruggles
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avcodec: add ff_samples_to_time_base() convenience function to internal.h
上级
41ac9bb2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
15 deletion
+21
-15
libavcodec/internal.h
libavcodec/internal.h
+11
-0
libavcodec/libspeexenc.c
libavcodec/libspeexenc.c
+1
-4
libavcodec/libvorbis.c
libavcodec/libvorbis.c
+3
-2
libavcodec/utils.c
libavcodec/utils.c
+6
-9
未找到文件。
libavcodec/internal.h
浏览文件 @
91a28b0e
...
...
@@ -26,6 +26,7 @@
#include <stdint.h>
#include "libavutil/mathematics.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
...
...
@@ -127,4 +128,14 @@ int avpriv_unlock_avformat(void);
*/
int
ff_alloc_packet
(
AVPacket
*
avpkt
,
int
size
);
/**
* Rescale from sample rate to AVCodecContext.time_base.
*/
static
av_always_inline
int64_t
ff_samples_to_time_base
(
AVCodecContext
*
avctx
,
int64_t
samples
)
{
return
av_rescale_q
(
samples
,
(
AVRational
){
1
,
avctx
->
sample_rate
},
avctx
->
time_base
);
}
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/libspeexenc.c
浏览文件 @
91a28b0e
...
...
@@ -67,7 +67,6 @@
#include <speex/speex.h>
#include <speex/speex_header.h>
#include <speex/speex_stereo.h>
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
...
...
@@ -258,9 +257,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
/* write output if all frames for the packet have been encoded */
if
(
s
->
pkt_frame_count
==
s
->
frames_per_packet
)
{
s
->
pkt_frame_count
=
0
;
avctx
->
coded_frame
->
pts
=
av_rescale_q
(
s
->
next_pts
,
(
AVRational
){
1
,
avctx
->
sample_rate
},
avctx
->
time_base
);
avctx
->
coded_frame
->
pts
=
ff_samples_to_time_base
(
avctx
,
s
->
next_pts
);
s
->
next_pts
+=
s
->
pkt_sample_count
;
s
->
pkt_sample_count
=
0
;
if
(
buf_size
>
speex_bits_nbytes
(
&
s
->
bits
))
{
...
...
libavcodec/libvorbis.c
浏览文件 @
91a28b0e
...
...
@@ -29,8 +29,8 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "vorbis.h"
#include "libavutil/mathematics.h"
#undef NDEBUG
#include <assert.h>
...
...
@@ -216,7 +216,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext,
op2
->
packet
=
context
->
buffer
+
sizeof
(
ogg_packet
);
l
=
op2
->
bytes
;
avccontext
->
coded_frame
->
pts
=
av_rescale_q
(
op2
->
granulepos
,
(
AVRational
)
{
1
,
avccontext
->
sample_rate
},
avccontext
->
time_base
);
avccontext
->
coded_frame
->
pts
=
ff_samples_to_time_base
(
avccontext
,
op2
->
granulepos
);
//FIXME we should reorder the user supplied pts and not assume that they are spaced by 1/sample_rate
if
(
l
>
buf_size
)
{
...
...
libavcodec/utils.c
浏览文件 @
91a28b0e
...
...
@@ -886,9 +886,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
if
(
!
ret
&&
*
got_packet_ptr
)
{
if
(
!
(
avctx
->
codec
->
capabilities
&
CODEC_CAP_DELAY
))
{
avpkt
->
pts
=
frame
->
pts
;
avpkt
->
duration
=
av_rescale_q
(
frame
->
nb_samples
,
(
AVRational
){
1
,
avctx
->
sample_rate
},
avctx
->
time_base
);
avpkt
->
duration
=
ff_samples_to_time_base
(
avctx
,
frame
->
nb_samples
);
}
avpkt
->
dts
=
avpkt
->
pts
;
}
else
{
...
...
@@ -944,9 +943,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
once all encoders supporting CODEC_CAP_SMALL_LAST_FRAME use
encode2() */
if
(
fs_tmp
)
{
avpkt
->
duration
=
av_rescale_q
(
avctx
->
frame_size
,
(
AVRational
){
1
,
avctx
->
sample_rate
},
avctx
->
time_base
);
avpkt
->
duration
=
ff_samples_to_time_base
(
avctx
,
avctx
->
frame_size
);
}
}
avpkt
->
size
=
ret
;
...
...
@@ -1018,9 +1016,8 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
/* fabricate frame pts from sample count.
this is needed because the avcodec_encode_audio() API does not have
a way for the user to provide pts */
frame
->
pts
=
av_rescale_q
(
avctx
->
internal
->
sample_count
,
(
AVRational
){
1
,
avctx
->
sample_rate
},
avctx
->
time_base
);
frame
->
pts
=
ff_samples_to_time_base
(
avctx
,
avctx
->
internal
->
sample_count
);
avctx
->
internal
->
sample_count
+=
frame
->
nb_samples
;
}
else
{
frame
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录