Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
036e12b2
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,发现更多精彩内容 >>
提交
036e12b2
编写于
1月 27, 2017
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avformat: add SCC muxer
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
76331361
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
127 addition
and
2 deletion
+127
-2
Changelog
Changelog
+1
-0
libavformat/Makefile
libavformat/Makefile
+1
-0
libavformat/allformats.c
libavformat/allformats.c
+1
-1
libavformat/sccenc.c
libavformat/sccenc.c
+123
-0
libavformat/version.h
libavformat/version.h
+1
-1
未找到文件。
Changelog
浏览文件 @
036e12b2
...
...
@@ -18,6 +18,7 @@ version <next>:
- readeia608 filter
- Sample Dump eXchange demuxer
- abitscope multimedia filter
- Scenarist Closed Captions demuxer and muxer
version 3.2:
- libopenmpt demuxer
...
...
libavformat/Makefile
浏览文件 @
036e12b2
...
...
@@ -435,6 +435,7 @@ OBJS-$(CONFIG_SAP_DEMUXER) += sapdec.o
OBJS-$(CONFIG_SAP_MUXER)
+=
sapenc.o
OBJS-$(CONFIG_SBG_DEMUXER)
+=
sbgdec.o
OBJS-$(CONFIG_SCC_DEMUXER)
+=
sccdec.o subtitles.o
OBJS-$(CONFIG_SCC_MUXER)
+=
sccenc.o subtitles.o
OBJS-$(CONFIG_SDP_DEMUXER)
+=
rtsp.o
OBJS-$(CONFIG_SDR2_DEMUXER)
+=
sdr2.o
OBJS-$(CONFIG_SDS_DEMUXER)
+=
sdsdec.o
...
...
libavformat/allformats.c
浏览文件 @
036e12b2
...
...
@@ -273,7 +273,7 @@ void av_register_all(void)
REGISTER_DEMUXER
(
SAMI
,
sami
);
REGISTER_MUXDEMUX
(
SAP
,
sap
);
REGISTER_DEMUXER
(
SBG
,
sbg
);
REGISTER_
DEMUXER
(
SCC
,
scc
);
REGISTER_
MUXDEMUX
(
SCC
,
scc
);
REGISTER_DEMUXER
(
SDP
,
sdp
);
REGISTER_DEMUXER
(
SDR2
,
sdr2
);
REGISTER_DEMUXER
(
SDS
,
sds
);
...
...
libavformat/sccenc.c
0 → 100644
浏览文件 @
036e12b2
/*
* SCC muxer
* Copyright (c) 2017 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include "internal.h"
#include "libavutil/log.h"
#include "libavutil/intreadwrite.h"
typedef
struct
SCCContext
{
int
prev_h
,
prev_m
,
prev_s
,
prev_f
;
int
inside
;
int
n
;
}
SCCContext
;
static
int
scc_write_header
(
AVFormatContext
*
avf
)
{
SCCContext
*
scc
=
avf
->
priv_data
;
if
(
avf
->
nb_streams
!=
1
||
avf
->
streams
[
0
]
->
codecpar
->
codec_type
!=
AVMEDIA_TYPE_SUBTITLE
)
{
av_log
(
avf
,
AV_LOG_ERROR
,
"SCC supports only a single subtitles stream.
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
avf
->
streams
[
0
]
->
codecpar
->
codec_id
!=
AV_CODEC_ID_EIA_608
)
{
av_log
(
avf
,
AV_LOG_ERROR
,
"Unsupported subtitles codec: %s
\n
"
,
avcodec_get_name
(
avf
->
streams
[
0
]
->
codecpar
->
codec_id
));
return
AVERROR
(
EINVAL
);
}
avpriv_set_pts_info
(
avf
->
streams
[
0
],
64
,
1
,
1000
);
avio_printf
(
avf
->
pb
,
"Scenarist_SCC V1.0
\n
"
);
scc
->
prev_h
=
scc
->
prev_m
=
scc
->
prev_s
=
scc
->
prev_f
=
-
1
;
scc
->
inside
=
0
;
return
0
;
}
static
int
scc_write_packet
(
AVFormatContext
*
avf
,
AVPacket
*
pkt
)
{
SCCContext
*
scc
=
avf
->
priv_data
;
int64_t
pts
=
pkt
->
pts
;
int
i
,
h
,
m
,
s
,
f
;
if
(
pts
==
AV_NOPTS_VALUE
)
{
av_log
(
avf
,
AV_LOG_WARNING
,
"Insufficient timestamps.
\n
"
);
return
0
;
}
h
=
(
int
)(
pts
/
(
3600000
));
m
=
(
int
)(
pts
/
(
60000
))
%
60
;
s
=
(
int
)(
pts
/
1000
)
%
60
;
f
=
(
int
)(
pts
%
1000
)
/
33
;
for
(
i
=
0
;
i
<
pkt
->
size
;
i
+=
3
)
{
if
(
pkt
->
data
[
i
]
==
0xfc
&&
((
pkt
->
data
[
i
+
1
]
!=
0x80
||
pkt
->
data
[
i
+
2
]
!=
0x80
)))
break
;
}
if
(
i
>=
pkt
->
size
)
return
0
;
if
(
!
scc
->
inside
&&
(
scc
->
prev_h
!=
h
||
scc
->
prev_m
!=
m
||
scc
->
prev_s
!=
s
||
scc
->
prev_f
!=
f
))
{
avio_printf
(
avf
->
pb
,
"
\n
%02d:%02d:%02d:%02d
\t
"
,
h
,
m
,
s
,
f
);
scc
->
inside
=
1
;
}
for
(
i
=
0
;
i
<
pkt
->
size
;
i
+=
3
)
{
if
(
i
+
3
>
pkt
->
size
)
break
;
if
(
pkt
->
data
[
i
]
!=
0xfc
||
(
pkt
->
data
[
i
+
1
]
==
0x80
&&
pkt
->
data
[
i
+
2
]
==
0x80
))
continue
;
if
(
!
scc
->
inside
)
{
avio_printf
(
avf
->
pb
,
"
\n
%02d:%02d:%02d:%02d
\t
"
,
h
,
m
,
s
,
f
);
scc
->
inside
=
1
;
}
if
(
scc
->
n
>
0
)
avio_printf
(
avf
->
pb
,
" "
);
avio_printf
(
avf
->
pb
,
"%02x%02x"
,
pkt
->
data
[
i
+
1
],
pkt
->
data
[
i
+
2
]);
scc
->
n
++
;
}
if
(
scc
->
inside
&&
(
scc
->
prev_h
!=
h
||
scc
->
prev_m
!=
m
||
scc
->
prev_s
!=
s
||
scc
->
prev_f
!=
f
))
{
avio_printf
(
avf
->
pb
,
"
\n
"
);
scc
->
n
=
0
;
scc
->
inside
=
0
;
}
scc
->
prev_h
=
h
;
scc
->
prev_m
=
m
;
scc
->
prev_s
=
s
;
scc
->
prev_f
=
f
;
return
0
;
}
AVOutputFormat
ff_scc_muxer
=
{
.
name
=
"scc"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Scenarist Closed Captions"
),
.
extensions
=
"scc"
,
.
priv_data_size
=
sizeof
(
SCCContext
),
.
write_header
=
scc_write_header
,
.
write_packet
=
scc_write_packet
,
.
flags
=
AVFMT_GLOBALHEADER
|
AVFMT_VARIABLE_FPS
|
AVFMT_TS_NONSTRICT
,
.
subtitle_codec
=
AV_CODEC_ID_EIA_608
,
};
libavformat/version.h
浏览文件 @
036e12b2
...
...
@@ -32,7 +32,7 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 6
5
#define LIBAVFORMAT_VERSION_MINOR 6
6
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录