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
7322eab4
Commit
7322eab4
authored
Mar 15, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: add hca demuxer
parent
fed0de37
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
1 deletion
+128
-1
Changelog
Changelog
+1
-0
Makefile
libavformat/Makefile
+1
-0
allformats.c
libavformat/allformats.c
+1
-0
hca.c
libavformat/hca.c
+124
-0
version.h
libavformat/version.h
+1
-1
No files found.
Changelog
View file @
7322eab4
...
...
@@ -53,6 +53,7 @@ version <next>:
- DERF DPCM decoder
- DERF demuxer
- CRI HCA decoder
- CRI HCA demuxer
version 4.2:
...
...
libavformat/Makefile
View file @
7322eab4
...
...
@@ -224,6 +224,7 @@ OBJS-$(CONFIG_H263_MUXER) += rawenc.o
OBJS-$(CONFIG_H264_DEMUXER)
+=
h264dec.o
rawdec.o
OBJS-$(CONFIG_H264_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_HASH_MUXER)
+=
hashenc.o
OBJS-$(CONFIG_HCA_DEMUXER)
+=
hca.o
OBJS-$(CONFIG_HCOM_DEMUXER)
+=
hcom.o
pcm.o
OBJS-$(CONFIG_HDS_MUXER)
+=
hdsenc.o
OBJS-$(CONFIG_HEVC_DEMUXER)
+=
hevcdec.o
rawdec.o
...
...
libavformat/allformats.c
View file @
7322eab4
...
...
@@ -182,6 +182,7 @@ extern AVOutputFormat ff_h263_muxer;
extern
AVInputFormat
ff_h264_demuxer
;
extern
AVOutputFormat
ff_h264_muxer
;
extern
AVOutputFormat
ff_hash_muxer
;
extern
AVInputFormat
ff_hca_demuxer
;
extern
AVInputFormat
ff_hcom_demuxer
;
extern
AVOutputFormat
ff_hds_muxer
;
extern
AVInputFormat
ff_hevc_demuxer
;
...
...
libavformat/hca.c
0 → 100644
View file @
7322eab4
/*
* HCA demuxer
* Copyright (c) 2020 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 "libavcodec/bytestream.h"
#include "avformat.h"
#include "internal.h"
static
int
hca_probe
(
const
AVProbeData
*
p
)
{
if
(
AV_RL32
(
p
->
buf
)
!=
MKTAG
(
'H'
,
'C'
,
'A'
,
0
))
return
0
;
if
(
AV_RL32
(
p
->
buf
+
8
)
!=
MKTAG
(
'f'
,
'm'
,
't'
,
0
))
return
0
;
return
AVPROBE_SCORE_MAX
/
3
;
}
static
int
hca_read_header
(
AVFormatContext
*
s
)
{
AVCodecParameters
*
par
;
GetByteContext
gb
;
AVIOContext
*
pb
=
s
->
pb
;
AVStream
*
st
;
uint32_t
chunk
;
uint16_t
version
;
uint32_t
block_count
;
uint16_t
block_size
;
int
ret
;
avio_skip
(
pb
,
4
);
version
=
avio_rb16
(
pb
);
s
->
internal
->
data_offset
=
avio_rb16
(
pb
);
if
(
s
->
internal
->
data_offset
<=
8
)
return
AVERROR_INVALIDDATA
;
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
par
=
st
->
codecpar
;
ret
=
ff_alloc_extradata
(
par
,
s
->
internal
->
data_offset
);
if
(
ret
<
0
)
return
ret
;
ret
=
avio_read
(
pb
,
par
->
extradata
+
8
,
par
->
extradata_size
-
8
);
if
(
ret
<
par
->
extradata_size
-
8
)
return
AVERROR
(
EIO
);
AV_WL32
(
par
->
extradata
,
MKTAG
(
'H'
,
'C'
,
'A'
,
0
));
AV_WB16
(
par
->
extradata
+
4
,
version
);
AV_WB16
(
par
->
extradata
+
6
,
s
->
internal
->
data_offset
);
bytestream2_init
(
&
gb
,
par
->
extradata
+
8
,
par
->
extradata_size
-
8
);
if
(
bytestream2_get_le32
(
&
gb
)
!=
MKTAG
(
'f'
,
'm'
,
't'
,
0
))
return
AVERROR_INVALIDDATA
;
par
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
par
->
codec_id
=
AV_CODEC_ID_HCA
;
par
->
codec_tag
=
0
;
par
->
channels
=
bytestream2_get_byte
(
&
gb
);
par
->
sample_rate
=
bytestream2_get_be24
(
&
gb
);
block_count
=
bytestream2_get_be32
(
&
gb
);
bytestream2_skip
(
&
gb
,
4
);
chunk
=
bytestream2_get_le32
(
&
gb
);
if
(
chunk
==
MKTAG
(
'c'
,
'o'
,
'm'
,
'p'
))
{
block_size
=
bytestream2_get_be16
(
&
gb
);
}
else
if
(
chunk
==
MKTAG
(
'd'
,
'e'
,
'c'
,
0
))
{
block_size
=
bytestream2_get_be16
(
&
gb
);
}
else
{
return
AVERROR_INVALIDDATA
;
}
if
(
block_size
<
8
)
return
AVERROR_INVALIDDATA
;
par
->
block_align
=
block_size
;
st
->
duration
=
1024
*
block_count
;
avio_seek
(
pb
,
s
->
internal
->
data_offset
,
SEEK_SET
);
avpriv_set_pts_info
(
st
,
64
,
1
,
par
->
sample_rate
);
return
0
;
}
static
int
hca_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
AVCodecParameters
*
par
=
s
->
streams
[
0
]
->
codecpar
;
int
ret
;
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
par
->
block_align
);
pkt
->
duration
=
1024
;
return
ret
;
}
AVInputFormat
ff_hca_demuxer
=
{
.
name
=
"hca"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"CRI HCA"
),
.
read_probe
=
hca_probe
,
.
read_header
=
hca_read_header
,
.
read_packet
=
hca_read_packet
,
.
extensions
=
"hca"
,
.
flags
=
AVFMT_GENERIC_INDEX
,
};
libavformat/version.h
View file @
7322eab4
...
...
@@ -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 58
#define LIBAVFORMAT_VERSION_MINOR 4
1
#define LIBAVFORMAT_VERSION_MINOR 4
2
#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