Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云duo
FFmpeg
提交
be187388
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,发现更多精彩内容 >>
提交
be187388
编写于
3月 24, 2011
作者:
J
Justin Ruggles
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser
and decoder, and vice-versa for the AC-3 encoder.
上级
c70a6a41
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
3 deletion
+29
-3
libavcodec/aac_ac3_parser.c
libavcodec/aac_ac3_parser.c
+1
-0
libavcodec/aac_ac3_parser.h
libavcodec/aac_ac3_parser.h
+1
-0
libavcodec/ac3.h
libavcodec/ac3.h
+1
-0
libavcodec/ac3_parser.c
libavcodec/ac3_parser.c
+4
-1
libavcodec/ac3dec.c
libavcodec/ac3dec.c
+5
-0
libavcodec/ac3dec.h
libavcodec/ac3dec.h
+1
-0
libavcodec/ac3enc.c
libavcodec/ac3enc.c
+15
-1
libavcodec/eac3dec.c
libavcodec/eac3dec.c
+1
-1
未找到文件。
libavcodec/aac_ac3_parser.c
浏览文件 @
be187388
...
...
@@ -94,6 +94,7 @@ get_next:
avctx
->
channel_layout
=
s
->
channel_layout
;
}
avctx
->
frame_size
=
s
->
samples
;
avctx
->
audio_service_type
=
s
->
service_type
;
}
avctx
->
bit_rate
=
s
->
bit_rate
;
...
...
libavcodec/aac_ac3_parser.h
浏览文件 @
be187388
...
...
@@ -49,6 +49,7 @@ typedef struct AACAC3ParseContext {
int
bit_rate
;
int
samples
;
int64_t
channel_layout
;
int
service_type
;
int
remaining_size
;
uint64_t
state
;
...
...
libavcodec/ac3.h
浏览文件 @
be187388
...
...
@@ -87,6 +87,7 @@ typedef struct {
uint16_t
crc1
;
uint8_t
sr_code
;
uint8_t
bitstream_id
;
uint8_t
bitstream_mode
;
uint8_t
channel_mode
;
uint8_t
lfe_on
;
uint8_t
frame_type
;
...
...
libavcodec/ac3_parser.c
浏览文件 @
be187388
...
...
@@ -69,7 +69,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
skip_bits
(
gbc
,
5
);
// skip bsid, already got it
skip_bits
(
gbc
,
3
);
// skip bitstream mode
hdr
->
bitstream_mode
=
get_bits
(
gbc
,
3
);
hdr
->
channel_mode
=
get_bits
(
gbc
,
3
);
if
(
hdr
->
channel_mode
==
AC3_CHMODE_STEREO
)
{
...
...
@@ -151,6 +151,9 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
hdr_info
->
channels
=
hdr
.
channels
;
hdr_info
->
channel_layout
=
hdr
.
channel_layout
;
hdr_info
->
samples
=
hdr
.
num_blocks
*
256
;
hdr_info
->
service_type
=
hdr
.
bitstream_mode
;
if
(
hdr
.
bitstream_mode
==
0x7
&&
hdr
.
channels
>
1
)
hdr_info
->
service_type
=
AV_AUDIO_SERVICE_TYPE_KARAOKE
;
if
(
hdr
.
bitstream_id
>
10
)
hdr_info
->
codec_id
=
CODEC_ID_EAC3
;
else
if
(
hdr_info
->
codec_id
==
CODEC_ID_NONE
)
...
...
libavcodec/ac3dec.c
浏览文件 @
be187388
...
...
@@ -273,6 +273,7 @@ static int parse_frame_header(AC3DecodeContext *s)
/* get decoding parameters from header info */
s
->
bit_alloc_params
.
sr_code
=
hdr
.
sr_code
;
s
->
bitstream_mode
=
hdr
.
bitstream_mode
;
s
->
channel_mode
=
hdr
.
channel_mode
;
s
->
channel_layout
=
hdr
.
channel_layout
;
s
->
lfe_on
=
hdr
.
lfe_on
;
...
...
@@ -1399,6 +1400,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
if
(
s
->
out_channels
<
s
->
channels
)
s
->
output_mode
=
s
->
out_channels
==
1
?
AC3_CHMODE_MONO
:
AC3_CHMODE_STEREO
;
}
/* set audio service type based on bitstream mode for AC-3 */
avctx
->
audio_service_type
=
s
->
bitstream_mode
;
if
(
s
->
bitstream_mode
==
0x7
&&
s
->
channels
>
1
)
avctx
->
audio_service_type
=
AV_AUDIO_SERVICE_TYPE_KARAOKE
;
/* decode the audio blocks */
channel_map
=
ff_ac3_dec_channel_map
[
s
->
output_mode
&
~
AC3_OUTPUT_LFEON
][
s
->
lfe_on
];
...
...
libavcodec/ac3dec.h
浏览文件 @
be187388
...
...
@@ -79,6 +79,7 @@ typedef struct {
int
bit_rate
;
///< stream bit rate, in bits-per-second
int
sample_rate
;
///< sample frequency, in Hz
int
num_blocks
;
///< number of audio blocks
int
bitstream_mode
;
///< bitstream mode (bsmod)
int
channel_mode
;
///< channel mode (acmod)
int
channel_layout
;
///< channel layout
int
lfe_on
;
///< lfe channel in use
...
...
libavcodec/ac3enc.c
浏览文件 @
be187388
...
...
@@ -1657,6 +1657,18 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
if
(
s
->
cutoff
>
(
s
->
sample_rate
>>
1
))
s
->
cutoff
=
s
->
sample_rate
>>
1
;
/* validate audio service type / channels combination */
if
((
avctx
->
audio_service_type
==
AV_AUDIO_SERVICE_TYPE_KARAOKE
&&
avctx
->
channels
==
1
)
||
((
avctx
->
audio_service_type
==
AV_AUDIO_SERVICE_TYPE_COMMENTARY
||
avctx
->
audio_service_type
==
AV_AUDIO_SERVICE_TYPE_EMERGENCY
||
avctx
->
audio_service_type
==
AV_AUDIO_SERVICE_TYPE_VOICE_OVER
)
&&
avctx
->
channels
>
1
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid audio service type for the "
"specified number of channels
\n
"
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
...
...
@@ -1799,7 +1811,9 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx)
return
ret
;
s
->
bitstream_id
=
8
+
s
->
bit_alloc
.
sr_shift
;
s
->
bitstream_mode
=
0
;
/* complete main audio service */
s
->
bitstream_mode
=
avctx
->
audio_service_type
;
if
(
s
->
bitstream_mode
==
AV_AUDIO_SERVICE_TYPE_KARAOKE
)
s
->
bitstream_mode
=
0x7
;
s
->
frame_size_min
=
2
*
ff_ac3_frame_size_tab
[
s
->
frame_size_code
][
s
->
bit_alloc
.
sr_code
];
s
->
bits_written
=
0
;
...
...
libavcodec/eac3dec.c
浏览文件 @
be187388
...
...
@@ -410,7 +410,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* informational metadata */
if
(
get_bits1
(
gbc
))
{
s
kip_bits
(
gbc
,
3
);
// skip bit stream mode
s
->
bitstream_mode
=
get_bits
(
gbc
,
3
);
skip_bits
(
gbc
,
2
);
// skip copyright bit and original bitstream bit
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
)
{
skip_bits
(
gbc
,
4
);
// skip Dolby surround and headphone mode
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录