decoder/flac: add options "probesize" and "analyzeduration"
https://bugs.musicpd.org/view.php?id=3876
This commit is contained in:
parent
67778dcd3d
commit
142fdc8d86
2
NEWS
2
NEWS
@ -1,4 +1,6 @@
|
|||||||
ver 0.20.2 (not yet released)
|
ver 0.20.2 (not yet released)
|
||||||
|
* decoder
|
||||||
|
- flac: add options "probesize" and "analyzeduration"
|
||||||
|
|
||||||
ver 0.20.1 (2017/01/09)
|
ver 0.20.1 (2017/01/09)
|
||||||
* input
|
* input
|
||||||
|
42
doc/user.xml
42
doc/user.xml
@ -2206,6 +2206,48 @@ run</programlisting>
|
|||||||
Decodes various codecs using
|
Decodes various codecs using
|
||||||
<application>FFmpeg</application>.
|
<application>FFmpeg</application>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<informaltable>
|
||||||
|
<tgroup cols="2">
|
||||||
|
<thead>
|
||||||
|
<row>
|
||||||
|
<entry>Setting</entry>
|
||||||
|
<entry>Description</entry>
|
||||||
|
</row>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>analyzeduration</varname>
|
||||||
|
<parameter>VALUE</parameter>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Sets the FFmpeg muxer option
|
||||||
|
<varname>analyzeduration</varname>, which specifies
|
||||||
|
how many microseconds are analyzed to probe the
|
||||||
|
input. The <ulink
|
||||||
|
url="https://ffmpeg.org/ffmpeg-formats.html">FFmpeg
|
||||||
|
formats documentation</ulink> has more information.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>probesize</varname>
|
||||||
|
<parameter>VALUE</parameter>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Sets the FFmpeg muxer option
|
||||||
|
<varname>probesize</varname>, which specifies
|
||||||
|
probing size in bytes, i.e. the size of the data to
|
||||||
|
analyze to get stream information. The <ulink
|
||||||
|
url="https://ffmpeg.org/ffmpeg-formats.html">FFmpeg
|
||||||
|
formats documentation</ulink> has more information.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</informaltable>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="flac_decoder">
|
<section id="flac_decoder">
|
||||||
|
@ -56,6 +56,11 @@ extern "C" {
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Muxer options to be passed to avformat_open_input().
|
||||||
|
*/
|
||||||
|
static AVDictionary *avformat_options = nullptr;
|
||||||
|
|
||||||
static AVFormatContext *
|
static AVFormatContext *
|
||||||
FfmpegOpenInput(AVIOContext *pb,
|
FfmpegOpenInput(AVIOContext *pb,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
@ -67,7 +72,11 @@ FfmpegOpenInput(AVIOContext *pb,
|
|||||||
|
|
||||||
context->pb = pb;
|
context->pb = pb;
|
||||||
|
|
||||||
int err = avformat_open_input(&context, filename, fmt, nullptr);
|
AVDictionary *options = nullptr;
|
||||||
|
AtScopeExit(&options) { av_dict_free(&options); };
|
||||||
|
av_dict_copy(&options, avformat_options, 0);
|
||||||
|
|
||||||
|
int err = avformat_open_input(&context, filename, fmt, &options);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
throw MakeFfmpegError(err, "avformat_open_input() failed");
|
throw MakeFfmpegError(err, "avformat_open_input() failed");
|
||||||
|
|
||||||
@ -75,12 +84,30 @@ FfmpegOpenInput(AVIOContext *pb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ffmpeg_init(gcc_unused const ConfigBlock &block)
|
ffmpeg_init(const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
FfmpegInit();
|
FfmpegInit();
|
||||||
|
|
||||||
|
static constexpr const char *option_names[] = {
|
||||||
|
"probesize",
|
||||||
|
"analyzeduration",
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const char *name : option_names) {
|
||||||
|
const char *value = block.GetBlockValue(name);
|
||||||
|
if (value != nullptr)
|
||||||
|
av_dict_set(&avformat_options, name, value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ffmpeg_finish()
|
||||||
|
{
|
||||||
|
av_dict_free(&avformat_options);
|
||||||
|
}
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 25, 0) /* FFmpeg 3.1 */
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 25, 0) /* FFmpeg 3.1 */
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
@ -967,7 +994,7 @@ static const char *const ffmpeg_mime_types[] = {
|
|||||||
const struct DecoderPlugin ffmpeg_decoder_plugin = {
|
const struct DecoderPlugin ffmpeg_decoder_plugin = {
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
ffmpeg_init,
|
ffmpeg_init,
|
||||||
nullptr,
|
ffmpeg_finish,
|
||||||
ffmpeg_decode,
|
ffmpeg_decode,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
Loading…
Reference in New Issue
Block a user