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
9fb8c5d8
Commit
9fb8c5d8
authored
Nov 11, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: add VPK demuxer
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
183827e6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
2 deletions
+121
-2
Changelog
Changelog
+1
-1
general.texi
doc/general.texi
+2
-0
Makefile
libavformat/Makefile
+1
-0
allformats.c
libavformat/allformats.c
+1
-0
version.h
libavformat/version.h
+1
-1
vpk.c
libavformat/vpk.c
+115
-0
No files found.
Changelog
View file @
9fb8c5d8
...
@@ -20,7 +20,7 @@ version <next>:
...
@@ -20,7 +20,7 @@ version <next>:
- selectivecolor filter
- selectivecolor filter
- extensive native AAC encoder improvements
- extensive native AAC encoder improvements
- ADPCM PSX decoder
- ADPCM PSX decoder
- 3dostr, dcstr, genh, vag, xvag, ads, msf
& svag
demuxer
- 3dostr, dcstr, genh, vag, xvag, ads, msf
, svag & vpk
demuxer
- zscale filter
- zscale filter
- wve demuxer
- wve demuxer
- zero-copy Intel QSV transcoding in ffmpeg
- zero-copy Intel QSV transcoding in ffmpeg
...
...
doc/general.texi
View file @
9fb8c5d8
...
@@ -521,6 +521,8 @@ library:
...
@@ -521,6 +521,8 @@ library:
@item VC-1 test bitstream @tab X @tab X
@item VC-1 test bitstream @tab X @tab X
@item Vidvox Hap @tab X @tab X
@item Vidvox Hap @tab X @tab X
@item Vivo @tab @tab X
@item Vivo @tab @tab X
@item VPK @tab @tab X
@tab Audio format used in Sony PS games.
@item WAV @tab X @tab X
@item WAV @tab X @tab X
@item WavPack @tab X @tab X
@item WavPack @tab X @tab X
@item WebM @tab X @tab X
@item WebM @tab X @tab X
...
...
libavformat/Makefile
View file @
9fb8c5d8
...
@@ -460,6 +460,7 @@ OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o
...
@@ -460,6 +460,7 @@ OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o
OBJS-$(CONFIG_VOBSUB_DEMUXER)
+=
subtitles.o
# mpeg demuxer is in the dependencies
OBJS-$(CONFIG_VOBSUB_DEMUXER)
+=
subtitles.o
# mpeg demuxer is in the dependencies
OBJS-$(CONFIG_VOC_DEMUXER)
+=
vocdec.o
voc.o
OBJS-$(CONFIG_VOC_DEMUXER)
+=
vocdec.o
voc.o
OBJS-$(CONFIG_VOC_MUXER)
+=
vocenc.o
voc.o
OBJS-$(CONFIG_VOC_MUXER)
+=
vocenc.o
voc.o
OBJS-$(CONFIG_VPK_DEMUXER)
+=
vpk.o
OBJS-$(CONFIG_VPLAYER_DEMUXER)
+=
vplayerdec.o
subtitles.o
OBJS-$(CONFIG_VPLAYER_DEMUXER)
+=
vplayerdec.o
subtitles.o
OBJS-$(CONFIG_VQF_DEMUXER)
+=
vqf.o
OBJS-$(CONFIG_VQF_DEMUXER)
+=
vqf.o
OBJS-$(CONFIG_W64_DEMUXER)
+=
wavdec.o
w64.o
pcm.o
OBJS-$(CONFIG_W64_DEMUXER)
+=
wavdec.o
w64.o
pcm.o
...
...
libavformat/allformats.c
View file @
9fb8c5d8
...
@@ -324,6 +324,7 @@ void av_register_all(void)
...
@@ -324,6 +324,7 @@ void av_register_all(void)
REGISTER_DEMUXER
(
VMD
,
vmd
);
REGISTER_DEMUXER
(
VMD
,
vmd
);
REGISTER_DEMUXER
(
VOBSUB
,
vobsub
);
REGISTER_DEMUXER
(
VOBSUB
,
vobsub
);
REGISTER_MUXDEMUX
(
VOC
,
voc
);
REGISTER_MUXDEMUX
(
VOC
,
voc
);
REGISTER_DEMUXER
(
VPK
,
vpk
);
REGISTER_DEMUXER
(
VPLAYER
,
vplayer
);
REGISTER_DEMUXER
(
VPLAYER
,
vplayer
);
REGISTER_DEMUXER
(
VQF
,
vqf
);
REGISTER_DEMUXER
(
VQF
,
vqf
);
REGISTER_MUXDEMUX
(
W64
,
w64
);
REGISTER_MUXDEMUX
(
W64
,
w64
);
...
...
libavformat/version.h
View file @
9fb8c5d8
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 1
5
#define LIBAVFORMAT_VERSION_MINOR 1
6
#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, \
...
...
libavformat/vpk.c
0 → 100644
View file @
9fb8c5d8
/*
* VPK demuxer
* Copyright (c) 2015 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 "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
typedef
struct
VPKDemuxContext
{
unsigned
block_count
;
unsigned
current_block
;
unsigned
last_block_size
;
}
VPKDemuxContext
;
static
int
vpk_probe
(
AVProbeData
*
p
)
{
if
(
AV_RL32
(
p
->
buf
)
!=
MKBETAG
(
'V'
,
'P'
,
'K'
,
' '
))
return
0
;
return
AVPROBE_SCORE_MAX
/
3
*
2
;
}
static
int
vpk_read_header
(
AVFormatContext
*
s
)
{
VPKDemuxContext
*
vpk
=
s
->
priv_data
;
unsigned
offset
;
unsigned
samples_per_block
;
AVStream
*
st
;
vpk
->
current_block
=
0
;
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
avio_skip
(
s
->
pb
,
4
);
st
->
duration
=
avio_rl32
(
s
->
pb
)
*
28
/
16
;
offset
=
avio_rl32
(
s
->
pb
);
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_ADPCM_PSX
;
st
->
codec
->
block_align
=
avio_rl32
(
s
->
pb
);
st
->
codec
->
sample_rate
=
avio_rl32
(
s
->
pb
);
if
(
st
->
codec
->
sample_rate
<=
0
)
return
AVERROR_INVALIDDATA
;
st
->
codec
->
channels
=
avio_rl32
(
s
->
pb
);
if
(
st
->
codec
->
channels
<=
0
)
return
AVERROR_INVALIDDATA
;
samples_per_block
=
((
st
->
codec
->
block_align
/
st
->
codec
->
channels
)
*
28
)
/
16
;
vpk
->
block_count
=
(
st
->
duration
+
(
samples_per_block
-
1
))
/
samples_per_block
;
vpk
->
last_block_size
=
(
st
->
duration
%
samples_per_block
)
*
16
*
st
->
codec
->
channels
/
28
;
avio_skip
(
s
->
pb
,
offset
-
avio_tell
(
s
->
pb
));
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
return
0
;
}
static
int
vpk_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
AVCodecContext
*
codec
=
s
->
streams
[
0
]
->
codec
;
VPKDemuxContext
*
vpk
=
s
->
priv_data
;
int
ret
,
i
;
vpk
->
current_block
++
;
if
(
vpk
->
current_block
==
vpk
->
block_count
)
{
unsigned
size
=
vpk
->
last_block_size
/
codec
->
channels
;
unsigned
skip
=
(
codec
->
block_align
-
vpk
->
last_block_size
)
/
codec
->
channels
;
ret
=
av_new_packet
(
pkt
,
vpk
->
last_block_size
);
if
(
ret
<
0
)
return
ret
;
for
(
i
=
0
;
i
<
codec
->
channels
;
i
++
)
{
ret
=
avio_read
(
s
->
pb
,
pkt
->
data
+
i
*
size
,
size
);
avio_skip
(
s
->
pb
,
skip
);
if
(
ret
!=
size
)
{
av_packet_unref
(
pkt
);
ret
=
AVERROR
(
EIO
);
break
;
}
}
pkt
->
stream_index
=
0
;
}
else
if
(
vpk
->
current_block
<
vpk
->
block_count
)
{
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
codec
->
block_align
);
pkt
->
stream_index
=
0
;
}
else
{
return
AVERROR_EOF
;
}
return
ret
;
}
AVInputFormat
ff_vpk_demuxer
=
{
.
name
=
"vpk"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Sony PS2 VPK"
),
.
priv_data_size
=
sizeof
(
VPKDemuxContext
),
.
read_probe
=
vpk_probe
,
.
read_header
=
vpk_read_header
,
.
read_packet
=
vpk_read_packet
,
.
extensions
=
"vpk"
,
};
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