2010-01-30 16:57:40 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2010-01-30 16:57:40 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
2010-01-30 16:57:40 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2010-01-30 16:57:40 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-30 16:57:40 +00:00
|
|
|
*/
|
|
|
|
|
2002-03-25 21:23:06 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2007-11-01 06:52:19 +00:00
|
|
|
#include <assert.h>
|
2002-03-25 21:23:06 +00:00
|
|
|
|
2013-07-07 21:54:11 +00:00
|
|
|
#include <libavutil/mem.h>
|
|
|
|
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
#include "demux/codec_tags.h"
|
|
|
|
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/codecs.h"
|
|
|
|
#include "common/msg.h"
|
2014-08-29 10:09:04 +00:00
|
|
|
#include "misc/bstr.h"
|
2002-03-25 21:23:06 +00:00
|
|
|
|
2007-03-15 17:10:36 +00:00
|
|
|
#include "stream/stream.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "demux/demux.h"
|
2002-03-25 21:23:06 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "demux/stheader.h"
|
2002-03-25 21:23:06 +00:00
|
|
|
|
|
|
|
#include "dec_audio.h"
|
|
|
|
#include "ad.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "audio/format.h"
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
#include "audio/audio.h"
|
2013-11-10 22:38:18 +00:00
|
|
|
#include "audio/audio_buffer.h"
|
2002-03-25 21:23:06 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "audio/filter/af.h"
|
2002-10-05 22:55:45 +00:00
|
|
|
|
2013-07-22 12:41:56 +00:00
|
|
|
extern const struct ad_functions ad_lavc;
|
|
|
|
extern const struct ad_functions ad_spdif;
|
|
|
|
|
|
|
|
static const struct ad_functions * const ad_drivers[] = {
|
2014-09-22 20:38:06 +00:00
|
|
|
&ad_lavc,
|
2013-07-22 12:41:56 +00:00
|
|
|
&ad_spdif,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
static void uninit_decoder(struct dec_audio *d_audio)
|
2002-03-25 21:23:06 +00:00
|
|
|
{
|
2015-06-05 20:35:43 +00:00
|
|
|
audio_reset_decoding(d_audio);
|
2013-11-23 20:26:04 +00:00
|
|
|
if (d_audio->ad_driver) {
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_VERBOSE(d_audio, "Uninit audio decoder.\n");
|
2013-11-23 20:22:17 +00:00
|
|
|
d_audio->ad_driver->uninit(d_audio);
|
|
|
|
}
|
2013-11-23 20:26:04 +00:00
|
|
|
d_audio->ad_driver = NULL;
|
2013-11-23 20:22:17 +00:00
|
|
|
talloc_free(d_audio->priv);
|
|
|
|
d_audio->priv = NULL;
|
2015-06-05 20:35:43 +00:00
|
|
|
d_audio->afilter->initialized = -1;
|
|
|
|
d_audio->decode_format = (struct mp_audio){0};
|
2013-11-23 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int init_audio_codec(struct dec_audio *d_audio, const char *decoder)
|
|
|
|
{
|
|
|
|
if (!d_audio->ad_driver->init(d_audio, decoder)) {
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_VERBOSE(d_audio, "Audio decoder init failed.\n");
|
2013-11-23 20:26:04 +00:00
|
|
|
d_audio->ad_driver = NULL;
|
2013-11-23 20:22:17 +00:00
|
|
|
uninit_decoder(d_audio);
|
2013-01-31 09:44:15 +00:00
|
|
|
return 0;
|
2007-11-01 06:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2002-03-25 21:23:06 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
struct mp_decoder_list *audio_decoder_list(void)
|
2007-11-01 06:51:38 +00:00
|
|
|
{
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list);
|
2013-07-22 12:41:56 +00:00
|
|
|
for (int i = 0; ad_drivers[i] != NULL; i++)
|
|
|
|
ad_drivers[i]->add_decoders(list);
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2015-06-05 20:35:43 +00:00
|
|
|
static struct mp_decoder_list *audio_select_decoders(struct dec_audio *d_audio)
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
{
|
2015-06-05 20:35:43 +00:00
|
|
|
struct MPOpts *opts = d_audio->opts;
|
|
|
|
const char *codec = d_audio->header->codec;
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
struct mp_decoder_list *list = audio_decoder_list();
|
2015-06-05 20:35:43 +00:00
|
|
|
struct mp_decoder_list *new =
|
|
|
|
mp_select_decoders(list, codec, opts->audio_decoders);
|
|
|
|
if (d_audio->spdif_passthrough) {
|
|
|
|
struct mp_decoder_list *spdif =
|
|
|
|
mp_select_decoder_list(list, codec, "spdif", opts->audio_spdif);
|
|
|
|
mp_append_decoders(spdif, new);
|
|
|
|
talloc_free(new);
|
|
|
|
new = spdif;
|
|
|
|
}
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
talloc_free(list);
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct ad_functions *find_driver(const char *name)
|
|
|
|
{
|
2013-07-22 12:41:56 +00:00
|
|
|
for (int i = 0; ad_drivers[i] != NULL; i++) {
|
|
|
|
if (strcmp(ad_drivers[i]->name, name) == 0)
|
|
|
|
return ad_drivers[i];
|
2002-09-28 02:23:20 +00:00
|
|
|
}
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
return NULL;
|
2002-09-28 02:23:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-05 20:35:43 +00:00
|
|
|
int audio_init_best_codec(struct dec_audio *d_audio)
|
2007-11-01 06:51:38 +00:00
|
|
|
{
|
2015-06-05 20:35:43 +00:00
|
|
|
uninit_decoder(d_audio);
|
2013-11-23 20:26:04 +00:00
|
|
|
assert(!d_audio->ad_driver);
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
|
|
|
|
struct mp_decoder_entry *decoder = NULL;
|
2015-06-05 20:35:43 +00:00
|
|
|
struct mp_decoder_list *list = audio_select_decoders(d_audio);
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
|
2013-12-21 17:46:24 +00:00
|
|
|
mp_print_decoders(d_audio->log, MSGL_V, "Codec list:", list);
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
|
|
|
|
for (int n = 0; n < list->num_entries; n++) {
|
|
|
|
struct mp_decoder_entry *sel = &list->entries[n];
|
|
|
|
const struct ad_functions *driver = find_driver(sel->family);
|
|
|
|
if (!driver)
|
|
|
|
continue;
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_VERBOSE(d_audio, "Opening audio decoder %s:%s\n",
|
|
|
|
sel->family, sel->decoder);
|
2013-11-23 20:22:17 +00:00
|
|
|
d_audio->ad_driver = driver;
|
|
|
|
if (init_audio_codec(d_audio, sel->decoder)) {
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
decoder = sel;
|
|
|
|
break;
|
2013-01-31 09:44:15 +00:00
|
|
|
}
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_WARN(d_audio, "Audio decoder init failed for "
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
"%s:%s\n", sel->family, sel->decoder);
|
2002-09-28 02:23:20 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 20:26:04 +00:00
|
|
|
if (d_audio->ad_driver) {
|
2013-11-23 20:22:17 +00:00
|
|
|
d_audio->decoder_desc =
|
|
|
|
talloc_asprintf(d_audio, "%s [%s:%s]", decoder->desc, decoder->family,
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
decoder->decoder);
|
2014-05-31 20:07:36 +00:00
|
|
|
MP_VERBOSE(d_audio, "Selected audio codec: %s\n", d_audio->decoder_desc);
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
} else {
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_ERR(d_audio, "Failed to initialize an audio decoder for codec '%s'.\n",
|
2013-11-23 20:22:17 +00:00
|
|
|
d_audio->header->codec ? d_audio->header->codec : "<unknown>");
|
2007-11-01 06:51:38 +00:00
|
|
|
}
|
2002-09-28 02:23:20 +00:00
|
|
|
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
talloc_free(list);
|
2013-11-23 20:26:04 +00:00
|
|
|
return !!d_audio->ad_driver;
|
2002-09-28 02:23:20 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
void audio_uninit(struct dec_audio *d_audio)
|
2002-03-25 21:23:06 +00:00
|
|
|
{
|
2013-11-23 20:22:17 +00:00
|
|
|
if (!d_audio)
|
|
|
|
return;
|
2014-10-01 23:47:27 +00:00
|
|
|
MP_VERBOSE(d_audio, "Uninit audio filters...\n");
|
2013-11-23 20:22:17 +00:00
|
|
|
uninit_decoder(d_audio);
|
2015-06-15 18:28:05 +00:00
|
|
|
af_destroy(d_audio->afilter);
|
2015-01-14 21:14:46 +00:00
|
|
|
talloc_free(d_audio->waiting);
|
2013-11-23 20:22:17 +00:00
|
|
|
talloc_free(d_audio);
|
2002-03-25 21:23:06 +00:00
|
|
|
}
|
|
|
|
|
2015-01-14 21:14:46 +00:00
|
|
|
static int decode_new_frame(struct dec_audio *da)
|
2014-07-28 18:40:43 +00:00
|
|
|
{
|
2014-11-10 21:01:23 +00:00
|
|
|
while (!da->waiting) {
|
|
|
|
int ret = da->ad_driver->decode_packet(da, &da->waiting);
|
2014-07-28 18:40:43 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2015-01-14 21:14:46 +00:00
|
|
|
|
|
|
|
if (da->waiting) {
|
2015-11-08 16:22:56 +00:00
|
|
|
if (da->waiting->pts != MP_NOPTS_VALUE) {
|
2015-11-08 17:05:16 +00:00
|
|
|
if (da->pts != MP_NOPTS_VALUE) {
|
|
|
|
da->pts += da->pts_offset / (double)da->waiting->rate;
|
|
|
|
da->pts_offset = 0;
|
|
|
|
}
|
|
|
|
// Keep the interpolated timestamp if it doesn't deviate more
|
|
|
|
// than 1 ms from the real one. (MKV rounded timestamps.)
|
|
|
|
if (da->pts == MP_NOPTS_VALUE || da->pts_offset != 0 ||
|
|
|
|
fabs(da->pts - da->waiting->pts) > 0.001)
|
|
|
|
{
|
|
|
|
da->pts = da->waiting->pts;
|
|
|
|
da->pts_offset = 0;
|
|
|
|
}
|
2015-11-08 16:22:56 +00:00
|
|
|
}
|
2015-01-14 21:14:46 +00:00
|
|
|
da->pts_offset += da->waiting->samples;
|
|
|
|
da->decode_format = *da->waiting;
|
|
|
|
mp_audio_set_null_data(&da->decode_format);
|
|
|
|
}
|
2015-11-08 16:22:56 +00:00
|
|
|
|
|
|
|
if (da->pts == MP_NOPTS_VALUE && da->header->missing_timestamps)
|
|
|
|
da->pts = 0;
|
2014-07-28 18:40:43 +00:00
|
|
|
}
|
2014-11-10 21:01:23 +00:00
|
|
|
return mp_audio_config_valid(da->waiting) ? AD_OK : AD_ERR;
|
2007-11-01 06:52:19 +00:00
|
|
|
}
|
|
|
|
|
2015-01-14 21:14:46 +00:00
|
|
|
/* Decode packets until we know the audio format. Then reinit the buffer.
|
|
|
|
* Returns AD_OK on success, negative AD_* code otherwise.
|
|
|
|
* Also returns AD_OK if already initialized (and does nothing).
|
|
|
|
*/
|
|
|
|
int initial_audio_decode(struct dec_audio *da)
|
|
|
|
{
|
|
|
|
return decode_new_frame(da);
|
|
|
|
}
|
|
|
|
|
2015-01-13 19:15:43 +00:00
|
|
|
static bool copy_output(struct af_stream *afs, struct mp_audio_buffer *outbuf,
|
|
|
|
int minsamples, bool eof)
|
|
|
|
{
|
|
|
|
while (mp_audio_buffer_samples(outbuf) < minsamples) {
|
|
|
|
if (af_output_frame(afs, eof) < 0)
|
|
|
|
return true; // error, stop doing stuff
|
|
|
|
struct mp_audio *mpa = af_read_output_frame(afs);
|
|
|
|
if (!mpa)
|
|
|
|
return false; // out of data
|
|
|
|
mp_audio_buffer_append(outbuf, mpa);
|
|
|
|
talloc_free(mpa);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-11-10 22:38:18 +00:00
|
|
|
/* Try to get at least minsamples decoded+filtered samples in outbuf
|
2007-11-01 06:52:19 +00:00
|
|
|
* (total length including possible existing data).
|
2014-07-20 18:42:03 +00:00
|
|
|
* Return 0 on success, or negative AD_* error code.
|
2013-11-10 22:38:18 +00:00
|
|
|
* In the former case outbuf has at least minsamples buffered on return.
|
|
|
|
* In case of EOF/error it might or might not be. */
|
2014-11-10 21:01:23 +00:00
|
|
|
int audio_decode(struct dec_audio *da, struct mp_audio_buffer *outbuf,
|
2013-11-10 22:38:18 +00:00
|
|
|
int minsamples)
|
2007-11-01 06:52:19 +00:00
|
|
|
{
|
2014-11-10 21:01:23 +00:00
|
|
|
struct af_stream *afs = da->afilter;
|
|
|
|
if (afs->initialized < 1)
|
2014-07-28 18:40:43 +00:00
|
|
|
return AD_ERR;
|
|
|
|
|
2014-11-10 21:01:23 +00:00
|
|
|
MP_STATS(da, "start audio");
|
2007-11-01 06:52:19 +00:00
|
|
|
|
2015-01-13 19:15:43 +00:00
|
|
|
int res;
|
|
|
|
while (1) {
|
2014-11-10 21:01:23 +00:00
|
|
|
res = 0;
|
|
|
|
|
2015-01-13 19:15:43 +00:00
|
|
|
if (copy_output(afs, outbuf, minsamples, false))
|
|
|
|
break;
|
|
|
|
|
2015-01-14 21:14:46 +00:00
|
|
|
res = decode_new_frame(da);
|
|
|
|
if (res < 0) {
|
|
|
|
// drain filters first (especially for true EOF case)
|
|
|
|
copy_output(afs, outbuf, minsamples, true);
|
|
|
|
break;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
}
|
|
|
|
|
2015-01-13 19:15:43 +00:00
|
|
|
// On format change, make sure to drain the filter chain.
|
2015-01-14 21:14:46 +00:00
|
|
|
if (!mp_audio_config_equals(&afs->input, da->waiting)) {
|
2015-01-13 19:15:43 +00:00
|
|
|
copy_output(afs, outbuf, minsamples, true);
|
|
|
|
res = AD_NEW_FMT;
|
|
|
|
break;
|
|
|
|
}
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
2015-01-14 21:14:46 +00:00
|
|
|
struct mp_audio *mpa = da->waiting;
|
|
|
|
da->waiting = NULL;
|
2015-01-13 19:15:43 +00:00
|
|
|
if (af_filter_frame(afs, mpa) < 0)
|
2014-11-10 21:01:23 +00:00
|
|
|
return AD_ERR;
|
2007-11-01 06:52:19 +00:00
|
|
|
}
|
2014-11-10 21:01:23 +00:00
|
|
|
|
|
|
|
MP_STATS(da, "end audio");
|
|
|
|
|
2014-04-17 19:47:00 +00:00
|
|
|
return res;
|
2002-03-25 21:23:06 +00:00
|
|
|
}
|
|
|
|
|
2013-11-27 19:54:07 +00:00
|
|
|
void audio_reset_decoding(struct dec_audio *d_audio)
|
2002-03-25 21:23:06 +00:00
|
|
|
{
|
2013-11-23 20:26:04 +00:00
|
|
|
if (d_audio->ad_driver)
|
2013-11-27 19:54:07 +00:00
|
|
|
d_audio->ad_driver->control(d_audio, ADCTRL_RESET, NULL);
|
2015-01-13 19:15:43 +00:00
|
|
|
af_seek_reset(d_audio->afilter);
|
2013-11-27 19:54:29 +00:00
|
|
|
d_audio->pts = MP_NOPTS_VALUE;
|
|
|
|
d_audio->pts_offset = 0;
|
2014-11-10 21:01:23 +00:00
|
|
|
if (d_audio->waiting) {
|
|
|
|
talloc_free(d_audio->waiting);
|
|
|
|
d_audio->waiting = NULL;
|
|
|
|
}
|
2002-03-25 21:23:06 +00:00
|
|
|
}
|