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
92a9a302
Commit
92a9a302
authored
Mar 27, 2013
by
Carl Eugen Hoyos
Committed by
Michael Niedermayer
Mar 27, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support pcm_mulaw in Hikvision CCTV mpeg program streams.
Fixes decoding the sample from videolan trac ticket #8344.
parent
7857ddce
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
mpeg.c
libavformat/mpeg.c
+16
-11
No files found.
libavformat/mpeg.c
View file @
92a9a302
...
@@ -110,6 +110,7 @@ typedef struct MpegDemuxContext {
...
@@ -110,6 +110,7 @@ typedef struct MpegDemuxContext {
unsigned
char
psm_es_type
[
256
];
unsigned
char
psm_es_type
[
256
];
int
sofdec
;
int
sofdec
;
int
dvd
;
int
dvd
;
int
imkh_cctv
;
#if CONFIG_VOBSUB_DEMUXER
#if CONFIG_VOBSUB_DEMUXER
AVFormatContext
*
sub_ctx
;
AVFormatContext
*
sub_ctx
;
FFDemuxSubtitlesQueue
q
;
FFDemuxSubtitlesQueue
q
;
...
@@ -119,22 +120,18 @@ typedef struct MpegDemuxContext {
...
@@ -119,22 +120,18 @@ typedef struct MpegDemuxContext {
static
int
mpegps_read_header
(
AVFormatContext
*
s
)
static
int
mpegps_read_header
(
AVFormatContext
*
s
)
{
{
MpegDemuxContext
*
m
=
s
->
priv_data
;
MpegDemuxContext
*
m
=
s
->
priv_data
;
const
char
*
sofdec
=
"Sofdec"
;
char
buffer
[
7
];
int
v
,
i
=
0
;
int64_t
last_pos
=
avio_tell
(
s
->
pb
);
int64_t
last_pos
=
avio_tell
(
s
->
pb
);
m
->
header_state
=
0xff
;
m
->
header_state
=
0xff
;
s
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
s
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
m
->
sofdec
=
-
1
;
avio_get_str
(
s
->
pb
,
6
,
buffer
,
sizeof
(
buffer
));
do
{
if
(
!
memcmp
(
"IMKH"
,
buffer
,
4
))
{
v
=
avio_r8
(
s
->
pb
);
m
->
imkh_cctv
=
1
;
m
->
sofdec
++
;
}
else
if
(
!
memcmp
(
"Sofdec"
,
buffer
,
6
))
{
}
while
(
v
==
sofdec
[
i
]
&&
i
++
<
6
);
m
->
sofdec
=
1
;
}
else
m
->
sofdec
=
(
m
->
sofdec
==
6
)
?
1
:
0
;
if
(
!
m
->
sofdec
)
avio_seek
(
s
->
pb
,
last_pos
,
SEEK_SET
);
avio_seek
(
s
->
pb
,
last_pos
,
SEEK_SET
);
/* no need to do more */
/* no need to do more */
...
@@ -506,6 +503,9 @@ static int mpegps_read_packet(AVFormatContext *s,
...
@@ -506,6 +503,9 @@ static int mpegps_read_packet(AVFormatContext *s,
}
else
if
(
es_type
==
STREAM_TYPE_AUDIO_AC3
){
}
else
if
(
es_type
==
STREAM_TYPE_AUDIO_AC3
){
codec_id
=
AV_CODEC_ID_AC3
;
codec_id
=
AV_CODEC_ID_AC3
;
type
=
AVMEDIA_TYPE_AUDIO
;
type
=
AVMEDIA_TYPE_AUDIO
;
}
else
if
(
m
->
imkh_cctv
&&
es_type
==
0x91
){
codec_id
=
AV_CODEC_ID_PCM_MULAW
;
type
=
AVMEDIA_TYPE_AUDIO
;
}
else
if
(
startcode
>=
0x1e0
&&
startcode
<=
0x1ef
)
{
}
else
if
(
startcode
>=
0x1e0
&&
startcode
<=
0x1ef
)
{
static
const
unsigned
char
avs_seqh
[
4
]
=
{
0
,
0
,
1
,
0xb0
};
static
const
unsigned
char
avs_seqh
[
4
]
=
{
0
,
0
,
1
,
0xb0
};
unsigned
char
buf
[
8
];
unsigned
char
buf
[
8
];
...
@@ -564,6 +564,11 @@ static int mpegps_read_packet(AVFormatContext *s,
...
@@ -564,6 +564,11 @@ static int mpegps_read_packet(AVFormatContext *s,
st
->
id
=
startcode
;
st
->
id
=
startcode
;
st
->
codec
->
codec_type
=
type
;
st
->
codec
->
codec_type
=
type
;
st
->
codec
->
codec_id
=
codec_id
;
st
->
codec
->
codec_id
=
codec_id
;
if
(
st
->
codec
->
codec_id
==
AV_CODEC_ID_PCM_MULAW
)
{
st
->
codec
->
channels
=
1
;
st
->
codec
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
st
->
codec
->
sample_rate
=
8000
;
}
st
->
request_probe
=
request_probe
;
st
->
request_probe
=
request_probe
;
if
(
codec_id
!=
AV_CODEC_ID_PCM_S16BE
)
if
(
codec_id
!=
AV_CODEC_ID_PCM_S16BE
)
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
...
...
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