* text.c: text subtitles parser
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: text.c,v 1.4 2003/01/30 16:36:04 gbazin Exp $
+ * $Id: text.c,v 1.5 2003/05/11 14:33:32 sigmunau Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+/* define USE_FREETYPE here to disable the old style subtitles */
+
/*****************************************************************************
* Preamble
*****************************************************************************/
*****************************************************************************/
void E_(ParseText)( spudec_thread_t *p_spudec, subtitler_font_t *p_font )
{
+#if !defined(USE_FREETYPE)
char * psz_subtitle;
mtime_t i_pts, i_dts;
-
/* We cannot display a subpicture with no date */
i_pts = p_spudec->bit_stream.p_pes->i_pts;
i_dts = p_spudec->bit_stream.p_pes->i_dts;
* p_spudec->bit_stream->p_data is valid since we check later on
* for b_die and b_error */
NextDataPacket( p_spudec->p_fifo, &p_spudec->bit_stream );
+#else
+ msleep(10);
+#endif
}
* sub.c
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: sub.c,v 1.13 2003/05/05 22:23:37 gbazin Exp $
+ * $Id: sub.c,v 1.14 2003/05/11 14:33:32 sigmunau Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+/* define USE_FREETYPE to use freetype for subtitles */
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/input.h>
-
+#if defined(USE_FREETYPE)
+#include <osd.h>
+#endif
#include "video.h"
#include "sub.h"
*****************************************************************************/
static int sub_demux( subtitle_demux_t *p_sub, mtime_t i_maxdate )
{
-
+#if defined(USE_FREETYPE)
+ vlc_object_t *p_vout = NULL;
+#endif
if( p_sub->p_es->p_decoder_fifo && !p_sub->i_previously_selected )
{
p_sub->i_previously_selected = 1;
data_packet_t *p_data;
int i_len;
+#if defined(USE_FREETYPE)
+ p_vout = vlc_object_find( p_sub, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+#endif
i_len = strlen( p_sub->subtitle[p_sub->i_subtitle].psz_text ) + 1;
{
p_pes->i_dts = 0;
}
+#if defined(USE_FREETYPE)
+ if( p_vout )
+ {
+ vlc_value_t val, lockval;
+ if( var_Get( p_vout, "lock", &lockval ) == VLC_SUCCESS )
+ {
+ int64_t i_tmp;
+ vlc_mutex_lock( lockval.p_address );
+ msg_Dbg( p_sub, "pts "I64Fd" dts " I64Fd, p_pes->i_pts,
+ p_pes->i_dts );
+ i_tmp = p_pes->i_dts - p_pes->i_pts;
+ val.i_int = OSD_ALIGN_LEFT|OSD_ALIGN_BOTTOM;
+ var_Set( p_vout, "flags", val );
+ val.time.i_low = (int)(p_pes->i_pts+p_sub->p_input->i_pts_delay);
+ val.time.i_high = (int)( p_pes->i_pts >> 32 );
+ var_Set( p_vout, "start-date", val );
+ val.time.i_low = (int)(p_pes->i_dts + p_sub->p_input->i_pts_delay);
+ val.time.i_high = (int)( p_pes->i_dts >> 32 );
+ var_Set( p_vout, "stop-date", val );
+ val.i_int = 20;
+ var_Set( p_vout, "x-margin", val );
+ val.i_int = 20;
+ var_Set( p_vout, "y-margin", val );
+ val.psz_string = p_sub->subtitle[p_sub->i_subtitle].psz_text;
+ var_Set( p_vout, "string", val );
+ vlc_mutex_unlock( lockval.p_address );
+ }
+ }
+#endif
p_pes->i_nb_data = 1;
p_pes->p_first =
p_pes->p_last = p_data;
p_sub->i_subtitle++;
}
+#if defined(USE_FREETYPE)
+ if ( p_vout )
+ {
+ vlc_object_release( p_vout );
+ }
+#endif
return( 0 );
}