Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7dd2005e
Commit
7dd2005e
authored
Sep 24, 2014
by
wm4
Committed by
Clément Bœsch
Sep 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: add SUP/PGS subtitle demuxer
Signed-off-by:
Clément Bœsch
<
u@pkh.me
>
parent
1ea7a3e0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
1 deletion
+114
-1
Changelog
Changelog
+1
-0
general.texi
doc/general.texi
+1
-0
Makefile
libavformat/Makefile
+1
-0
allformats.c
libavformat/allformats.c
+1
-0
supdec.c
libavformat/supdec.c
+109
-0
version.h
libavformat/version.h
+1
-1
No files found.
Changelog
View file @
7dd2005e
...
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
...
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
version <next>:
version <next>:
- HEVC/H.265 RTP payload format (draft v6) packetizer
- HEVC/H.265 RTP payload format (draft v6) packetizer
- SUP/PGS subtitle demuxer
version 2.4:
version 2.4:
- Icecast protocol
- Icecast protocol
...
...
doc/general.texi
View file @
7dd2005e
...
@@ -454,6 +454,7 @@ library:
...
@@ -454,6 +454,7 @@ library:
@item Sony Wave64 (W64) @tab X @tab X
@item Sony Wave64 (W64) @tab X @tab X
@item SoX native format @tab X @tab X
@item SoX native format @tab X @tab X
@item SUN AU format @tab X @tab X
@item SUN AU format @tab X @tab X
@item SUP raw PGS subtitles @tab @tab X
@item Text files @tab @tab X
@item Text files @tab @tab X
@item THP @tab @tab X
@item THP @tab @tab X
@tab Used on the Nintendo GameCube.
@tab Used on the Nintendo GameCube.
...
...
libavformat/Makefile
View file @
7dd2005e
...
@@ -407,6 +407,7 @@ OBJS-$(CONFIG_SRT_MUXER) += srtenc.o
...
@@ -407,6 +407,7 @@ OBJS-$(CONFIG_SRT_MUXER) += srtenc.o
OBJS-$(CONFIG_STR_DEMUXER)
+=
psxstr.o
OBJS-$(CONFIG_STR_DEMUXER)
+=
psxstr.o
OBJS-$(CONFIG_SUBVIEWER1_DEMUXER)
+=
subviewer1dec.o
subtitles.o
OBJS-$(CONFIG_SUBVIEWER1_DEMUXER)
+=
subviewer1dec.o
subtitles.o
OBJS-$(CONFIG_SUBVIEWER_DEMUXER)
+=
subviewerdec.o
subtitles.o
OBJS-$(CONFIG_SUBVIEWER_DEMUXER)
+=
subviewerdec.o
subtitles.o
OBJS-$(CONFIG_SUP_DEMUXER)
+=
supdec.o
OBJS-$(CONFIG_SWF_DEMUXER)
+=
swfdec.o
swf.o
OBJS-$(CONFIG_SWF_DEMUXER)
+=
swfdec.o
swf.o
OBJS-$(CONFIG_SWF_MUXER)
+=
swfenc.o
swf.o
OBJS-$(CONFIG_SWF_MUXER)
+=
swfenc.o
swf.o
OBJS-$(CONFIG_TAK_DEMUXER)
+=
takdec.o
apetag.o
img2.o
rawdec.o
OBJS-$(CONFIG_TAK_DEMUXER)
+=
takdec.o
apetag.o
img2.o
rawdec.o
...
...
libavformat/allformats.c
View file @
7dd2005e
...
@@ -280,6 +280,7 @@ void av_register_all(void)
...
@@ -280,6 +280,7 @@ void av_register_all(void)
REGISTER_DEMUXER
(
STR
,
str
);
REGISTER_DEMUXER
(
STR
,
str
);
REGISTER_DEMUXER
(
SUBVIEWER1
,
subviewer1
);
REGISTER_DEMUXER
(
SUBVIEWER1
,
subviewer1
);
REGISTER_DEMUXER
(
SUBVIEWER
,
subviewer
);
REGISTER_DEMUXER
(
SUBVIEWER
,
subviewer
);
REGISTER_DEMUXER
(
SUP
,
sup
);
REGISTER_MUXDEMUX
(
SWF
,
swf
);
REGISTER_MUXDEMUX
(
SWF
,
swf
);
REGISTER_DEMUXER
(
TAK
,
tak
);
REGISTER_DEMUXER
(
TAK
,
tak
);
REGISTER_MUXER
(
TEE
,
tee
);
REGISTER_MUXER
(
TEE
,
tee
);
...
...
libavformat/supdec.c
0 → 100644
View file @
7dd2005e
/*
* 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/intreadwrite.h"
#define SUP_PGS_MAGIC 0x5047
/* "PG", big endian */
static
int
sup_read_header
(
AVFormatContext
*
s
)
{
AVStream
*
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_SUBTITLE
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_HDMV_PGS_SUBTITLE
;
avpriv_set_pts_info
(
st
,
32
,
1
,
90000
);
return
0
;
}
static
int
sup_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
int64_t
pts
,
dts
,
pos
;
int
ret
;
pos
=
avio_tell
(
s
->
pb
);
if
(
avio_rb16
(
s
->
pb
)
!=
SUP_PGS_MAGIC
)
return
avio_feof
(
s
->
pb
)
?
AVERROR_EOF
:
AVERROR_INVALIDDATA
;
pts
=
avio_rb32
(
s
->
pb
);
dts
=
avio_rb32
(
s
->
pb
);
if
((
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
3
))
<
0
)
return
ret
;
pkt
->
stream_index
=
0
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
pos
=
pos
;
pkt
->
pts
=
pts
;
// Many files have DTS set to 0 for all packets, so assume 0 means unset.
pkt
->
dts
=
dts
?
dts
:
AV_NOPTS_VALUE
;
if
(
pkt
->
size
>=
3
)
{
// The full packet size is stored as part of the packet.
size_t
len
=
AV_RB16
(
pkt
->
data
+
1
);
if
((
ret
=
av_append_packet
(
s
->
pb
,
pkt
,
len
))
<
0
)
return
ret
;
}
return
0
;
}
static
int
sup_probe
(
AVProbeData
*
p
)
{
unsigned
char
*
buf
=
p
->
buf
;
size_t
buf_size
=
p
->
buf_size
;
int
nb_packets
;
for
(
nb_packets
=
0
;
nb_packets
<
10
;
nb_packets
++
)
{
size_t
full_packet_size
;
if
(
buf_size
<
10
+
3
)
break
;
if
(
AV_RB16
(
buf
)
!=
SUP_PGS_MAGIC
)
return
0
;
full_packet_size
=
AV_RB16
(
buf
+
10
+
1
)
+
10
+
3
;
if
(
buf_size
<
full_packet_size
)
break
;
buf
+=
full_packet_size
;
buf_size
-=
full_packet_size
;
}
if
(
!
nb_packets
)
return
0
;
if
(
nb_packets
<
2
)
return
AVPROBE_SCORE_RETRY
/
2
;
if
(
nb_packets
<
4
)
return
AVPROBE_SCORE_RETRY
;
if
(
nb_packets
<
10
)
return
AVPROBE_SCORE_EXTENSION
;
return
AVPROBE_SCORE_MAX
;
}
AVInputFormat
ff_sup_demuxer
=
{
.
name
=
"sup"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"raw HDMV Presentation Graphic Stream subtitles"
),
.
extensions
=
"sup"
,
.
mime_type
=
"application/x-pgs"
,
.
read_probe
=
sup_probe
,
.
read_header
=
sup_read_header
,
.
read_packet
=
sup_read_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
,
};
libavformat/version.h
View file @
7dd2005e
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR
6
#define LIBAVFORMAT_VERSION_MINOR
7
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment