Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云duo
FFmpeg
提交
04e9853a
F
FFmpeg
项目概览
云duo
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
04e9853a
编写于
6月 29, 2013
作者:
L
Luca Barbato
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wmavoice: return meaningful error codes
上级
7d65e960
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
12 deletion
+13
-12
libavcodec/wmavoice.c
libavcodec/wmavoice.c
+13
-12
未找到文件。
libavcodec/wmavoice.c
浏览文件 @
04e9853a
...
...
@@ -354,7 +354,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid extradata size %d (should be 46)
\n
"
,
ctx
->
extradata_size
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
flags
=
AV_RL32
(
ctx
->
extradata
+
18
);
s
->
spillover_bitsize
=
3
+
av_ceil_log2
(
ctx
->
block_align
);
...
...
@@ -377,7 +377,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid denoise filter strength %d (max=11)
\n
"
,
s
->
denoise_strength
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
->
denoise_tilt_corr
=
!!
(
flags
&
0x40
);
s
->
dc_level
=
(
flags
>>
7
)
&
0xF
;
...
...
@@ -399,7 +399,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
init_get_bits
(
&
s
->
gb
,
ctx
->
extradata
+
22
,
(
ctx
->
extradata_size
-
22
)
<<
3
);
if
(
decode_vbmtree
(
&
s
->
gb
,
s
->
vbm_tree
)
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid VBM tree; broken extradata?
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
->
min_pitch_val
=
((
ctx
->
sample_rate
<<
8
)
/
400
+
50
)
>>
8
;
...
...
@@ -407,7 +407,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
pitch_range
=
s
->
max_pitch_val
-
s
->
min_pitch_val
;
if
(
pitch_range
<=
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid pitch range; broken extradata?
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
->
pitch_nbits
=
av_ceil_log2
(
pitch_range
);
s
->
last_pitch_val
=
40
;
...
...
@@ -422,7 +422,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
"Unsupported samplerate %d (min=%d, max=%d)
\n
"
,
ctx
->
sample_rate
,
min_sr
,
max_sr
);
// 322-22097 Hz
return
-
1
;
return
AVERROR
(
ENOSYS
)
;
}
s
->
block_conv_table
[
0
]
=
s
->
min_pitch_val
;
...
...
@@ -432,7 +432,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
s
->
block_delta_pitch_hrange
=
(
pitch_range
>>
3
)
&
~
0xF
;
if
(
s
->
block_delta_pitch_hrange
<=
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid delta pitch hrange; broken extradata?
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
->
block_delta_pitch_nbits
=
1
+
av_ceil_log2
(
s
->
block_delta_pitch_hrange
);
s
->
block_pitch_range
=
s
->
block_conv_table
[
2
]
+
...
...
@@ -1447,7 +1447,7 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
if
(
bd_idx
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid frame type VLC code, skipping
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
block_nsamples
=
MAX_FRAMESIZE
/
frame_descs
[
bd_idx
].
n_blocks
;
...
...
@@ -1644,7 +1644,7 @@ static void stabilize_lsps(double *lsps, int num)
* does not modify the state of the bitreader; it
* only uses it to copy the current stream position
* @param s WMA Voice decoding context private data
* @return
-1 if unsupported
, 1 on not enough bits or 0 if OK.
* @return
< 0 on error
, 1 on not enough bits or 0 if OK.
*/
static
int
check_bits_for_superframe
(
GetBitContext
*
orig_gb
,
WMAVoiceContext
*
s
)
...
...
@@ -1662,7 +1662,7 @@ static int check_bits_for_superframe(GetBitContext *orig_gb,
if
(
get_bits_left
(
gb
)
<
14
)
return
1
;
if
(
!
get_bits1
(
gb
))
return
-
1
;
// WMAPro-in-WMAVoice superframe
return
AVERROR
(
ENOSYS
);
// WMAPro-in-WMAVoice superframe
if
(
get_bits1
(
gb
))
skip_bits
(
gb
,
12
);
// number of samples in superframe
if
(
s
->
has_residual_lsps
)
{
// residual LSPs (for all frames)
if
(
get_bits_left
(
gb
)
<
s
->
sframe_lsp_bitsize
)
...
...
@@ -1680,7 +1680,7 @@ static int check_bits_for_superframe(GetBitContext *orig_gb,
}
bd_idx
=
s
->
vbm_tree
[
get_vlc2
(
gb
,
frame_type_vlc
.
table
,
6
,
3
)];
if
(
bd_idx
<
0
)
return
-
1
;
// invalid frame type VLC code
return
AVERROR_INVALIDDATA
;
// invalid frame type VLC code
frame_desc
=
&
frame_descs
[
bd_idx
];
if
(
frame_desc
->
acb_type
==
ACB_TYPE_ASYMMETRIC
)
{
if
(
get_bits_left
(
gb
)
<
s
->
pitch_nbits
)
...
...
@@ -1758,7 +1758,8 @@ static int synth_superframe(AVCodecContext *ctx, AVFrame *frame,
if
((
res
=
check_bits_for_superframe
(
gb
,
s
))
==
1
)
{
*
got_frame_ptr
=
0
;
return
1
;
}
}
else
if
(
res
<
0
)
return
res
;
/* First bit is speech/music bit, it differentiates between WMAVoice
* speech samples (the actual codec) and WMAVoice music samples, which
...
...
@@ -1775,7 +1776,7 @@ static int synth_superframe(AVCodecContext *ctx, AVFrame *frame,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Superframe encodes >480 samples (%d), not allowed
\n
"
,
n_samples
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
/* Parse LSPs, if global for the superframe (can also be per-frame). */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录