2010-01-30 16:57:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2002-03-01 00:25:43 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/options.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2008-12-01 17:53:57 +00:00
|
|
|
#include <stdbool.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 <assert.h>
|
|
|
|
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/mp_msg.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2003-02-09 20:18:23 +00:00
|
|
|
#include "osdep/timer.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2007-03-15 17:10:36 +00:00
|
|
|
#include "stream/stream.h"
|
2013-07-12 20:04:44 +00:00
|
|
|
#include "demux/demux_packet.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/codecs.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "video/out/vo.h"
|
|
|
|
#include "video/csputils.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "demux/stheader.h"
|
|
|
|
#include "video/decode/vd.h"
|
|
|
|
#include "video/filter/vf.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "video/decode/dec_video.h"
|
2002-03-01 00:25:43 +00:00
|
|
|
|
|
|
|
|
2013-07-14 22:52:17 +00:00
|
|
|
int vd_control(struct sh_video *sh_video, int cmd, void *arg)
|
|
|
|
{
|
|
|
|
const struct vd_functions *vd = sh_video->vd_driver;
|
|
|
|
if (vd)
|
|
|
|
return vd->control(sh_video, cmd, arg);
|
|
|
|
return CONTROL_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
int get_video_quality_max(sh_video_t *sh_video)
|
|
|
|
{
|
|
|
|
vf_instance_t *vf = sh_video->vfilter;
|
|
|
|
if (vf) {
|
2013-07-14 22:57:04 +00:00
|
|
|
int ret = vf_control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL);
|
2008-04-24 02:23:45 +00:00
|
|
|
if (ret > 0) {
|
2009-07-06 22:15:02 +00:00
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using external postprocessing filter, max q = %d.\n", ret);
|
2008-04-24 02:23:45 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2002-04-07 17:42:31 +00:00
|
|
|
}
|
2008-04-24 02:23:45 +00:00
|
|
|
return 0;
|
2002-03-01 00:25:43 +00:00
|
|
|
}
|
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
int set_video_colors(sh_video_t *sh_video, const char *item, int value)
|
2002-03-01 00:25:43 +00:00
|
|
|
{
|
2008-04-24 02:23:45 +00:00
|
|
|
vf_instance_t *vf = sh_video->vfilter;
|
2002-07-28 21:30:09 +00:00
|
|
|
vf_equalizer_t data;
|
|
|
|
|
|
|
|
data.item = item;
|
|
|
|
data.value = value;
|
2002-07-25 13:12:23 +00:00
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value);
|
|
|
|
if (vf) {
|
2013-07-14 22:57:04 +00:00
|
|
|
int ret = vf_control(vf, VFCTRL_SET_EQUALIZER, &data);
|
2008-04-24 02:23:45 +00:00
|
|
|
if (ret == CONTROL_TRUE)
|
2008-06-04 05:10:48 +00:00
|
|
|
return 1;
|
2002-07-25 10:27:35 +00:00
|
|
|
}
|
2012-10-29 01:05:33 +00:00
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo.\n",
|
2008-04-24 02:23:45 +00:00
|
|
|
item);
|
2002-07-24 18:14:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
|
2002-07-24 18:14:21 +00:00
|
|
|
{
|
2008-04-24 02:23:45 +00:00
|
|
|
vf_instance_t *vf = sh_video->vfilter;
|
2002-07-28 21:30:09 +00:00
|
|
|
vf_equalizer_t data;
|
|
|
|
|
|
|
|
data.item = item;
|
2002-07-25 13:12:23 +00:00
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item);
|
|
|
|
if (vf) {
|
2013-07-14 22:57:04 +00:00
|
|
|
int ret = vf_control(vf, VFCTRL_GET_EQUALIZER, &data);
|
2008-04-24 02:23:45 +00:00
|
|
|
if (ret == CONTROL_TRUE) {
|
|
|
|
*value = data.value;
|
2008-06-04 05:10:48 +00:00
|
|
|
return 1;
|
2008-04-24 02:23:45 +00:00
|
|
|
}
|
2002-07-25 13:12:23 +00:00
|
|
|
}
|
2002-03-01 00:25:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-02-18 15:23:41 +00:00
|
|
|
void resync_video_stream(sh_video_t *sh_video)
|
|
|
|
{
|
2013-07-14 22:52:17 +00:00
|
|
|
vd_control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
|
2009-11-21 18:53:10 +00:00
|
|
|
sh_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
|
|
|
|
sh_video->prev_sorted_pts = MP_NOPTS_VALUE;
|
2004-02-18 15:23:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-18 09:32:53 +00:00
|
|
|
void video_reinit_vo(struct sh_video *sh_video)
|
2011-11-14 18:12:20 +00:00
|
|
|
{
|
2013-07-14 22:52:17 +00:00
|
|
|
vd_control(sh_video, VDCTRL_REINIT_VO, NULL);
|
2011-11-14 18:12:20 +00:00
|
|
|
}
|
|
|
|
|
2006-07-06 06:58:17 +00:00
|
|
|
int get_current_video_decoder_lag(sh_video_t *sh_video)
|
|
|
|
{
|
2013-02-24 22:15:11 +00:00
|
|
|
int ret = -1;
|
2013-07-14 22:52:17 +00:00
|
|
|
vd_control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, &ret);
|
2013-02-24 22:15:11 +00:00
|
|
|
return ret;
|
2006-07-06 06:58:17 +00:00
|
|
|
}
|
|
|
|
|
2008-04-24 02:23:45 +00:00
|
|
|
void uninit_video(sh_video_t *sh_video)
|
|
|
|
{
|
|
|
|
if (!sh_video->initialized)
|
|
|
|
return;
|
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
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Uninit video.\n");
|
2008-04-24 03:41:12 +00:00
|
|
|
sh_video->vd_driver->uninit(sh_video);
|
2002-04-20 22:24:19 +00:00
|
|
|
vf_uninit_filter_chain(sh_video->vfilter);
|
2013-05-18 09:44:17 +00:00
|
|
|
sh_video->vfilter = NULL;
|
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(sh_video->gsh->decoder_desc);
|
|
|
|
sh_video->gsh->decoder_desc = NULL;
|
2008-04-24 02:23:45 +00:00
|
|
|
sh_video->initialized = 0;
|
2002-03-01 00:25:43 +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
|
|
|
static int init_video_codec(sh_video_t *sh_video, const char *decoder)
|
2008-04-24 02:23:45 +00:00
|
|
|
{
|
2013-02-13 12:21:58 +00:00
|
|
|
assert(!sh_video->initialized);
|
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
|
|
|
|
|
|
|
if (!sh_video->vd_driver->init(sh_video, decoder)) {
|
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video decoder init failed.\n");
|
|
|
|
//uninit_video(sh_video);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sh_video->initialized = 1;
|
|
|
|
sh_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
|
|
|
|
sh_video->prev_sorted_pts = MP_NOPTS_VALUE;
|
|
|
|
return 1;
|
2002-08-31 13:09:23 +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 *mp_video_decoder_list(void)
|
2008-04-24 02:23:45 +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);
|
|
|
|
for (int i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
|
|
|
|
mpcodecs_vd_drivers[i]->add_decoders(list);
|
|
|
|
return list;
|
|
|
|
}
|
2002-05-29 22:39:25 +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
|
|
|
static struct mp_decoder_list *mp_select_video_decoders(const char *codec,
|
|
|
|
char *selection)
|
|
|
|
{
|
|
|
|
struct mp_decoder_list *list = mp_video_decoder_list();
|
|
|
|
struct mp_decoder_list *new = mp_select_decoders(list, codec, selection);
|
|
|
|
talloc_free(list);
|
|
|
|
return new;
|
|
|
|
}
|
2008-04-24 03:41:12 +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
|
|
|
static const struct vd_functions *find_driver(const char *name)
|
|
|
|
{
|
|
|
|
for (int i = 0; mpcodecs_vd_drivers[i] != NULL; i++) {
|
|
|
|
if (strcmp(mpcodecs_vd_drivers[i]->name, name) == 0)
|
|
|
|
return mpcodecs_vd_drivers[i];
|
2002-03-01 00:26:10 +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-03-01 00:25:43 +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
|
|
|
int init_best_video_codec(sh_video_t *sh_video, char* video_decoders)
|
2008-04-24 02:23:45 +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
|
|
|
assert(!sh_video->initialized);
|
|
|
|
|
|
|
|
struct mp_decoder_entry *decoder = NULL;
|
|
|
|
struct mp_decoder_list *list =
|
|
|
|
mp_select_video_decoders(sh_video->gsh->codec, video_decoders);
|
|
|
|
|
|
|
|
mp_print_decoders(MSGT_DECVIDEO, MSGL_V, "Codec list:", list);
|
|
|
|
|
|
|
|
for (int n = 0; n < list->num_entries; n++) {
|
|
|
|
struct mp_decoder_entry *sel = &list->entries[n];
|
|
|
|
const struct vd_functions *driver = find_driver(sel->family);
|
|
|
|
if (!driver)
|
|
|
|
continue;
|
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Opening video decoder %s:%s\n",
|
|
|
|
sel->family, sel->decoder);
|
|
|
|
sh_video->vd_driver = driver;
|
|
|
|
if (init_video_codec(sh_video, sel->decoder)) {
|
|
|
|
decoder = sel;
|
|
|
|
break;
|
2008-04-24 02:23:45 +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
|
|
|
sh_video->vd_driver = NULL;
|
|
|
|
mp_tmsg(MSGT_DECVIDEO, MSGL_WARN, "Video decoder init failed for "
|
|
|
|
"%s:%s\n", sel->family, sel->decoder);
|
2002-09-25 23:45:34 +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
|
|
|
if (sh_video->initialized) {
|
|
|
|
sh_video->gsh->decoder_desc =
|
|
|
|
talloc_asprintf(NULL, "%s [%s:%s]", decoder->desc, decoder->family,
|
|
|
|
decoder->decoder);
|
|
|
|
mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Selected video codec: %s\n",
|
|
|
|
sh_video->gsh->decoder_desc);
|
|
|
|
} else {
|
|
|
|
mp_msg(MSGT_DECVIDEO, MSGL_ERR,
|
|
|
|
"Failed to initialize a video decoder for codec '%s'.\n",
|
|
|
|
sh_video->gsh->codec ? sh_video->gsh->codec : "<unknown>");
|
2008-04-24 02:23:45 +00:00
|
|
|
}
|
2002-09-25 23:45:34 +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);
|
|
|
|
return sh_video->initialized;
|
2002-09-25 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 17:25:43 +00:00
|
|
|
void *decode_video(sh_video_t *sh_video, struct demux_packet *packet,
|
2008-04-24 02:23:45 +00:00
|
|
|
int drop_frame, double pts)
|
2007-03-11 17:30:43 +00:00
|
|
|
{
|
|
|
|
mp_image_t *mpi = NULL;
|
2008-04-16 04:11:12 +00:00
|
|
|
struct MPOpts *opts = sh_video->opts;
|
2007-03-11 17:30:43 +00:00
|
|
|
|
2008-04-16 04:11:12 +00:00
|
|
|
if (opts->correct_pts && pts != MP_NOPTS_VALUE) {
|
2008-04-24 02:23:45 +00:00
|
|
|
int delay = get_current_video_decoder_lag(sh_video);
|
|
|
|
if (delay >= 0) {
|
|
|
|
if (delay > sh_video->num_buffered_pts)
|
2006-07-06 06:58:17 +00:00
|
|
|
#if 0
|
2008-04-24 02:23:45 +00:00
|
|
|
// this is disabled because vd_ffmpeg reports the same lag
|
|
|
|
// after seek even when there are no buffered frames,
|
|
|
|
// leading to incorrect error messages
|
|
|
|
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
|
2006-07-06 06:58:17 +00:00
|
|
|
#else
|
2008-04-24 02:23:45 +00:00
|
|
|
;
|
2006-07-06 06:58:17 +00:00
|
|
|
#endif
|
2008-04-24 02:23:45 +00:00
|
|
|
else
|
|
|
|
sh_video->num_buffered_pts = delay;
|
|
|
|
}
|
|
|
|
if (sh_video->num_buffered_pts ==
|
|
|
|
sizeof(sh_video->buffered_pts) / sizeof(double))
|
|
|
|
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
|
|
|
|
else {
|
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < sh_video->num_buffered_pts; i++)
|
|
|
|
if (sh_video->buffered_pts[i] < pts)
|
|
|
|
break;
|
|
|
|
for (j = sh_video->num_buffered_pts; j > i; j--)
|
|
|
|
sh_video->buffered_pts[j] = sh_video->buffered_pts[j - 1];
|
|
|
|
sh_video->buffered_pts[i] = pts;
|
|
|
|
sh_video->num_buffered_pts++;
|
|
|
|
}
|
2007-03-11 17:30:43 +00:00
|
|
|
}
|
|
|
|
|
2013-03-28 19:16:11 +00:00
|
|
|
mpi = sh_video->vd_driver->decode(sh_video, packet, drop_frame, &pts);
|
2007-03-11 17:30:43 +00:00
|
|
|
|
|
|
|
//------------------------ frame decoded. --------------------
|
2002-03-01 00:25:43 +00:00
|
|
|
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
if (!mpi || drop_frame) {
|
|
|
|
talloc_free(mpi);
|
2008-04-24 02:23:45 +00:00
|
|
|
return NULL; // error / skipped frame
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
}
|
2002-03-11 01:13:13 +00:00
|
|
|
|
2013-05-20 22:45:42 +00:00
|
|
|
if (opts->field_dominance == 0)
|
2008-04-24 02:23:45 +00:00
|
|
|
mpi->fields |= MP_IMGFIELD_TOP_FIRST;
|
2013-05-20 22:45:42 +00:00
|
|
|
else if (opts->field_dominance == 1)
|
2008-04-24 02:23:45 +00:00
|
|
|
mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
|
2007-02-02 18:32:07 +00:00
|
|
|
|
2009-11-21 18:53:10 +00:00
|
|
|
double prevpts = sh_video->codec_reordered_pts;
|
|
|
|
sh_video->prev_codec_reordered_pts = prevpts;
|
|
|
|
sh_video->codec_reordered_pts = pts;
|
|
|
|
if (prevpts != MP_NOPTS_VALUE && pts <= prevpts
|
|
|
|
|| pts == MP_NOPTS_VALUE)
|
|
|
|
sh_video->num_reordered_pts_problems++;
|
|
|
|
prevpts = sh_video->sorted_pts;
|
2008-04-16 04:11:12 +00:00
|
|
|
if (opts->correct_pts) {
|
2008-04-24 02:23:45 +00:00
|
|
|
if (sh_video->num_buffered_pts) {
|
|
|
|
sh_video->num_buffered_pts--;
|
2009-11-21 18:53:10 +00:00
|
|
|
sh_video->sorted_pts =
|
|
|
|
sh_video->buffered_pts[sh_video->num_buffered_pts];
|
2008-04-24 02:23:45 +00:00
|
|
|
} else {
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_ERR,
|
2010-12-20 04:42:04 +00:00
|
|
|
"No pts value from demuxer to use for frame!\n");
|
2009-11-21 18:53:10 +00:00
|
|
|
sh_video->sorted_pts = MP_NOPTS_VALUE;
|
2008-04-24 02:23:45 +00:00
|
|
|
}
|
2007-03-11 17:30:43 +00:00
|
|
|
}
|
2009-11-21 18:53:10 +00:00
|
|
|
pts = sh_video->sorted_pts;
|
|
|
|
if (prevpts != MP_NOPTS_VALUE && pts <= prevpts
|
|
|
|
|| pts == MP_NOPTS_VALUE)
|
|
|
|
sh_video->num_sorted_pts_problems++;
|
2007-03-11 17:30:43 +00:00
|
|
|
return mpi;
|
2006-11-14 12:29:20 +00:00
|
|
|
}
|