Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
8eea8fdc
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,发现更多精彩内容 >>
提交
8eea8fdc
编写于
7月 10, 2012
作者:
D
Diego Biurrun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flac: Move flac functions shared between libraries to flac common code
This fixes a number of flac-related build dependencies.
上级
a5194633
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
85 addition
and
86 deletion
+85
-86
libavcodec/Makefile
libavcodec/Makefile
+11
-13
libavcodec/flac.c
libavcodec/flac.c
+74
-0
libavcodec/flacdec.c
libavcodec/flacdec.c
+0
-73
未找到文件。
libavcodec/Makefile
浏览文件 @
8eea8fdc
...
...
@@ -566,19 +566,18 @@ OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
ac3tab.o
OBJS-$(CONFIG_DV_DEMUXER)
+=
dv_profile.o
OBJS-$(CONFIG_DV_MUXER)
+=
dv_profile.o
OBJS-$(CONFIG_FLAC_DEMUXER)
+=
flac
dec.o flacdata.o flac
.o
OBJS-$(CONFIG_FLAC_MUXER)
+=
flac
dec.o flacdata.o flac
.o
OBJS-$(CONFIG_FLAC_DEMUXER)
+=
flac
.o flacdata
.o
OBJS-$(CONFIG_FLAC_MUXER)
+=
flac
.o flacdata
.o
OBJS-$(CONFIG_FLV_DEMUXER)
+=
mpeg4audio.o
OBJS-$(CONFIG_GXF_DEMUXER)
+=
mpeg12data.o
OBJS-$(CONFIG_IFF_DEMUXER)
+=
iff.o
OBJS-$(CONFIG_ISMV_MUXER)
+=
mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_LATM_MUXER)
+=
mpeg4audio.o
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER)
+=
xiph.o mpeg4audio.o
\
flac
dec.o flacdata.o flac
.o
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER)
+=
xiph.o mpeg4audio.o
\
flac
.o flacdata
.o
OBJS-$(CONFIG_MATROSKA_DEMUXER)
+=
mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
xiph.o mpeg4audio.o
\
flacdec.o flacdata.o flac.o
\
mpegaudiodata.o
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
mpeg4audio.o mpegaudiodata.o
\
flac.o flacdata.o xiph.o
OBJS-$(CONFIG_MP2_MUXER)
+=
mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP3_MUXER)
+=
mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MOV_DEMUXER)
+=
mpeg4audio.o mpegaudiodata.o ac3tab.o
...
...
@@ -586,14 +585,13 @@ OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGTS_MUXER)
+=
mpegvideo.o mpeg4audio.o
OBJS-$(CONFIG_MPEGTS_DEMUXER)
+=
mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_NUT_MUXER)
+=
mpegaudiodata.o
OBJS-$(CONFIG_OGG_DEMUXER)
+=
flac
dec.o flacdata.o flac.o
\
dirac.o
mpeg12data.o vorbis_parser.o
OBJS-$(CONFIG_OGG_MUXER)
+=
xiph.o flac
dec.o flacdata.o flac
.o
OBJS-$(CONFIG_OGG_DEMUXER)
+=
flac
.o flacdata.o dirac.o
\
mpeg12data.o vorbis_parser.o
OBJS-$(CONFIG_OGG_MUXER)
+=
xiph.o flac
.o flacdata
.o
OBJS-$(CONFIG_RTP_MUXER)
+=
mpeg4audio.o mpegvideo.o xiph.o
OBJS-$(CONFIG_SPDIF_DEMUXER)
+=
aacadtsdec.o mpeg4audio.o
OBJS-$(CONFIG_WEBM_MUXER)
+=
xiph.o mpeg4audio.o
\
flacdec.o flacdata.o flac.o
\
mpegaudiodata.o
OBJS-$(CONFIG_WEBM_MUXER)
+=
mpeg4audio.o mpegaudiodata.o
\
xiph.o flac.o flacdata.o
OBJS-$(CONFIG_WTV_DEMUXER)
+=
mpeg4audio.o mpegaudiodata.o
# external codec libraries
...
...
libavcodec/flac.c
浏览文件 @
8eea8fdc
...
...
@@ -20,6 +20,9 @@
*/
#include "libavutil/crc.h"
#include "libavutil/log.h"
#include "bytestream.h"
#include "get_bits.h"
#include "flac.h"
#include "flacdata.h"
...
...
@@ -150,3 +153,74 @@ int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
return
count
;
}
int
avpriv_flac_is_extradata_valid
(
AVCodecContext
*
avctx
,
enum
FLACExtradataFormat
*
format
,
uint8_t
**
streaminfo_start
)
{
if
(
!
avctx
->
extradata
||
avctx
->
extradata_size
<
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"extradata NULL or too small.
\n
"
);
return
0
;
}
if
(
AV_RL32
(
avctx
->
extradata
)
!=
MKTAG
(
'f'
,
'L'
,
'a'
,
'C'
))
{
/* extradata contains STREAMINFO only */
if
(
avctx
->
extradata_size
!=
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"extradata contains %d bytes too many.
\n
"
,
FLAC_STREAMINFO_SIZE
-
avctx
->
extradata_size
);
}
*
format
=
FLAC_EXTRADATA_FORMAT_STREAMINFO
;
*
streaminfo_start
=
avctx
->
extradata
;
}
else
{
if
(
avctx
->
extradata_size
<
8
+
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"extradata too small.
\n
"
);
return
0
;
}
*
format
=
FLAC_EXTRADATA_FORMAT_FULL_HEADER
;
*
streaminfo_start
=
&
avctx
->
extradata
[
8
];
}
return
1
;
}
void
avpriv_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
const
uint8_t
*
buffer
)
{
GetBitContext
gb
;
init_get_bits
(
&
gb
,
buffer
,
FLAC_STREAMINFO_SIZE
*
8
);
skip_bits
(
&
gb
,
16
);
/* skip min blocksize */
s
->
max_blocksize
=
get_bits
(
&
gb
,
16
);
if
(
s
->
max_blocksize
<
FLAC_MIN_BLOCKSIZE
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"invalid max blocksize: %d
\n
"
,
s
->
max_blocksize
);
s
->
max_blocksize
=
16
;
}
skip_bits
(
&
gb
,
24
);
/* skip min frame size */
s
->
max_framesize
=
get_bits_long
(
&
gb
,
24
);
s
->
samplerate
=
get_bits_long
(
&
gb
,
20
);
s
->
channels
=
get_bits
(
&
gb
,
3
)
+
1
;
s
->
bps
=
get_bits
(
&
gb
,
5
)
+
1
;
avctx
->
channels
=
s
->
channels
;
avctx
->
sample_rate
=
s
->
samplerate
;
avctx
->
bits_per_raw_sample
=
s
->
bps
;
s
->
samples
=
get_bits_long
(
&
gb
,
32
)
<<
4
;
s
->
samples
|=
get_bits
(
&
gb
,
4
);
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
}
void
avpriv_flac_parse_block_header
(
const
uint8_t
*
block_header
,
int
*
last
,
int
*
type
,
int
*
size
)
{
int
tmp
=
bytestream_get_byte
(
&
block_header
);
if
(
last
)
*
last
=
tmp
&
0x80
;
if
(
type
)
*
type
=
tmp
&
0x7F
;
if
(
size
)
*
size
=
bytestream_get_be24
(
&
block_header
);
}
libavcodec/flacdec.c
浏览文件 @
8eea8fdc
...
...
@@ -75,33 +75,6 @@ static const int64_t flac_channel_layouts[6] = {
static
void
allocate_buffers
(
FLACContext
*
s
);
int
avpriv_flac_is_extradata_valid
(
AVCodecContext
*
avctx
,
enum
FLACExtradataFormat
*
format
,
uint8_t
**
streaminfo_start
)
{
if
(
!
avctx
->
extradata
||
avctx
->
extradata_size
<
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"extradata NULL or too small.
\n
"
);
return
0
;
}
if
(
AV_RL32
(
avctx
->
extradata
)
!=
MKTAG
(
'f'
,
'L'
,
'a'
,
'C'
))
{
/* extradata contains STREAMINFO only */
if
(
avctx
->
extradata_size
!=
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"extradata contains %d bytes too many.
\n
"
,
FLAC_STREAMINFO_SIZE
-
avctx
->
extradata_size
);
}
*
format
=
FLAC_EXTRADATA_FORMAT_STREAMINFO
;
*
streaminfo_start
=
avctx
->
extradata
;
}
else
{
if
(
avctx
->
extradata_size
<
8
+
FLAC_STREAMINFO_SIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"extradata too small.
\n
"
);
return
0
;
}
*
format
=
FLAC_EXTRADATA_FORMAT_FULL_HEADER
;
*
streaminfo_start
=
&
avctx
->
extradata
[
8
];
}
return
1
;
}
static
void
flac_set_bps
(
FLACContext
*
s
)
{
enum
AVSampleFormat
req
=
s
->
avctx
->
request_sample_fmt
;
...
...
@@ -175,52 +148,6 @@ static void allocate_buffers(FLACContext *s)
}
}
void
avpriv_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
const
uint8_t
*
buffer
)
{
GetBitContext
gb
;
init_get_bits
(
&
gb
,
buffer
,
FLAC_STREAMINFO_SIZE
*
8
);
skip_bits
(
&
gb
,
16
);
/* skip min blocksize */
s
->
max_blocksize
=
get_bits
(
&
gb
,
16
);
if
(
s
->
max_blocksize
<
FLAC_MIN_BLOCKSIZE
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"invalid max blocksize: %d
\n
"
,
s
->
max_blocksize
);
s
->
max_blocksize
=
16
;
}
skip_bits
(
&
gb
,
24
);
/* skip min frame size */
s
->
max_framesize
=
get_bits_long
(
&
gb
,
24
);
s
->
samplerate
=
get_bits_long
(
&
gb
,
20
);
s
->
channels
=
get_bits
(
&
gb
,
3
)
+
1
;
s
->
bps
=
get_bits
(
&
gb
,
5
)
+
1
;
avctx
->
channels
=
s
->
channels
;
avctx
->
sample_rate
=
s
->
samplerate
;
avctx
->
bits_per_raw_sample
=
s
->
bps
;
s
->
samples
=
get_bits_long
(
&
gb
,
32
)
<<
4
;
s
->
samples
|=
get_bits
(
&
gb
,
4
);
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
dump_headers
(
avctx
,
s
);
}
void
avpriv_flac_parse_block_header
(
const
uint8_t
*
block_header
,
int
*
last
,
int
*
type
,
int
*
size
)
{
int
tmp
=
bytestream_get_byte
(
&
block_header
);
if
(
last
)
*
last
=
tmp
&
0x80
;
if
(
type
)
*
type
=
tmp
&
0x7F
;
if
(
size
)
*
size
=
bytestream_get_be24
(
&
block_header
);
}
/**
* Parse the STREAMINFO from an inline header.
* @param s the flac decoding context
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录