Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
96017f58
Commit
96017f58
authored
Jul 24, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: skip the av_probe_input_format() call
This is kind of a revert of commit
b2e3c075
, which is not any longer necessary since commit
0dd4b52b
removed the last call to `av_open_input_stream()`.
parent
c8e6f50d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
62 deletions
+6
-62
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+6
-62
No files found.
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
96017f58
...
...
@@ -470,55 +470,6 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
return
SampleFormat
::
UNDEFINED
;
}
static
AVInputFormat
*
ffmpeg_probe
(
DecoderClient
*
client
,
InputStream
&
is
)
{
constexpr
size_t
BUFFER_SIZE
=
16384
;
constexpr
size_t
PADDING
=
16
;
unsigned
char
buffer
[
BUFFER_SIZE
];
size_t
nbytes
=
decoder_read
(
client
,
is
,
buffer
,
BUFFER_SIZE
);
if
(
nbytes
<=
PADDING
)
return
nullptr
;
try
{
is
.
LockRewind
();
}
catch
(...)
{
return
nullptr
;
}
/* some ffmpeg parsers (e.g. ac3_parser.c) read a few bytes
beyond the declared buffer limit, which makes valgrind
angry; this workaround removes some padding from the buffer
size */
nbytes
-=
PADDING
;
AVProbeData
avpd
;
/* new versions of ffmpeg may add new attributes, and leaving
them uninitialized may crash; hopefully, zero-initializing
everything we don't know is ok */
memset
(
&
avpd
,
0
,
sizeof
(
avpd
));
avpd
.
buf
=
buffer
;
avpd
.
buf_size
=
nbytes
;
avpd
.
filename
=
is
.
GetURI
();
#ifdef AVPROBE_SCORE_MIME
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(56, 5, 1)
/* this attribute was added in libav/ffmpeg version 11, but
unfortunately it's "uint8_t" instead of "char", and it's
not "const" - wtf? */
avpd
.
mime_type
=
(
uint8_t
*
)
const_cast
<
char
*>
(
is
.
GetMimeType
());
#else
/* API problem fixed in FFmpeg 2.5 */
avpd
.
mime_type
=
is
.
GetMimeType
();
#endif
#endif
return
av_probe_input_format
(
&
avpd
,
true
);
}
static
void
FfmpegParseMetaData
(
AVDictionary
&
dict
,
ReplayGainInfo
&
rg
,
MixRampInfo
&
mr
)
{
...
...
@@ -796,13 +747,6 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
static
void
ffmpeg_decode
(
DecoderClient
&
client
,
InputStream
&
input
)
{
AVInputFormat
*
input_format
=
ffmpeg_probe
(
&
client
,
input
);
if
(
input_format
==
nullptr
)
return
;
FormatDebug
(
ffmpeg_domain
,
"detected input format '%s' (%s)"
,
input_format
->
name
,
input_format
->
long_name
);
AvioStream
stream
(
&
client
,
input
);
if
(
!
stream
.
Open
())
{
LogError
(
ffmpeg_domain
,
"Failed to open stream"
);
...
...
@@ -812,7 +756,7 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
AVFormatContext
*
format_context
;
try
{
format_context
=
FfmpegOpenInput
(
stream
.
io
,
input
.
GetURI
(),
input_format
);
nullptr
);
}
catch
(...)
{
LogError
(
std
::
current_exception
());
return
;
...
...
@@ -822,6 +766,10 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
avformat_close_input
(
&
format_context
);
};
const
auto
*
input_format
=
format_context
->
iformat
;
FormatDebug
(
ffmpeg_domain
,
"detected input format '%s' (%s)"
,
input_format
->
name
,
input_format
->
long_name
);
FfmpegDecode
(
client
,
input
,
*
format_context
);
}
...
...
@@ -862,17 +810,13 @@ FfmpegScanStream(AVFormatContext &format_context,
static
bool
ffmpeg_scan_stream
(
InputStream
&
is
,
TagHandler
&
handler
)
noexcept
{
AVInputFormat
*
input_format
=
ffmpeg_probe
(
nullptr
,
is
);
if
(
input_format
==
nullptr
)
return
false
;
AvioStream
stream
(
nullptr
,
is
);
if
(
!
stream
.
Open
())
return
false
;
AVFormatContext
*
f
;
try
{
f
=
FfmpegOpenInput
(
stream
.
io
,
is
.
GetURI
(),
input_format
);
f
=
FfmpegOpenInput
(
stream
.
io
,
is
.
GetURI
(),
nullptr
);
}
catch
(...)
{
return
false
;
}
...
...
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