Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
64bde805
Commit
64bde805
authored
May 02, 2012
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3.
parent
d041dec3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
10 deletions
+50
-10
ac3dec.c
libavformat/ac3dec.c
+25
-5
mp3dec.c
libavformat/mp3dec.c
+25
-5
No files found.
libavformat/ac3dec.c
View file @
64bde805
...
@@ -57,11 +57,31 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
...
@@ -57,11 +57,31 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
if
(
codec_id
!=
expected_codec_id
)
return
0
;
if
(
codec_id
!=
expected_codec_id
)
return
0
;
// keep this in sync with mp3 probe, both need to avoid
// keep this in sync with mp3 probe, both need to avoid
// issues with MPEG-files!
// issues with MPEG-files!
if
(
first_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
2
+
1
;
if
(
first_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
2
+
1
;
else
if
(
max_frames
>
500
)
return
AVPROBE_SCORE_MAX
/
2
;
else
if
(
max_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
4
;
if
(
max_frames
)
{
else
if
(
max_frames
>=
1
)
return
1
;
int
pes
=
0
,
i
;
else
return
0
;
unsigned
int
code
=
-
1
;
#define VIDEO_ID 0x000001e0
#define AUDIO_ID 0x000001c0
/* do a search for mpegps headers to be able to properly bias
* towards mpegps if we detect this stream as both. */
for
(
i
=
0
;
i
<
p
->
buf_size
;
i
++
)
{
code
=
(
code
<<
8
)
+
p
->
buf
[
i
];
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
((
code
&
0x1f0
)
==
VIDEO_ID
)
pes
++
;
else
if
((
code
&
0x1e0
)
==
AUDIO_ID
)
pes
++
;
}
}
if
(
pes
)
max_frames
=
(
max_frames
+
pes
-
1
)
/
pes
;
}
if
(
max_frames
>
500
)
return
AVPROBE_SCORE_MAX
/
2
;
else
if
(
max_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
4
;
else
if
(
max_frames
>=
1
)
return
1
;
else
return
0
;
}
}
#if CONFIG_AC3_DEMUXER
#if CONFIG_AC3_DEMUXER
...
...
libavformat/mp3dec.c
View file @
64bde805
...
@@ -63,11 +63,31 @@ static int mp3_read_probe(AVProbeData *p)
...
@@ -63,11 +63,31 @@ static int mp3_read_probe(AVProbeData *p)
}
}
// keep this in sync with ac3 probe, both need to avoid
// keep this in sync with ac3 probe, both need to avoid
// issues with MPEG-files!
// issues with MPEG-files!
if
(
first_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
2
+
1
;
if
(
first_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
2
+
1
;
else
if
(
max_frames
>
500
)
return
AVPROBE_SCORE_MAX
/
2
;
else
if
(
max_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
4
;
if
(
max_frames
)
{
else
if
(
max_frames
>=
1
)
return
1
;
int
pes
=
0
,
i
;
else
return
0
;
unsigned
int
code
=
-
1
;
#define VIDEO_ID 0x000001e0
#define AUDIO_ID 0x000001c0
/* do a search for mpegps headers to be able to properly bias
* towards mpegps if we detect this stream as both. */
for
(
i
=
0
;
i
<
p
->
buf_size
;
i
++
)
{
code
=
(
code
<<
8
)
+
p
->
buf
[
i
];
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
((
code
&
0x1f0
)
==
VIDEO_ID
)
pes
++
;
else
if
((
code
&
0x1e0
)
==
AUDIO_ID
)
pes
++
;
}
}
if
(
pes
)
max_frames
=
(
max_frames
+
pes
-
1
)
/
pes
;
}
if
(
max_frames
>
500
)
return
AVPROBE_SCORE_MAX
/
2
;
else
if
(
max_frames
>=
4
)
return
AVPROBE_SCORE_MAX
/
4
;
else
if
(
max_frames
>=
1
)
return
1
;
else
return
0
;
//mpegps_mp3_unrecognized_format.mpg has max_frames=3
//mpegps_mp3_unrecognized_format.mpg has max_frames=3
}
}
...
...
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