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
2d720069
Commit
2d720069
authored
Apr 05, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: add aix demuxer
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
6d7f5667
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
144 additions
and
1 deletion
+144
-1
Changelog
Changelog
+1
-0
Makefile
libavformat/Makefile
+1
-0
aixdec.c
libavformat/aixdec.c
+140
-0
allformats.c
libavformat/allformats.c
+1
-0
version.h
libavformat/version.h
+1
-1
No files found.
Changelog
View file @
2d720069
...
...
@@ -20,6 +20,7 @@ version <next>:
- bitstream filter for extracting DTS core
- ADPCM IMA DAT4 decoder
- musx demuxer
- aix demuxer
version 3.0:
- Common Encryption (CENC) MP4 encoding and decoding support
...
...
libavformat/Makefile
View file @
2d720069
...
...
@@ -82,6 +82,7 @@ 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
id3v2enc.o
OBJS-$(CONFIG_AIX_DEMUXER)
+=
aixdec.o
OBJS-$(CONFIG_AMR_DEMUXER)
+=
amr.o
OBJS-$(CONFIG_AMR_MUXER)
+=
amr.o
OBJS-$(CONFIG_ANM_DEMUXER)
+=
anm.o
...
...
libavformat/aixdec.c
0 → 100644
View file @
2d720069
/*
* AIX demuxer
* Copyright (c) 2016 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"
static
int
aix_probe
(
AVProbeData
*
p
)
{
if
(
AV_RL32
(
p
->
buf
)
!=
MKTAG
(
'A'
,
'I'
,
'X'
,
'F'
)
||
AV_RB32
(
p
->
buf
+
8
)
!=
0x01000014
||
AV_RB32
(
p
->
buf
+
12
)
!=
0x00000800
)
return
0
;
return
AVPROBE_SCORE_MAX
;
}
static
int
aix_read_header
(
AVFormatContext
*
s
)
{
unsigned
nb_streams
,
first_offset
,
nb_segments
;
unsigned
stream_list_offset
;
unsigned
segment_list_offset
=
0x20
;
unsigned
segment_list_entry_size
=
0x10
;
unsigned
size
;
int
i
;
avio_skip
(
s
->
pb
,
4
);
first_offset
=
avio_rb32
(
s
->
pb
)
+
8
;
avio_skip
(
s
->
pb
,
16
);
nb_segments
=
avio_rb16
(
s
->
pb
);
if
(
nb_segments
==
0
)
return
AVERROR_INVALIDDATA
;
stream_list_offset
=
segment_list_offset
+
segment_list_entry_size
*
nb_segments
+
0x10
;
if
(
stream_list_offset
>=
first_offset
)
return
AVERROR_INVALIDDATA
;
avio_seek
(
s
->
pb
,
stream_list_offset
,
SEEK_SET
);
nb_streams
=
avio_r8
(
s
->
pb
);
if
(
nb_streams
==
0
)
return
AVERROR_INVALIDDATA
;
avio_skip
(
s
->
pb
,
7
);
for
(
i
=
0
;
i
<
nb_streams
;
i
++
)
{
AVStream
*
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_ADX
;
st
->
codec
->
sample_rate
=
avio_rb32
(
s
->
pb
);
st
->
codec
->
channels
=
avio_r8
(
s
->
pb
);
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
avio_skip
(
s
->
pb
,
3
);
}
avio_seek
(
s
->
pb
,
first_offset
,
SEEK_SET
);
for
(
i
=
0
;
i
<
nb_streams
;
i
++
)
{
if
(
avio_rl32
(
s
->
pb
)
!=
MKTAG
(
'A'
,
'I'
,
'X'
,
'P'
))
return
AVERROR_INVALIDDATA
;
size
=
avio_rb32
(
s
->
pb
);
if
(
size
<=
8
)
return
AVERROR_INVALIDDATA
;
avio_skip
(
s
->
pb
,
8
);
ff_get_extradata
(
s
->
streams
[
i
]
->
codec
,
s
->
pb
,
size
-
8
);
}
return
0
;
}
static
int
aix_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
unsigned
size
,
index
,
duration
,
chunk
;
int64_t
pos
;
int
sequence
,
ret
,
i
;
pos
=
avio_tell
(
s
->
pb
);
if
(
avio_feof
(
s
->
pb
))
return
AVERROR_EOF
;
chunk
=
avio_rl32
(
s
->
pb
);
size
=
avio_rb32
(
s
->
pb
);
if
(
chunk
==
MKTAG
(
'A'
,
'I'
,
'X'
,
'E'
))
{
avio_skip
(
s
->
pb
,
size
);
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
if
(
avio_feof
(
s
->
pb
))
return
AVERROR_EOF
;
chunk
=
avio_rl32
(
s
->
pb
);
size
=
avio_rb32
(
s
->
pb
);
avio_skip
(
s
->
pb
,
size
);
}
pos
=
avio_tell
(
s
->
pb
);
chunk
=
avio_rl32
(
s
->
pb
);
size
=
avio_rb32
(
s
->
pb
);
}
if
(
chunk
!=
MKTAG
(
'A'
,
'I'
,
'X'
,
'P'
))
return
AVERROR_INVALIDDATA
;
if
(
size
<=
8
)
return
AVERROR_INVALIDDATA
;
index
=
avio_r8
(
s
->
pb
);
if
(
avio_r8
(
s
->
pb
)
!=
s
->
nb_streams
||
index
>=
s
->
nb_streams
)
return
AVERROR_INVALIDDATA
;
duration
=
avio_rb16
(
s
->
pb
);
sequence
=
avio_rb32
(
s
->
pb
);
if
(
sequence
<
0
)
{
avio_skip
(
s
->
pb
,
size
-
8
);
return
0
;
}
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
size
-
8
);
pkt
->
stream_index
=
index
;
pkt
->
duration
=
duration
;
pkt
->
pos
=
pos
;
return
ret
;
}
AVInputFormat
ff_aix_demuxer
=
{
.
name
=
"aix"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"CRI AIX"
),
.
read_probe
=
aix_probe
,
.
read_header
=
aix_read_header
,
.
read_packet
=
aix_read_packet
,
.
extensions
=
"aix"
,
.
flags
=
AVFMT_GENERIC_INDEX
,
};
libavformat/allformats.c
View file @
2d720069
...
...
@@ -66,6 +66,7 @@ void av_register_all(void)
REGISTER_DEMUXER
(
AEA
,
aea
);
REGISTER_DEMUXER
(
AFC
,
afc
);
REGISTER_MUXDEMUX
(
AIFF
,
aiff
);
REGISTER_DEMUXER
(
AIX
,
aix
);
REGISTER_MUXDEMUX
(
AMR
,
amr
);
REGISTER_DEMUXER
(
ANM
,
anm
);
REGISTER_DEMUXER
(
APC
,
apc
);
...
...
libavformat/version.h
View file @
2d720069
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 3
0
#define LIBAVFORMAT_VERSION_MINOR 3
1
#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