Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
e8b62df6
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,发现更多精彩内容 >>
提交
e8b62df6
编写于
9月 19, 2002
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixing apiexample
Originally committed as revision 958 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
b71901e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
15 deletion
+22
-15
libavcodec/apiexample.c
libavcodec/apiexample.c
+15
-15
libavcodec/utils.c
libavcodec/utils.c
+7
-0
未找到文件。
libavcodec/apiexample.c
浏览文件 @
e8b62df6
...
...
@@ -19,7 +19,7 @@
void
audio_encode_example
(
const
char
*
filename
)
{
AVCodec
*
codec
;
AVCodecContext
codec_context
,
*
c
=
&
codec_context
;
AVCodecContext
*
c
=
NULL
;
int
frame_size
,
i
,
j
,
out_size
,
outbuf_size
;
FILE
*
f
;
short
*
samples
;
...
...
@@ -35,9 +35,8 @@ void audio_encode_example(const char *filename)
exit
(
1
);
}
/* put default values */
memset
(
c
,
0
,
sizeof
(
*
c
));
c
=
avcodec_alloc_context
();
/* put sample parameters */
c
->
bit_rate
=
64000
;
c
->
sample_rate
=
44100
;
...
...
@@ -79,6 +78,7 @@ void audio_encode_example(const char *filename)
free
(
samples
);
avcodec_close
(
c
);
free
(
c
);
}
/*
...
...
@@ -87,7 +87,7 @@ void audio_encode_example(const char *filename)
void
audio_decode_example
(
const
char
*
outfilename
,
const
char
*
filename
)
{
AVCodec
*
codec
;
AVCodecContext
codec_context
,
*
c
=
&
codec_context
;
AVCodecContext
*
c
=
NULL
;
int
out_size
,
size
,
len
;
FILE
*
f
,
*
outfile
;
UINT8
*
outbuf
;
...
...
@@ -102,8 +102,7 @@ void audio_decode_example(const char *outfilename, const char *filename)
exit
(
1
);
}
/* put default values */
memset
(
c
,
0
,
sizeof
(
*
c
));
c
=
avcodec_alloc_context
();
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
...
...
@@ -120,7 +119,7 @@ void audio_decode_example(const char *outfilename, const char *filename)
}
outfile
=
fopen
(
outfilename
,
"w"
);
if
(
!
outfile
)
{
f
printf
(
stderr
,
"could not open %s
\n
"
,
outfilename
);
f
ree
(
c
);
exit
(
1
);
}
...
...
@@ -153,6 +152,7 @@ void audio_decode_example(const char *outfilename, const char *filename)
free
(
outbuf
);
avcodec_close
(
c
);
free
(
c
);
}
/*
...
...
@@ -161,7 +161,7 @@ void audio_decode_example(const char *outfilename, const char *filename)
void
video_encode_example
(
const
char
*
filename
)
{
AVCodec
*
codec
;
AVCodecContext
codec_context
,
*
c
=
&
codec_context
;
AVCodecContext
*
c
=
NULL
;
int
i
,
out_size
,
size
,
x
,
y
,
outbuf_size
;
FILE
*
f
;
AVPicture
picture
;
...
...
@@ -176,9 +176,8 @@ void video_encode_example(const char *filename)
exit
(
1
);
}
/* put default values */
memset
(
c
,
0
,
sizeof
(
*
c
));
c
=
avcodec_alloc_context
();
/* put sample parameters */
c
->
bit_rate
=
400000
;
/* resolution must be a multiple of two */
...
...
@@ -251,6 +250,7 @@ void video_encode_example(const char *filename)
free
(
outbuf
);
avcodec_close
(
c
);
free
(
c
);
printf
(
"
\n
"
);
}
...
...
@@ -273,7 +273,7 @@ void pgm_save(unsigned char *buf,int wrap, int xsize,int ysize,char *filename)
void
video_decode_example
(
const
char
*
outfilename
,
const
char
*
filename
)
{
AVCodec
*
codec
;
AVCodecContext
codec_context
,
*
c
=
&
codec_context
;
AVCodecContext
*
c
=
NULL
;
int
frame
,
size
,
got_picture
,
len
;
FILE
*
f
;
AVPicture
picture
;
...
...
@@ -289,8 +289,7 @@ void video_decode_example(const char *outfilename, const char *filename)
exit
(
1
);
}
/* put default values */
memset
(
c
,
0
,
sizeof
(
*
c
));
c
=
avcodec_alloc_context
();
/* for some codecs, such as msmpeg4 and mpeg4, width and height
MUST be initialized there because these info are not available
...
...
@@ -375,6 +374,7 @@ void video_decode_example(const char *outfilename, const char *filename)
fclose
(
f
);
avcodec_close
(
c
);
free
(
c
);
printf
(
"
\n
"
);
}
...
...
libavcodec/utils.c
浏览文件 @
e8b62df6
...
...
@@ -50,10 +50,17 @@ void register_avcodec(AVCodec *format)
}
void
avcodec_get_context_defaults
(
AVCodecContext
*
s
){
s
->
bit_rate
=
800
*
1000
;
s
->
bit_rate_tolerance
=
s
->
bit_rate
*
10
;
s
->
qmin
=
2
;
s
->
qmax
=
31
;
s
->
rc_eq
=
"tex^qComp"
;
s
->
qcompress
=
0
.
5
;
s
->
max_qdiff
=
3
;
s
->
b_quant_factor
=
1
.
25
;
s
->
b_quant_offset
=
1
.
25
;
s
->
i_quant_factor
=
0
.
8
;
s
->
i_quant_offset
=
0
.
0
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录