Commit 0925ed0b authored by Laurent Aimar's avatar Laurent Aimar

* src/video_output/video_output.c : do not use FIND_ANYWHERE to catch

 the playlist.  but use FIND_PARENT. vlc_object_find  with FIND_ANYWHERE
 use p_obj->p_vlc as a starting point  and that doesn't work as playlist
 is  detach from  vlc before  vout is  destroyed by  the decoders  (when
 shutting down)  Perhaps vlc_object_find  should be  fixing to  find the
 root object, but I'm not sure.

 * src/input/*  : move  subtitle handling  from avi  to input.  Now subs
 should works with all file types _BUT_ won't be in synch if the demuxer
 doesn't implement a _precise_ DEMUX_GET_TIME.  So only .avi, .mp4 will
 be ok. Others could works if perfectly cbr.
  Now  Subtitle  track is  only  selected  when specified  by  sub-file
 option.(auto-dectected file is always added but not selected by default)
  Btw, the code could support multiple  subs files, but I don't know how
 to pass multiple filenames, any ideas ?


 * demux/mpeg/mpga.c : play with es_out_t. I'm investigating for now so
 don't use that elsewhere.
parent a903f128
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.95 2003/09/12 18:34:44 fenrir Exp $
* $Id: input_ext-intf.h,v 1.96 2003/09/13 17:42:15 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -346,6 +346,9 @@ struct input_thread_t
char * psz_name;
count_t c_loops;
/* private, do not touch it */
input_thread_sys_t *p_sys;
};
/* Input methods */
......
......@@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.10 2003/09/12 18:34:44 fenrir Exp $
* $Id: ninput.h,v 1.11 2003/09/13 17:42:15 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -36,9 +36,9 @@ typedef struct
int i_cat;
vlc_fourcc_t i_codec;
int i_group; /* eg -1. if >= 0 then a "group" (program) is
created for each value */
int i_group; /* -1 : standalone
>= 0 then a "group" (program) is created
for each value */
int i_priority; /* -2 : mean not selectable by the users
-1 : mean not selected by default even
when no other stream
......@@ -78,7 +78,7 @@ static inline void es_format_Init( es_format_t *fmt,
{
fmt->i_cat = i_cat;
fmt->i_codec = i_codec;
fmt->i_group = -1;
fmt->i_group = 0;
fmt->i_priority = 0;
fmt->psz_language = NULL;
fmt->psz_description = NULL;
......@@ -213,7 +213,9 @@ enum demux_query_e
DEMUX_GET_TIME, /* arg1= int64_t * res= */
DEMUX_SET_TIME, /* arg1= int64_t res=can fail */
DEMUX_GET_LENGTH /* arg1= int64_t * res=can fail */
DEMUX_GET_LENGTH, /* arg1= int64_t * res=can fail */
DEMUX_GET_FPS /* arg1= float * res=can fail */
};
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.77 2003/09/12 18:34:44 fenrir Exp $
* $Id: vlc_common.h,v 1.78 2003/09/13 17:42:15 fenrir Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -211,6 +211,7 @@ typedef struct intf_channel_t intf_channel_t;
/* Input */
typedef struct input_thread_t input_thread_t;
typedef struct input_thread_sys_t input_thread_sys_t;
typedef struct input_channel_t input_channel_t;
typedef struct input_area_t input_area_t;
typedef struct input_buffers_t input_buffers_t;
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.61 2003/09/12 16:26:40 fenrir Exp $
* $Id: avi.c,v 1.62 2003/09/13 17:42:15 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -29,8 +29,6 @@
#include <vlc/input.h>
#include "codecs.h"
#include "../util/sub.h"
#include "libavi.h"
#include "avi.h"
......@@ -123,7 +121,6 @@ static int Open( vlc_object_t * p_this )
demux_sys_t *p_avi;
es_descriptor_t *p_es = NULL; /* avoid warning */
unsigned int i;
mtime_t i_microsecperframe = 0; // for some subtitle format
vlc_bool_t b_stream_audio, b_stream_video;
uint8_t *p_peek;
......@@ -377,12 +374,6 @@ static int Open( vlc_object_t * p_this )
input_AddInfo( p_cat, _("Bits Per Pixel"), "%d",
p_avi_strf_vids->p_bih->biBitCount );
}
if( i_microsecperframe == 0 )
{
i_microsecperframe = (mtime_t)1000000 *
(mtime_t)p_info->i_scale /
(mtime_t)p_info->i_rate;
}
break;
default:
msg_Warn( p_input, "stream[%d] unknown type", i );
......@@ -424,11 +415,6 @@ static int Open( vlc_object_t * p_this )
#undef p_info
}
if( ( p_avi->p_sub = subtitle_New( p_input, NULL, i_microsecperframe ) ) )
{
subtitle_Select( p_avi->p_sub );
}
if( config_GetInt( p_input, "avi-index" ) )
{
if( p_avi->b_seekable )
......@@ -572,10 +558,6 @@ static void Close ( vlc_object_t * p_this )
}
}
FREE( p_avi->pp_info );
if( p_avi->p_sub )
{
subtitle_Close( p_avi->p_sub );
}
AVI_ChunkFreeRoot( p_input->s, &p_avi->ck_root );
free( p_avi );
......@@ -658,11 +640,6 @@ static int Demux_Seekable( input_thread_t *p_input )
p_avi->i_time += 25*1000; /* read 25ms */
if( p_avi->p_sub )
{
subtitle_Demux( p_avi->p_sub, p_avi->i_time );
}
/* Check if we need to send the audio data to decoder */
b_play_audio = !p_input->stream.control.b_mute;
......@@ -1227,6 +1204,7 @@ static int Seek( input_thread_t *p_input, mtime_t i_date, int i_percent )
static int Control( input_thread_t *p_input, int i_query, va_list args )
{
demux_sys_t *p_sys = p_input->p_demux_data;
int i;
double f, *pf;
int64_t i64, *pi64;
......@@ -1276,10 +1254,6 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
f = (double)va_arg( args, double );
i64 = (mtime_t)(1000000.0 * p_sys->i_length * f );
i_ret = Seek( p_input, i64, (int)(f * 100) );
if( p_sys->p_sub )
{
subtitle_Seek( p_sys->p_sub, p_sys->i_time );
}
return i_ret;
}
else
......@@ -1301,6 +1275,21 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
*pi64 = p_sys->i_length * (mtime_t)1000000;
return VLC_SUCCESS;
case DEMUX_GET_FPS:
pf = (double*)va_arg( args, double * );
*pf = 0.0;
for( i = 0; i < (int)p_sys->i_streams; i++ )
{
#define tk p_sys->pp_info[i]
if( tk->i_cat == VIDEO_ES && tk->i_scale > 0)
{
*pf = (float)tk->i_rate / (float)tk->i_scale;
break;
}
#undef tk
}
return VLC_SUCCESS;
default:
return demux_vaControlDefault( p_input, i_query, args );
}
......
......@@ -2,7 +2,7 @@
* avi.h : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.h,v 1.14 2003/09/12 16:26:40 fenrir Exp $
* $Id: avi.h,v 1.15 2003/09/13 17:42:15 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -85,7 +85,5 @@ struct demux_sys_t
/* number of streams and information */
unsigned int i_streams;
avi_stream_t **pp_info;
subtitle_demux_t *p_sub;
};
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.37 2003/09/12 16:26:40 fenrir Exp $
* $Id: mp4.c,v 1.38 2003/09/13 17:42:16 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -618,7 +618,9 @@ static int Control ( input_thread_t *p_input, int i_query, va_list args )
(mtime_t)p_sys->i_duration /
(mtime_t)p_sys->i_timescale;
return VLC_SUCCESS;
case DEMUX_GET_FPS:
msg_Warn( p_input, "DEMUX_GET_FPS unimplemented !!" );
return VLC_EGENERIC;
default:
msg_Err( p_input, "control query unimplemented !!!" );
return demux_vaControlDefault( p_input, i_query, args );
......
......@@ -2,7 +2,7 @@
* mpga.c : MPEG-I/II Audio input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mpga.c,v 1.5 2003/09/12 16:26:40 fenrir Exp $
* $Id: mpga.c,v 1.6 2003/09/13 17:42:16 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -57,7 +57,9 @@ struct demux_sys_t
mtime_t i_time;
int i_bitrate_avg; /* extracted from Xing header */
es_descriptor_t *p_es;
es_out_id_t *p_es;
//es_descriptor_t *p_es;
};
static int HeaderCheck( uint32_t h )
......@@ -173,6 +175,8 @@ static int Open( vlc_object_t * p_this )
module_t *p_id3;
es_format_t fmt;
if( p_input->psz_demux &&
( !strncmp( p_input->psz_demux, "mpga", 4 ) ||
......@@ -334,28 +338,11 @@ static int Open( vlc_object_t * p_this )
msg_Err( p_input, "cannot init stream" );
goto error;
}
if( input_AddProgram( p_input, 0, 0) == NULL )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot add program" );
goto error;
}
p_input->stream.pp_programs[0]->b_is_ok = 0;
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
p_input->stream.i_mux_rate = p_sys->i_bitrate_avg / 8 / 50;
p_sys->p_es = input_AddES( p_input,
p_input->stream.p_selected_program,
1 , AUDIO_ES, NULL, 0 );
p_sys->p_es->i_stream_id = 1;
p_sys->p_es->i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'a' );
input_SelectES( p_input, p_sys->p_es );
p_input->stream.p_selected_program->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) );
p_sys->p_es = es_out_Add( p_input->p_es_out, &fmt );
return VLC_SUCCESS;
error:
......@@ -431,14 +418,8 @@ static int Demux( input_thread_t * p_input )
p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 );
if( !p_sys->p_es->p_decoder_fifo )
{
msg_Err( p_input, "no audio decoder" );
input_DeletePES( p_input->p_method_data, p_pes );
return( -1 );
}
es_out_Send( p_input->p_es_out, p_sys->p_es, p_pes );
input_DecodePES( p_sys->p_es->p_decoder_fifo, p_pes );
p_sys->i_time += (mtime_t)1000000 *
(mtime_t)mpga_frame_samples( header ) /
(mtime_t)MPGA_SAMPLE_RATE( header );
......
......@@ -2,7 +2,7 @@
* demux.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: demux.c,v 1.2 2003/09/07 22:51:11 fenrir Exp $
* $Id: demux.c,v 1.3 2003/09/13 17:42:16 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -133,6 +133,9 @@ int demux_vaControlDefault( input_thread_t *p_input, int i_query, va_list args
i_ret = VLC_EGENERIC;
}
break;
case DEMUX_GET_FPS:
i_ret = VLC_EGENERIC;
break;
default:
msg_Err( p_input, "unknown query in demux_vaControlDefault !!!" );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.50 2003/09/10 11:37:53 fenrir Exp $
* $Id: playlist.c,v 1.51 2003/09/13 17:42:16 fenrir Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -692,11 +692,10 @@ static void RunThread ( playlist_t *p_playlist )
}
else if( p_playlist->i_status == PLAYLIST_STOPPED )
{
ObjectGarbageCollector( p_playlist, VLC_OBJECT_VOUT,
&b_vout_destroyed, &i_vout_destroyed_date );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_SOUT,
&b_sout_destroyed, &i_sout_destroyed_date );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_VOUT,
&b_vout_destroyed, &i_vout_destroyed_date );
}
vlc_mutex_unlock( &p_playlist->object_lock );
......@@ -721,11 +720,15 @@ static void RunThread ( playlist_t *p_playlist )
/* Unlink current input */
p_input = p_playlist->p_input;
p_playlist->p_input = NULL;
vlc_object_detach( p_input );
vlc_mutex_unlock( &p_playlist->object_lock );
/* Destroy input */
input_DestroyThread( p_input );
/* Unlink current input (_after_ input_DestroyThread for vout
* garbage collector)*/
vlc_object_detach( p_input );
/* Destroy object */
vlc_object_destroy( p_input );
continue;
}
......@@ -750,20 +753,21 @@ static void RunThread ( playlist_t *p_playlist )
msleep( INTF_IDLE_SLEEP );
}
/* close all remaining vout */
/* close all remaining sout */
while( ( p_obj = vlc_object_find( p_playlist,
VLC_OBJECT_VOUT, FIND_CHILD ) ) )
VLC_OBJECT_SOUT, FIND_CHILD ) ) )
{
vlc_object_detach( p_obj );
vlc_object_release( p_obj );
vout_Destroy( (vout_thread_t *)p_obj );
sout_DeleteInstance( (sout_instance_t*)p_obj );
}
/* close all remaining sout */
/* close all remaining vout */
while( ( p_obj = vlc_object_find( p_playlist,
VLC_OBJECT_SOUT, FIND_CHILD ) ) )
VLC_OBJECT_VOUT, FIND_CHILD ) ) )
{
vlc_object_detach( p_obj );
vlc_object_release( p_obj );
sout_DeleteInstance( (sout_instance_t*)p_obj );
vout_Destroy( (vout_thread_t *)p_obj );
}
}
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.233 2003/09/07 22:43:17 fenrir Exp $
* $Id: video_output.c,v 1.234 2003/09/13 17:42:16 fenrir Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -80,7 +80,8 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
{
vlc_object_t *p_playlist;
p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
p_playlist = vlc_object_find( p_this,
VLC_OBJECT_PLAYLIST, FIND_PARENT );
if( p_playlist )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment