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
32a6d37a
Commit
32a6d37a
authored
Oct 03, 2015
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/mlpdec: Simplify mlp/thd probe function.
Move the demuxers into their own file.
parent
e306e436
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
62 deletions
+87
-62
Makefile
libavformat/Makefile
+2
-2
mlpdec.c
libavformat/mlpdec.c
+85
-0
rawdec.c
libavformat/rawdec.c
+0
-60
No files found.
libavformat/Makefile
View file @
32a6d37a
...
...
@@ -251,7 +251,7 @@ OBJS-$(CONFIG_MICRODVD_DEMUXER) += microdvddec.o subtitles.o
OBJS-$(CONFIG_MICRODVD_MUXER)
+=
microdvdenc.o
OBJS-$(CONFIG_MJPEG_DEMUXER)
+=
rawdec.o
OBJS-$(CONFIG_MJPEG_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_MLP_DEMUXER)
+=
rawdec.o
OBJS-$(CONFIG_MLP_DEMUXER)
+=
rawdec.o
mlpdec.o
OBJS-$(CONFIG_MLP_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_MLV_DEMUXER)
+=
mlvdec.o
riffdec.o
OBJS-$(CONFIG_MM_DEMUXER)
+=
mm.o
...
...
@@ -434,7 +434,7 @@ OBJS-$(CONFIG_THP_DEMUXER) += thp.o
OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER)
+=
tiertexseq.o
OBJS-$(CONFIG_MKVTIMESTAMP_V2_MUXER)
+=
mkvtimestamp_v2.o
OBJS-$(CONFIG_TMV_DEMUXER)
+=
tmv.o
OBJS-$(CONFIG_TRUEHD_DEMUXER)
+=
rawdec.o
OBJS-$(CONFIG_TRUEHD_DEMUXER)
+=
rawdec.o
mlpdec.o
OBJS-$(CONFIG_TRUEHD_MUXER)
+=
rawenc.o
OBJS-$(CONFIG_TTA_DEMUXER)
+=
tta.o
apetag.o
img2.o
OBJS-$(CONFIG_TTY_DEMUXER)
+=
tty.o
sauce.o
...
...
libavformat/mlpdec.c
0 → 100644
View file @
32a6d37a
/*
* MLP and TrueHD demuxer
* Copyright (c) 2001 Fabrice Bellard
* Copyright (c) 2005 Alex Beregszaszi
* Copyright (c) 2015 Carl Eugen Hoyos
*
* 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 "rawdec.h"
#include "libavutil/intreadwrite.h"
static
int
av_always_inline
mlp_thd_probe
(
AVProbeData
*
p
,
uint32_t
sync
)
{
const
uint8_t
*
buf
,
*
last_buf
=
p
->
buf
,
*
end
=
p
->
buf
+
p
->
buf_size
;
int
frames
=
0
,
valid
=
0
,
size
=
0
;
for
(
buf
=
p
->
buf
;
buf
+
8
<=
end
;
buf
++
)
{
if
(
AV_RB32
(
buf
+
4
)
==
sync
)
{
frames
++
;
if
(
last_buf
+
size
==
buf
)
{
valid
++
;
}
last_buf
=
buf
;
size
=
(
AV_RB16
(
buf
)
&
0xfff
)
*
2
;
}
else
if
(
buf
-
last_buf
==
size
)
{
size
+=
(
AV_RB16
(
buf
)
&
0xfff
)
*
2
;
}
}
if
(
valid
>=
100
)
return
AVPROBE_SCORE_MAX
;
return
0
;
}
#if CONFIG_MLP_DEMUXER
static
int
mlp_probe
(
AVProbeData
*
p
)
{
return
mlp_thd_probe
(
p
,
0xf8726fbb
);
}
AVInputFormat
ff_mlp_demuxer
=
{
.
name
=
"mlp"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"raw MLP"
),
.
read_probe
=
mlp_probe
,
.
read_header
=
ff_raw_audio_read_header
,
.
read_packet
=
ff_raw_read_partial_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
,
.
extensions
=
"mlp"
,
.
raw_codec_id
=
AV_CODEC_ID_MLP
,
};
#endif
#if CONFIG_TRUEHD_DEMUXER
static
int
thd_probe
(
AVProbeData
*
p
)
{
return
mlp_thd_probe
(
p
,
0xf8726fba
);
}
AVInputFormat
ff_truehd_demuxer
=
{
.
name
=
"truehd"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"raw TrueHD"
),
.
read_probe
=
thd_probe
,
.
read_header
=
ff_raw_audio_read_header
,
.
read_packet
=
ff_raw_read_partial_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
,
.
extensions
=
"thd"
,
.
raw_codec_id
=
AV_CODEC_ID_TRUEHD
,
};
#endif
libavformat/rawdec.c
View file @
32a6d37a
...
...
@@ -206,66 +206,6 @@ static int mjpeg_probe(AVProbeData *p)
FF_DEF_RAWVIDEO_DEMUXER2
(
mjpeg
,
"raw MJPEG video"
,
mjpeg_probe
,
"mjpg,mjpeg,mpo"
,
AV_CODEC_ID_MJPEG
,
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
)
#endif
#if CONFIG_MLP_DEMUXER || CONFIG_TRUEHD_DEMUXER
static
int
av_always_inline
mlp_thd_probe
(
AVProbeData
*
p
,
uint32_t
sync
)
{
const
uint8_t
*
buf
,
*
last_buf
=
p
->
buf
,
*
end
=
p
->
buf
+
p
->
buf_size
;
int
frames
=
0
,
valid
=
0
,
size
=
0
;
for
(
buf
=
p
->
buf
;
buf
+
8
<=
end
;
buf
++
)
{
if
(
AV_RB32
(
buf
+
4
)
==
sync
)
{
frames
++
;
if
(
last_buf
+
size
==
buf
)
{
valid
++
;
}
last_buf
=
buf
;
size
=
(
AV_RB16
(
buf
)
&
0xfff
)
*
2
;
}
else
if
(
buf
-
last_buf
==
size
)
{
size
+=
(
AV_RB16
(
buf
)
&
0xfff
)
*
2
;
}
}
if
(
valid
>=
100
)
return
AVPROBE_SCORE_MAX
;
return
0
;
}
#endif
#if CONFIG_MLP_DEMUXER
static
int
mlp_probe
(
AVProbeData
*
p
)
{
return
mlp_thd_probe
(
p
,
0xf8726fbb
);
}
AVInputFormat
ff_mlp_demuxer
=
{
.
name
=
"mlp"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"raw MLP"
),
.
read_probe
=
mlp_probe
,
.
read_header
=
ff_raw_audio_read_header
,
.
read_packet
=
ff_raw_read_partial_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
,
.
extensions
=
"mlp"
,
.
raw_codec_id
=
AV_CODEC_ID_MLP
,
};
#endif
#if CONFIG_TRUEHD_DEMUXER
static
int
thd_probe
(
AVProbeData
*
p
)
{
return
mlp_thd_probe
(
p
,
0xf8726fba
);
}
AVInputFormat
ff_truehd_demuxer
=
{
.
name
=
"truehd"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"raw TrueHD"
),
.
read_probe
=
thd_probe
,
.
read_header
=
ff_raw_audio_read_header
,
.
read_packet
=
ff_raw_read_partial_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
,
.
extensions
=
"thd"
,
.
raw_codec_id
=
AV_CODEC_ID_TRUEHD
,
};
#endif
#if CONFIG_VC1_DEMUXER
FF_DEF_RAWVIDEO_DEMUXER2
(
vc1
,
"raw VC-1"
,
NULL
,
"vc1"
,
AV_CODEC_ID_VC1
,
AVFMT_GENERIC_INDEX
|
AVFMT_NOTIMESTAMPS
)
#endif
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