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
51d68799
Commit
51d68799
authored
Nov 26, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AFC demuxer
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
10c8f913
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
3 deletions
+103
-3
general.texi
doc/general.texi
+2
-0
adpcm.c
libavcodec/adpcm.c
+17
-2
Makefile
libavformat/Makefile
+1
-0
afc.c
libavformat/afc.c
+81
-0
allformats.c
libavformat/allformats.c
+1
-0
version.h
libavformat/version.h
+1
-1
No files found.
doc/general.texi
View file @
51d68799
...
...
@@ -147,6 +147,8 @@ library:
@tab Multimedia format used in game Heart Of Darkness.
@item Apple HTTP Live Streaming @tab @tab X
@item Artworx Data Format @tab @tab X
@item AFC @tab @tab X
@tab Audio format used on the Nintendo Gamecube.
@item ASF @tab X @tab X
@item AST @tab @tab X
@tab Audio format used on the Nintendo Wii.
...
...
libavcodec/adpcm.c
View file @
51d68799
...
...
@@ -1268,13 +1268,26 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break
;
case
AV_CODEC_ID_ADPCM_AFC
:
{
int
samples_per_block
;
int
blocks
;
if
(
avctx
->
extradata
&&
avctx
->
extradata_size
==
1
&&
avctx
->
extradata
[
0
])
{
samples_per_block
=
avctx
->
extradata
[
0
]
/
16
;
blocks
=
nb_samples
/
avctx
->
extradata
[
0
];
}
else
{
samples_per_block
=
nb_samples
/
16
;
blocks
=
1
;
}
for
(
m
=
0
;
m
<
blocks
;
m
++
)
{
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
int
prev1
=
c
->
status
[
channel
].
sample1
;
int
prev2
=
c
->
status
[
channel
].
sample2
;
samples
=
samples_p
[
channel
];
samples
=
samples_p
[
channel
]
+
m
*
16
;
/* Read in every sample for this channel. */
for
(
i
=
0
;
i
<
nb_samples
/
16
;
i
++
)
{
for
(
i
=
0
;
i
<
samples_per_block
;
i
++
)
{
int
byte
=
bytestream2_get_byteu
(
&
gb
);
int
scale
=
1
<<
(
byte
>>
4
);
int
index
=
byte
&
0xf
;
...
...
@@ -1303,8 +1316,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
c
->
status
[
channel
].
sample1
=
prev1
;
c
->
status
[
channel
].
sample2
=
prev2
;
}
}
bytestream2_seek
(
&
gb
,
0
,
SEEK_END
);
break
;
}
case
AV_CODEC_ID_ADPCM_THP
:
{
int
table
[
6
][
16
];
...
...
libavformat/Makefile
View file @
51d68799
...
...
@@ -37,6 +37,7 @@ OBJS-$(CONFIG_ADX_DEMUXER) += adxdec.o
OBJS-$(CONFIG_ADX_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_ADTS_MUXER)
+=
adtsenc.o
OBJS-$(CONFIG_AEA_DEMUXER)
+=
aea.o
pcm.o
OBJS-$(CONFIG_AFC_DEMUXER)
+=
afc.o
OBJS-$(CONFIG_AIFF_DEMUXER)
+=
aiffdec.o
pcm.o
isom.o
\
mov_chan.o
OBJS-$(CONFIG_AIFF_MUXER)
+=
aiffenc.o
isom.o
...
...
libavformat/afc.c
0 → 100644
View file @
51d68799
/*
* AFC demuxer
* Copyright (c) 2012 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/channel_layout.h"
#include "avformat.h"
#include "internal.h"
typedef
struct
AFCDemuxContext
{
int64_t
data_end
;
}
AFCDemuxContext
;
static
int
afc_read_header
(
AVFormatContext
*
s
)
{
AFCDemuxContext
*
c
=
s
->
priv_data
;
AVStream
*
st
;
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_ADPCM_AFC
;
st
->
codec
->
channels
=
2
;
st
->
codec
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
st
->
codec
->
extradata_size
=
1
;
st
->
codec
->
extradata
=
av_mallocz
(
1
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
st
->
codec
->
extradata
)
return
AVERROR
(
ENOMEM
);
st
->
codec
->
extradata
[
0
]
=
8
*
st
->
codec
->
channels
;
c
->
data_end
=
avio_rb32
(
s
->
pb
)
+
32LL
;
st
->
duration
=
avio_rb32
(
s
->
pb
);
st
->
codec
->
sample_rate
=
avio_rb16
(
s
->
pb
);
avio_skip
(
s
->
pb
,
22
);
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
return
0
;
}
static
int
afc_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
AFCDemuxContext
*
c
=
s
->
priv_data
;
int64_t
size
;
int
ret
;
size
=
FFMIN
(
c
->
data_end
-
avio_tell
(
s
->
pb
),
18
*
128
);
if
(
size
<=
0
)
return
AVERROR_EOF
;
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
size
);
pkt
->
stream_index
=
0
;
return
ret
;
}
AVInputFormat
ff_afc_demuxer
=
{
.
name
=
"afc"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"AFC"
),
.
priv_data_size
=
sizeof
(
AFCDemuxContext
),
.
read_header
=
afc_read_header
,
.
read_packet
=
afc_read_packet
,
.
extensions
=
"afc"
,
.
flags
=
AVFMT_NOBINSEARCH
|
AVFMT_NOGENSEARCH
|
AVFMT_NO_BYTE_SEEK
,
};
libavformat/allformats.c
View file @
51d68799
...
...
@@ -57,6 +57,7 @@ void av_register_all(void)
REGISTER_MUXER
(
ADTS
,
adts
);
REGISTER_MUXDEMUX
(
ADX
,
adx
);
REGISTER_DEMUXER
(
AEA
,
aea
);
REGISTER_DEMUXER
(
AFC
,
afc
);
REGISTER_MUXDEMUX
(
AIFF
,
aiff
);
REGISTER_MUXDEMUX
(
AMR
,
amr
);
REGISTER_DEMUXER
(
ANM
,
anm
);
...
...
libavformat/version.h
View file @
51d68799
...
...
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 3
7
#define LIBAVFORMAT_VERSION_MINOR 3
8
#define LIBAVFORMAT_VERSION_MICRO 100
#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