Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
01656fd4
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,发现更多精彩内容 >>
提交
01656fd4
编写于
5月 28, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
matroskaenc: support muxing WavPack
上级
794ca87d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
2 deletion
+85
-2
libavformat/Makefile
libavformat/Makefile
+1
-1
libavformat/matroskaenc.c
libavformat/matroskaenc.c
+72
-1
tests/Makefile
tests/Makefile
+2
-0
tests/fate/wavpack.mak
tests/fate/wavpack.mak
+10
-0
未找到文件。
libavformat/Makefile
浏览文件 @
01656fd4
...
...
@@ -160,7 +160,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
isom.o rmsipr.o
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
matroskaenc.o matroska.o
\
isom.o avc.o
\
flacenc_header.o avlanguage.o
flacenc_header.o avlanguage.o
wv.o
OBJS-$(CONFIG_MD5_MUXER)
+=
md5enc.o
OBJS-$(CONFIG_MJPEG_DEMUXER)
+=
rawdec.o
OBJS-$(CONFIG_MJPEG_MUXER)
+=
rawenc.o
...
...
libavformat/matroskaenc.c
浏览文件 @
01656fd4
...
...
@@ -27,6 +27,7 @@
#include "isom.h"
#include "matroska.h"
#include "riff.h"
#include "wv.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
...
...
@@ -450,6 +451,15 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex
return
0
;
}
static
int
put_wv_codecpriv
(
AVIOContext
*
pb
,
AVCodecContext
*
codec
)
{
if
(
codec
->
extradata
&&
codec
->
extradata_size
==
2
)
avio_write
(
pb
,
codec
->
extradata
,
2
);
else
avio_wl16
(
pb
,
0x403
);
// fallback to the version mentioned in matroska specs
return
0
;
}
static
void
get_aac_sample_rates
(
AVFormatContext
*
s
,
AVCodecContext
*
codec
,
int
*
sample_rate
,
int
*
output_sample_rate
)
{
MPEG4AudioConfig
mp4ac
;
...
...
@@ -479,6 +489,8 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
ret
=
put_xiph_codecpriv
(
s
,
dyn_cp
,
codec
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_FLAC
)
ret
=
ff_flac_write_header
(
dyn_cp
,
codec
,
1
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_WAVPACK
)
ret
=
put_wv_codecpriv
(
dyn_cp
,
codec
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_H264
)
ret
=
ff_isom_write_avcc
(
dyn_cp
,
codec
->
extradata
,
codec
->
extradata_size
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_ALAC
)
{
...
...
@@ -1054,6 +1066,59 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
return
max_duration
;
}
static
int
mkv_strip_wavpack
(
const
uint8_t
*
src
,
uint8_t
**
pdst
,
int
*
size
)
{
uint8_t
*
dst
;
int
srclen
=
*
size
;
int
offset
=
0
;
int
ret
;
dst
=
av_malloc
(
srclen
);
if
(
!
dst
)
return
AVERROR
(
ENOMEM
);
while
(
srclen
>=
WV_HEADER_SIZE
)
{
WvHeader
header
;
ret
=
ff_wv_parse_header
(
&
header
,
src
);
if
(
ret
<
0
)
goto
fail
;
src
+=
WV_HEADER_SIZE
;
srclen
-=
WV_HEADER_SIZE
;
if
(
srclen
<
header
.
blocksize
)
{
ret
=
AVERROR_INVALIDDATA
;
goto
fail
;
}
if
(
header
.
initial
)
{
AV_WL32
(
dst
+
offset
,
header
.
samples
);
offset
+=
4
;
}
AV_WL32
(
dst
+
offset
,
header
.
flags
);
AV_WL32
(
dst
+
offset
+
4
,
header
.
crc
);
offset
+=
8
;
if
(
!
(
header
.
initial
&&
header
.
final
))
{
AV_WL32
(
dst
+
offset
,
header
.
blocksize
);
offset
+=
4
;
}
memcpy
(
dst
+
offset
,
src
,
header
.
blocksize
);
src
+=
header
.
blocksize
;
srclen
-=
header
.
blocksize
;
offset
+=
header
.
blocksize
;
}
*
pdst
=
dst
;
*
size
=
offset
;
return
0
;
fail:
av_freep
(
&
dst
);
return
ret
;
}
static
void
mkv_write_block
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
unsigned
int
blockid
,
AVPacket
*
pkt
,
int
flags
)
{
...
...
@@ -1069,7 +1134,13 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
if
(
codec
->
codec_id
==
AV_CODEC_ID_H264
&&
codec
->
extradata_size
>
0
&&
(
AV_RB24
(
codec
->
extradata
)
==
1
||
AV_RB32
(
codec
->
extradata
)
==
1
))
ff_avc_parse_nal_units_buf
(
pkt
->
data
,
&
data
,
&
size
);
else
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_WAVPACK
)
{
int
ret
=
mkv_strip_wavpack
(
pkt
->
data
,
&
data
,
&
size
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Error stripping a WavPack packet.
\n
"
);
return
;
}
}
else
data
=
pkt
->
data
;
if
(
codec
->
codec_id
==
AV_CODEC_ID_PRORES
)
{
...
...
tests/Makefile
浏览文件 @
01656fd4
...
...
@@ -42,6 +42,8 @@ ENCDEC2 = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER \
DEMDEC
=
$(
call
ALLYES,
$(1)
_DEMUXER
$(2:%=%_DECODER)
)
ENCMUX
=
$(
call
ALLYES,
$(1:%=%_ENCODER)
$(2)
_MUXER
)
DEMMUX
=
$(
call
ALLYES,
$(1)
_DEMUXER
$(2)
_MUXER
)
FILTERDEMDEC
=
$(
call
ALLYES,
$(1)
_FILTER
$(2)
_DEMUXER
$(3)
_DECODER
)
FILTERDEMDECMUX
=
$(
call
ALLYES,
$(1)
_FILTER
$(2)
_DEMUXER
$(3)
_DECODER
$(4)
_MUXER
)
FILTERDEMDECENCMUX
=
$(
call
ALLYES,
$(1)
_FILTER
$(2)
_DEMUXER
$(3)
_DECODER
$(4)
_ENCODER
$(5)
_MUXER
)
...
...
tests/fate/wavpack.mak
浏览文件 @
01656fd4
...
...
@@ -88,5 +88,15 @@ FATE_WAVPACK-$(call DEMDEC, WV, WAVPACK) += $(FATE_WAVPACK)
FATE_WAVPACK-$(call
DEMDEC,
MATROSKA,
WAVPACK)
+=
fate-wavpack-matroskamode
fate-wavpack-matroskamode
:
CMD = md5 -i $(TARGET_SAMPLES)/wavpack/special/matroska_mode.mka -f s16le
FATE_WAVPACK-$(call
DEMMUX,
WV,
MATROSKA)
+=
fate-wavpack-matroska_mux-mono
fate-wavpack-matroska_mux-mono
:
CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -flags +bitexact -f matroska
fate-wavpack-matroska_mux-mono
:
CMP = oneline
fate-wavpack-matroska_mux-mono
:
REF = f471da7c71cd01d5fb81efb1d740504f
FATE_WAVPACK-$(call
DEMMUX,
WV,
MATROSKA)
+=
fate-wavpack-matroska_mux-61
fate-wavpack-matroska_mux-61
:
CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy -flags +bitexact -f matroska
fate-wavpack-matroska_mux-61
:
CMP = oneline
fate-wavpack-matroska_mux-61
:
REF = cbbd0ce7eabef52235bcdd2cb0690f24
FATE_SAMPLES_AVCONV
+=
$
(
FATE_WAVPACK-yes
)
fate-wavpack
:
$(FATE_WAVPACK-yes)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录