/*****************************************************************************
* marq.c : marquee display video plugin for vlc
*****************************************************************************
- * Copyright (C) 2003-2008 the VideoLAN team
+ * Copyright (C) 2003-2008 VLC authors and VideoLAN
* $Id$
*
* Authors: Mark Moriarty
* Sigmund Augdal Helberg <dnumgis@videolan.org>
* Antoine Cellerier <dionoea . videolan \ org>
*
- * This program 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
# include "config.h"
#endif
+#include <errno.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
-
#include <vlc_filter.h>
#include <vlc_block.h>
#include <vlc_fs.h>
-
#include <vlc_strings.h>
/*****************************************************************************
static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t );
-static char *ReadFile( filter_t *, const char * );
+static char *MarqueeReadFile( filter_t *, const char * );
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
#define MSG_LONGTEXT N_( \
"Marquee text to display. " \
"(Available format strings: " \
- "Time related: %Y = year, %m = month, %d = day, %H = hour, " \
- "%M = minute, %S = second, ... " \
- "Meta data related: $a = artist, $b = album, $c = copyright, " \
- "$d = description, $e = encoded by, $g = genre, " \
- "$l = language, $n = track num, $p = now playing, " \
- "$r = rating, $s = subtitles language, $t = title, "\
- "$u = url, $A = date, " \
- "$B = audio bitrate (in kb/s), $C = chapter," \
- "$D = duration, $F = full name with path, $I = title, "\
- "$L = time left, " \
- "$N = name, $O = audio language, $P = position (in %), $R = rate, " \
- "$S = audio sample rate (in kHz), " \
- "$T = time, $U = publisher, $V = volume, $_ = new line) ")
+ "%Y = year, %m = month, %d = day, %H = hour, " \
+ "%M = minute, %S = second, ...)" )
#define FILE_TEXT N_("Text file")
#define FILE_LONGTEXT N_("File to read the marquee text from.")
#define POSX_TEXT N_("X offset")
static const char *const ppsz_filter_options[] = {
"marquee", "x", "y", "position", "color", "size", "timeout", "refresh",
- "opacity",
+ "opacity","file",
NULL
};
if( p_sys->filepath != NULL )
{
- char *fmt = ReadFile( p_filter, p_sys->filepath );
+ char *fmt = MarqueeReadFile( p_filter, p_sys->filepath );
if( fmt != NULL )
{
free( p_sys->format );
}
}
- char *msg = str_format( p_filter, p_sys->format ? p_sys->format : "" );
+ char *msg = str_format_time( p_sys->format ? p_sys->format : "" );
if( unlikely( msg == NULL ) )
goto out;
if( p_sys->message != NULL && !strcmp( msg, p_sys->message ) )
p_spu->p_region = subpicture_region_New( &fmt );
if( !p_spu->p_region )
{
- p_filter->pf_sub_buffer_del( p_filter, p_spu );
+ subpicture_Delete( p_spu );
p_spu = NULL;
goto out;
}
return p_spu;
}
-static char *ReadFile( filter_t *obj, const char *path )
+static char *MarqueeReadFile( filter_t *obj, const char *path )
{
FILE *stream = vlc_fopen( path, "rt" );
if( stream == NULL )
{
- msg_Err( obj, "cannot open %s: %m", path );
+ msg_Err( obj, "cannot open %s: %s", path, vlc_strerror_c(errno) );
return NULL;
}
ssize_t len = getline( &line, &(size_t){ 0 }, stream );
if( len == -1 )
{
- msg_Err( obj, "cannot read %s: %m", path );
+ msg_Err( obj, "cannot read %s: %s", path, vlc_strerror_c(errno) );
clearerr( stream );
line = NULL;
}