2010-01-30 23:24:23 +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.
|
|
|
|
*/
|
|
|
|
|
2010-10-17 15:17:46 +00:00
|
|
|
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2007-02-17 21:04:46 +00:00
|
|
|
#include <stdlib.h>
|
2010-07-10 13:45:09 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2008-08-12 10:46:01 +00:00
|
|
|
#include "mpcommon.h"
|
2008-04-23 04:41:17 +00:00
|
|
|
#include "options.h"
|
2007-02-17 21:04:46 +00:00
|
|
|
#include "stream/stream.h"
|
|
|
|
#include "libmpdemux/demuxer.h"
|
|
|
|
#include "libmpdemux/stheader.h"
|
|
|
|
#include "mplayer.h"
|
|
|
|
#include "libvo/sub.h"
|
|
|
|
#include "libvo/video_out.h"
|
2009-01-25 20:35:58 +00:00
|
|
|
#include "cpudetect.h"
|
|
|
|
#include "mp_msg.h"
|
2007-02-17 21:04:46 +00:00
|
|
|
#include "spudec.h"
|
2009-01-25 20:35:58 +00:00
|
|
|
#include "version.h"
|
2007-02-17 21:04:46 +00:00
|
|
|
#include "vobsub.h"
|
2010-07-10 13:45:09 +00:00
|
|
|
#include "av_sub.h"
|
2009-10-29 22:13:04 +00:00
|
|
|
#include "libmpcodecs/dec_teletext.h"
|
2009-07-22 00:04:08 +00:00
|
|
|
#include "ffmpeg_files/intreadwrite.h"
|
2008-04-14 11:21:29 +00:00
|
|
|
#include "m_option.h"
|
2007-02-17 21:04:46 +00:00
|
|
|
|
|
|
|
double sub_last_pts = -303;
|
|
|
|
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ASS
|
2009-07-25 04:24:39 +00:00
|
|
|
#include "ass_mp.h"
|
2009-08-06 20:58:31 +00:00
|
|
|
ASS_Track *ass_track = 0; // current track to render
|
2007-02-17 21:04:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
sub_data* subdata = NULL;
|
|
|
|
subtitle* vo_sub_last = NULL;
|
|
|
|
|
2010-06-28 08:26:14 +00:00
|
|
|
const char *mencoder_version = "MEncoder " VERSION;
|
|
|
|
const char *mplayer_version = "MPlayer " VERSION;
|
2009-01-25 20:35:58 +00:00
|
|
|
|
|
|
|
void print_version(const char* name)
|
|
|
|
{
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_INFO, MP_TITLE, name);
|
|
|
|
|
|
|
|
/* Test for CPU capabilities (and corresponding OS support) for optimizing */
|
|
|
|
GetCpuCaps(&gCpuCaps);
|
|
|
|
#if ARCH_X86
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_V,
|
2009-01-25 22:52:00 +00:00
|
|
|
"CPUflags: MMX: %d MMX2: %d 3DNow: %d 3DNowExt: %d SSE: %d SSE2: %d SSSE3: %d\n",
|
2009-01-25 20:35:58 +00:00
|
|
|
gCpuCaps.hasMMX, gCpuCaps.hasMMX2,
|
|
|
|
gCpuCaps.has3DNow, gCpuCaps.has3DNowExt,
|
2009-01-25 22:52:00 +00:00
|
|
|
gCpuCaps.hasSSE, gCpuCaps.hasSSE2, gCpuCaps.hasSSSE3);
|
2009-04-08 20:21:21 +00:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-07-06 22:15:02 +00:00
|
|
|
mp_tmsg(MSGT_CPLAYER,MSGL_V, "Compiled with runtime CPU detection.\n");
|
2009-01-25 20:35:58 +00:00
|
|
|
#else
|
2009-07-06 22:15:02 +00:00
|
|
|
mp_tmsg(MSGT_CPLAYER,MSGL_V, "Compiled for x86 CPU with extensions:");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_MMX)
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," MMX");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_MMX2)
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," MMX2");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_AMD3DNOW)
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," 3DNow");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_AMD3DNOWEXT)
|
2009-01-25 22:49:51 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," 3DNowExt");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_SSE)
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," SSE");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_SSE2)
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," SSE2");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_SSSE3)
|
2009-01-25 22:52:00 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," SSSE3");
|
2009-01-26 11:24:05 +00:00
|
|
|
if (HAVE_CMOV)
|
2009-01-25 22:52:00 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V," CMOV");
|
2009-01-25 20:35:58 +00:00
|
|
|
mp_msg(MSGT_CPLAYER,MSGL_V,"\n");
|
2009-04-08 20:21:21 +00:00
|
|
|
#endif /* CONFIG_RUNTIME_CPUDETECT */
|
2009-01-25 20:35:58 +00:00
|
|
|
#endif /* ARCH_X86 */
|
|
|
|
}
|
|
|
|
|
2010-07-10 13:45:09 +00:00
|
|
|
static bool is_text_sub(int type)
|
|
|
|
{
|
|
|
|
return type == 't' || type == 'm' || type == 'a';
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool is_av_sub(int type)
|
|
|
|
{
|
2010-07-11 09:04:29 +00:00
|
|
|
return type == 'b' || type == 'p' || type == 'x';
|
2010-07-10 13:45:09 +00:00
|
|
|
}
|
2009-01-25 20:35:58 +00:00
|
|
|
|
2009-10-06 01:28:59 +00:00
|
|
|
void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts,
|
|
|
|
sh_video_t *sh_video, double refpts, double sub_offset,
|
|
|
|
demux_stream_t *d_dvdsub, int reset)
|
2007-02-17 21:04:46 +00:00
|
|
|
{
|
2010-07-10 12:53:05 +00:00
|
|
|
double curpts = refpts + sub_delay;
|
2007-02-17 21:04:46 +00:00
|
|
|
unsigned char *packet=NULL;
|
|
|
|
int len;
|
2010-07-10 13:45:09 +00:00
|
|
|
int type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v';
|
2007-02-17 21:04:46 +00:00
|
|
|
static subtitle subs;
|
|
|
|
if (reset) {
|
2008-01-06 20:27:14 +00:00
|
|
|
sub_clear_text(&subs, MP_NOPTS_VALUE);
|
|
|
|
if (vo_sub) {
|
2009-10-06 01:28:59 +00:00
|
|
|
set_osd_subtitle(mpctx, NULL);
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
|
|
|
if (vo_spudec) {
|
|
|
|
spudec_reset(vo_spudec);
|
|
|
|
vo_osd_changed(OSDTYPE_SPU);
|
|
|
|
}
|
2010-10-31 00:19:56 +00:00
|
|
|
#ifdef CONFIG_FFMPEG
|
2010-07-10 13:45:09 +00:00
|
|
|
if (is_av_sub(type))
|
|
|
|
reset_avsub(d_dvdsub->sh);
|
|
|
|
#endif
|
2009-10-06 01:28:59 +00:00
|
|
|
return;
|
2007-02-17 21:04:46 +00:00
|
|
|
}
|
|
|
|
// find sub
|
|
|
|
if (subdata) {
|
2009-09-23 21:21:58 +00:00
|
|
|
if (sub_fps==0) sub_fps = sh_video ? sh_video->fps : 25;
|
2008-01-06 20:27:14 +00:00
|
|
|
current_module = "find_sub";
|
2009-09-23 19:01:33 +00:00
|
|
|
if (refpts > sub_last_pts || refpts < sub_last_pts-1.0) {
|
2010-07-10 12:53:05 +00:00
|
|
|
find_sub(mpctx, subdata, curpts *
|
2009-07-06 23:26:13 +00:00
|
|
|
(subdata->sub_uses_time ? 100. : sub_fps));
|
2008-01-06 20:27:14 +00:00
|
|
|
if (vo_sub) vo_sub_last = vo_sub;
|
|
|
|
// FIXME! frame counter...
|
2009-09-23 19:01:33 +00:00
|
|
|
sub_last_pts = refpts;
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
2007-02-17 21:04:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DVD sub:
|
2010-07-11 09:03:13 +00:00
|
|
|
if (vobsub_id >= 0 || type == 'v') {
|
2008-01-06 20:27:14 +00:00
|
|
|
int timestamp;
|
|
|
|
current_module = "spudec";
|
2010-07-10 12:53:05 +00:00
|
|
|
/* Get a sub packet from the DVD or a vobsub */
|
2008-01-06 20:27:14 +00:00
|
|
|
while(1) {
|
|
|
|
// Vobsub
|
|
|
|
len = 0;
|
|
|
|
if (vo_vobsub) {
|
2010-07-10 12:53:05 +00:00
|
|
|
if (curpts >= 0) {
|
|
|
|
len = vobsub_get_packet(vo_vobsub, curpts,
|
2008-01-06 20:27:14 +00:00
|
|
|
(void**)&packet, ×tamp);
|
|
|
|
if (len > 0) {
|
2009-09-23 19:01:33 +00:00
|
|
|
mp_dbg(MSGT_CPLAYER,MSGL_V,"\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,refpts,sh_video->timer,timestamp / 90000.0,timestamp);
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// DVD sub
|
|
|
|
len = ds_get_packet_sub(d_dvdsub, (unsigned char**)&packet);
|
|
|
|
if (len > 0) {
|
|
|
|
// XXX This is wrong, sh_video->pts can be arbitrarily
|
|
|
|
// much behind demuxing position. Unfortunately using
|
|
|
|
// d_video->pts which would have been the simplest
|
|
|
|
// improvement doesn't work because mpeg specific hacks
|
|
|
|
// in video.c set d_video->pts to 0.
|
2009-09-23 19:01:33 +00:00
|
|
|
float x = d_dvdsub->pts - refpts;
|
2008-01-06 20:27:14 +00:00
|
|
|
if (x > -20 && x < 20) // prevent missing subs on pts reset
|
2010-07-10 12:53:05 +00:00
|
|
|
timestamp = 90000*d_dvdsub->pts;
|
|
|
|
else timestamp = 90000*curpts;
|
2008-01-06 20:27:14 +00:00
|
|
|
mp_dbg(MSGT_CPLAYER, MSGL_V, "\rDVD sub: len=%d "
|
|
|
|
"v_pts=%5.3f s_pts=%5.3f ts=%d \n", len,
|
2009-09-23 19:01:33 +00:00
|
|
|
refpts, d_dvdsub->pts, timestamp);
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (len<=0 || !packet) break;
|
2010-07-10 18:11:05 +00:00
|
|
|
// create it only here, since with some broken demuxers we might
|
|
|
|
// type = v but no DVD sub and we currently do not change the
|
|
|
|
// "original frame size" ever after init, leading to wrong-sized
|
|
|
|
// PGS subtitles.
|
|
|
|
if (!vo_spudec)
|
|
|
|
vo_spudec = spudec_new(NULL);
|
2008-01-06 20:27:14 +00:00
|
|
|
if (vo_vobsub || timestamp >= 0)
|
|
|
|
spudec_assemble(vo_spudec, packet, len, timestamp);
|
|
|
|
}
|
2010-07-11 09:03:13 +00:00
|
|
|
} else if (is_text_sub(type) || is_av_sub(type) || type == 'd') {
|
2009-11-10 11:31:47 +00:00
|
|
|
if (type == 'd' && !d_dvdsub->demuxer->teletext) {
|
|
|
|
tt_stream_props tsp = {0};
|
|
|
|
void *ptr = &tsp;
|
|
|
|
if (teletext_control(NULL, TV_VBI_CONTROL_START, &ptr) == VBI_CONTROL_TRUE)
|
|
|
|
d_dvdsub->demuxer->teletext = ptr;
|
|
|
|
}
|
2009-11-01 09:48:34 +00:00
|
|
|
if (d_dvdsub->non_interleaved)
|
|
|
|
ds_get_next_pts(d_dvdsub);
|
2010-07-10 13:45:09 +00:00
|
|
|
|
|
|
|
int orig_type = type;
|
2008-01-06 20:27:14 +00:00
|
|
|
while (d_dvdsub->first) {
|
2009-10-06 01:28:59 +00:00
|
|
|
double subpts = ds_get_next_pts(d_dvdsub) + sub_offset;
|
2010-07-10 13:45:09 +00:00
|
|
|
type = orig_type;
|
2009-12-02 15:57:47 +00:00
|
|
|
if (subpts > curpts) {
|
|
|
|
// Libass handled subs can be fed to it in advance
|
2010-07-10 13:45:09 +00:00
|
|
|
if (!opts->ass_enabled || !is_text_sub(type))
|
2009-12-02 15:57:47 +00:00
|
|
|
break;
|
|
|
|
// Try to avoid demuxing whole file at once
|
|
|
|
if (d_dvdsub->non_interleaved && subpts > curpts + 1)
|
|
|
|
break;
|
|
|
|
}
|
2010-07-10 13:45:09 +00:00
|
|
|
double endpts = d_dvdsub->first->endpts + sub_offset;
|
2008-01-06 20:27:14 +00:00
|
|
|
len = ds_get_packet_sub(d_dvdsub, &packet);
|
2010-07-10 13:45:09 +00:00
|
|
|
if (is_av_sub(type)) {
|
2010-10-31 00:19:56 +00:00
|
|
|
#ifdef CONFIG_FFMPEG
|
2010-07-10 13:45:09 +00:00
|
|
|
type = decode_avsub(d_dvdsub->sh, &packet, &len, &subpts, &endpts);
|
|
|
|
if (type <= 0)
|
|
|
|
#endif
|
|
|
|
continue;
|
|
|
|
}
|
2008-01-27 16:13:21 +00:00
|
|
|
if (type == 'm') {
|
|
|
|
if (len < 2) continue;
|
|
|
|
len = FFMIN(len - 2, AV_RB16(packet));
|
|
|
|
packet += 2;
|
|
|
|
}
|
2009-11-10 11:31:47 +00:00
|
|
|
if (type == 'd') {
|
|
|
|
if (d_dvdsub->demuxer->teletext) {
|
|
|
|
uint8_t *p = packet;
|
|
|
|
p++;
|
|
|
|
len--;
|
|
|
|
while (len >= 46) {
|
|
|
|
int sublen = p[1];
|
|
|
|
if (p[0] == 2 || p[0] == 3)
|
|
|
|
teletext_control(d_dvdsub->demuxer->teletext,
|
|
|
|
TV_VBI_CONTROL_DECODE_DVB, p + 2);
|
|
|
|
p += sublen + 2;
|
|
|
|
len -= sublen + 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ASS
|
2009-12-02 15:36:59 +00:00
|
|
|
if (opts->ass_enabled) {
|
2008-01-11 21:45:17 +00:00
|
|
|
sh_sub_t* sh = d_dvdsub->sh;
|
|
|
|
ass_track = sh ? sh->ass_track : NULL;
|
2008-01-27 16:36:35 +00:00
|
|
|
if (!ass_track) continue;
|
|
|
|
if (type == 'a') { // ssa/ass subs with libass
|
2008-01-11 21:45:17 +00:00
|
|
|
ass_process_chunk(ass_track, packet, len,
|
2009-09-23 18:28:20 +00:00
|
|
|
(long long)(subpts*1000 + 0.5),
|
|
|
|
(long long)((endpts-subpts)*1000 + 0.5));
|
2008-01-27 16:38:04 +00:00
|
|
|
} else { // plaintext subs with libass
|
2009-09-23 18:28:20 +00:00
|
|
|
if (subpts != MP_NOPTS_VALUE) {
|
2009-12-18 19:29:33 +00:00
|
|
|
subtitle tmp_subs = {0};
|
2009-09-23 18:28:20 +00:00
|
|
|
if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3;
|
2009-12-18 19:29:33 +00:00
|
|
|
sub_add_text(&tmp_subs, packet, len, endpts);
|
|
|
|
tmp_subs.start = subpts * 100;
|
|
|
|
tmp_subs.end = endpts * 100;
|
|
|
|
ass_process_subtitle(ass_track, &tmp_subs);
|
|
|
|
sub_clear_text(&tmp_subs, MP_NOPTS_VALUE);
|
2008-01-27 16:38:04 +00:00
|
|
|
}
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
2008-01-11 21:45:17 +00:00
|
|
|
continue;
|
|
|
|
}
|
2007-02-17 21:04:46 +00:00
|
|
|
#endif
|
2009-09-23 18:28:20 +00:00
|
|
|
if (subpts != MP_NOPTS_VALUE) {
|
2008-01-06 20:27:14 +00:00
|
|
|
if (endpts == MP_NOPTS_VALUE)
|
|
|
|
sub_clear_text(&subs, MP_NOPTS_VALUE);
|
2008-01-11 21:45:17 +00:00
|
|
|
if (type == 'a') { // ssa/ass subs without libass => convert to plaintext
|
|
|
|
int i;
|
|
|
|
unsigned char* p = packet;
|
|
|
|
for (i=0; i < 8 && *p != '\0'; p++)
|
|
|
|
if (*p == ',')
|
|
|
|
i++;
|
|
|
|
if (*p == '\0') /* Broken line? */
|
|
|
|
continue;
|
|
|
|
len -= p - packet;
|
|
|
|
packet = p;
|
|
|
|
}
|
2008-01-06 20:27:14 +00:00
|
|
|
sub_add_text(&subs, packet, len, endpts);
|
2009-10-06 01:28:59 +00:00
|
|
|
set_osd_subtitle(mpctx, &subs);
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
2009-11-01 09:48:34 +00:00
|
|
|
if (d_dvdsub->non_interleaved)
|
|
|
|
ds_get_next_pts(d_dvdsub);
|
2008-01-06 20:27:14 +00:00
|
|
|
}
|
2009-12-18 17:18:19 +00:00
|
|
|
if (!opts->ass_enabled)
|
|
|
|
if (sub_clear_text(&subs, curpts))
|
|
|
|
set_osd_subtitle(mpctx, &subs);
|
2007-02-17 21:04:46 +00:00
|
|
|
}
|
2010-07-10 13:45:09 +00:00
|
|
|
if (vo_spudec) {
|
|
|
|
spudec_heartbeat(vo_spudec, 90000*curpts);
|
|
|
|
if (spudec_changed(vo_spudec))
|
|
|
|
vo_osd_changed(OSDTYPE_SPU);
|
|
|
|
}
|
|
|
|
|
2007-02-17 21:04:46 +00:00
|
|
|
current_module=NULL;
|
|
|
|
}
|
2007-07-29 17:57:39 +00:00
|
|
|
|
|
|
|
void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset)
|
|
|
|
{
|
2007-09-08 03:06:23 +00:00
|
|
|
int page_changed;
|
|
|
|
|
2009-11-07 12:31:05 +00:00
|
|
|
if (!demuxer->teletext)
|
|
|
|
return;
|
2007-07-29 17:57:39 +00:00
|
|
|
|
2007-09-08 03:06:23 +00:00
|
|
|
//Also forcing page update when such ioctl is not supported or call error occured
|
2009-11-07 12:31:05 +00:00
|
|
|
if(teletext_control(demuxer->teletext,TV_VBI_CONTROL_IS_CHANGED,&page_changed)!=VBI_CONTROL_TRUE)
|
2007-09-08 03:06:23 +00:00
|
|
|
page_changed=1;
|
|
|
|
|
|
|
|
if(!page_changed)
|
|
|
|
return;
|
|
|
|
|
2009-11-07 12:31:05 +00:00
|
|
|
if(teletext_control(demuxer->teletext,TV_VBI_CONTROL_GET_VBIPAGE,&vo_osd_teletext_page)!=VBI_CONTROL_TRUE)
|
2007-07-29 17:57:39 +00:00
|
|
|
vo_osd_teletext_page=NULL;
|
2009-11-07 12:31:05 +00:00
|
|
|
if(teletext_control(demuxer->teletext,TV_VBI_CONTROL_GET_HALF_PAGE,&vo_osd_teletext_half)!=VBI_CONTROL_TRUE)
|
2007-07-29 17:57:39 +00:00
|
|
|
vo_osd_teletext_half=0;
|
2009-11-07 12:31:05 +00:00
|
|
|
if(teletext_control(demuxer->teletext,TV_VBI_CONTROL_GET_MODE,&vo_osd_teletext_mode)!=VBI_CONTROL_TRUE)
|
2007-07-29 17:57:39 +00:00
|
|
|
vo_osd_teletext_mode=0;
|
2009-11-07 12:31:05 +00:00
|
|
|
if(teletext_control(demuxer->teletext,TV_VBI_CONTROL_GET_FORMAT,&vo_osd_teletext_format)!=VBI_CONTROL_TRUE)
|
2007-07-29 17:57:39 +00:00
|
|
|
vo_osd_teletext_format=0;
|
|
|
|
vo_osd_changed(OSDTYPE_TELETEXT);
|
2007-09-08 03:06:23 +00:00
|
|
|
|
2009-11-07 12:31:05 +00:00
|
|
|
teletext_control(demuxer->teletext,TV_VBI_CONTROL_MARK_UNCHANGED,NULL);
|
2007-07-29 17:57:39 +00:00
|
|
|
}
|
2008-02-29 17:25:50 +00:00
|
|
|
|
|
|
|
int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang)
|
|
|
|
{
|
2008-03-30 16:55:46 +00:00
|
|
|
if (audio_id == -1)
|
2010-11-08 11:05:49 +00:00
|
|
|
audio_id = demuxer_audio_track_by_lang_and_default(demuxer, audio_lang);
|
2008-02-29 17:25:50 +00:00
|
|
|
if (audio_id != -1) // -1 (automatic) is the default behaviour of demuxers
|
|
|
|
demuxer_switch_audio(demuxer, audio_id);
|
|
|
|
if (audio_id == -2) { // some demuxers don't yet know how to switch to no sound
|
|
|
|
demuxer->audio->id = -2;
|
|
|
|
demuxer->audio->sh = NULL;
|
|
|
|
}
|
|
|
|
return demuxer->audio->id;
|
|
|
|
}
|
2008-04-14 11:21:29 +00:00
|
|
|
|
2010-06-01 20:49:22 +00:00
|
|
|
bool attachment_is_font(struct demux_attachment *att)
|
|
|
|
{
|
|
|
|
if (!att->name || !att->type || !att->data || !att->data_size)
|
|
|
|
return false;
|
|
|
|
// match against MIME types
|
|
|
|
if (strcmp(att->type, "application/x-truetype-font") == 0
|
|
|
|
|| strcmp(att->type, "application/x-font") == 0)
|
|
|
|
return true;
|
|
|
|
// fallback: match against file extension
|
|
|
|
if (strlen(att->name) > 4) {
|
|
|
|
char *ext = att->name + strlen(att->name) - 4;
|
|
|
|
if (strcasecmp(ext, ".ttf") == 0 || strcasecmp(ext, ".ttc") == 0
|
|
|
|
|| strcasecmp(ext, ".otf") == 0)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-04-14 11:21:29 +00:00
|
|
|
/* Parse -noconfig common to both programs */
|
|
|
|
int disable_system_conf=0;
|
|
|
|
int disable_user_conf=0;
|
|
|
|
|
|
|
|
/* Disable all configuration files */
|
|
|
|
static void noconfig_all(void)
|
|
|
|
{
|
|
|
|
disable_system_conf = 1;
|
|
|
|
disable_user_conf = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
const m_option_t noconfig_opts[] = {
|
|
|
|
{"all", noconfig_all, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
|
|
|
|
{"system", &disable_system_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
|
|
|
|
{"user", &disable_user_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
|
|
|
|
{NULL, NULL, 0, 0, 0, 0, NULL}
|
|
|
|
};
|
2010-03-17 09:12:51 +00:00
|
|
|
|