Commit 785049d7 authored by Christophe Massiot's avatar Christophe Massiot

* Implemented basic stream navigation function, and bound Jump forward

  and jump Backward in the SDL intf. Enjoy !
parent 66f7daf3
......@@ -2,9 +2,9 @@
* input.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input.h,v 1.26 2001/02/08 04:43:27 sam Exp $
* $Id: input.h,v 1.27 2001/02/08 13:52:34 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......@@ -32,6 +32,8 @@
* packets. Have a nice day and merry Xmas. */
#define PADDING_PACKET_SIZE 188 /* Size of the NULL packet inserted in case
* of data loss (this should be < 188). */
#define PADDING_PACKET_NUMBER 10 /* Number of padding packets top insert to
* escape a decoder. */
/*****************************************************************************
* Prototypes from input_ext-dec.c
......@@ -69,14 +71,14 @@ int input_SelectES ( struct input_thread_s *, struct es_descriptor_s * );
vlc_thread_t input_RunDecoder( struct decoder_capabilities_s *, void * );
void input_EndDecoder( struct input_thread_s *, struct es_descriptor_s * );
void input_DecodePES ( struct decoder_fifo_s *, struct pes_packet_s * );
void input_EscapeDiscontinuity( struct input_thread_s *,
struct pgrm_descriptor_s * );
void input_EscapeAudioDiscontinuity( struct input_thread_s *,
struct pgrm_descriptor_s * );
/*****************************************************************************
* Prototypes from input_clock.c
*****************************************************************************/
void input_ClockNewRef( struct input_thread_s *,
struct pgrm_descriptor_s *, mtime_t, mtime_t );
void input_EscapeDiscontinuity( struct input_thread_s *,
struct pgrm_descriptor_s * );
void input_ClockInit( struct pgrm_descriptor_s * );
void input_ClockManageRef( struct input_thread_s *,
struct pgrm_descriptor_s *, mtime_t );
......
......@@ -2,9 +2,10 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.20 2001/01/24 19:05:55 massiot Exp $
* $Id: input_ext-dec.h,v 1.21 2001/02/08 13:52:34 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
*
* 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
......
......@@ -4,9 +4,9 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.16 2001/02/08 13:08:02 massiot Exp $
* $Id: input_ext-intf.h,v 1.17 2001/02/08 13:52:34 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......@@ -241,7 +241,7 @@ typedef struct input_thread_s
int (* pf_rewind)( struct input_thread_s * );
/* NULL if we don't support going *
* backwards (it's gonna be fun) */
int (* pf_seek)( struct input_thread_s *, off_t );
void (* pf_seek)( struct input_thread_s *, off_t );
i_p_config_t i_p_config; /* plugin configuration */
char * p_source;
......@@ -305,3 +305,4 @@ void input_DestroyThread( struct input_thread_s *, int *pi_status );
void input_Play ( struct input_thread_s * );
void input_Pause ( struct input_thread_s * );
void input_Forward( struct input_thread_s *, int );
void input_Seek ( struct input_thread_s *, off_t );
......@@ -85,7 +85,7 @@ typedef struct function_list_s
void ( * pf_delete_pes ) ( void *, struct pes_packet_s * );
int ( * pf_rewind ) ( struct input_thread_s * );
int ( * pf_seek ) ( struct input_thread_s *, off_t );
void ( * pf_seek ) ( struct input_thread_s *, off_t );
} input;
/* Audio output plugin */
......
/*****************************************************************************
* stream_control.h: structures of the input exported verywhere
* This header provides a structure so that everybody knows the state
* of the reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: stream_control.h,v 1.5 2001/02/08 13:52:34 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
* (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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* Structures exported to interface, input and decoders */
/*****************************************************************************
......
......@@ -2,9 +2,9 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.2 2001/02/08 07:24:25 sam Exp $
* $Id: input_ps.c,v 1.3 2001/02/08 13:52:35 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......@@ -61,7 +61,8 @@ static int PSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void PSInit ( struct input_thread_s * );
static void PSEnd ( struct input_thread_s * );
static struct pes_packet_s * NewPES ( void * p_garbage );
static void PSSeek ( struct input_thread_s *, off_t );
static struct pes_packet_s * NewPES ( void * );
static struct data_packet_s * NewPacket ( void *, size_t );
static void DeletePacket( void *, struct data_packet_s * );
static void DeletePES ( void *, struct pes_packet_s * );
......@@ -85,7 +86,7 @@ void input_getfunctions( function_list_t * p_function_list )
input.pf_delete_packet = DeletePacket;
input.pf_delete_pes = DeletePES;
input.pf_rewind = NULL;
input.pf_seek = NULL;
input.pf_seek = PSSeek;
#undef input
}
......@@ -428,6 +429,20 @@ static int PSRead( input_thread_t * p_input,
return( 0 );
}
/*****************************************************************************
* PSSeek: changes the stream position indicator
*****************************************************************************/
static void PSSeek( input_thread_t * p_input, off_t i_position )
{
thread_ps_data_t * p_method;
p_method = (thread_ps_data_t *)p_input->p_plugin_data;
/* A little bourrin but should work for a while --Meuuh */
fseek( p_method->stream, i_position, SEEK_SET );
p_input->stream.i_tell = i_position;
}
/*
* Packet management utilities
......
......@@ -2,7 +2,7 @@
* intf_sdl.c: SDL interface plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_sdl.c,v 1.31 2001/02/08 13:08:02 massiot Exp $
* $Id: intf_sdl.c,v 1.32 2001/02/08 13:52:35 massiot Exp $
*
* Authors:
*
......@@ -174,6 +174,21 @@ void intf_SDLManage( intf_thread_t *p_intf )
}
break;
case SDLK_j:
/* Jump forwards */
input_Seek( p_intf->p_input,
p_intf->p_input->stream.i_tell
+ p_intf->p_input->stream.i_size / 20 );
/* gabuzomeu */
break;
case SDLK_b:
/* Jump backwards */
input_Seek( p_intf->p_input,
p_intf->p_input->stream.i_tell
- p_intf->p_input->stream.i_size / 20 );
break;
default:
if( intf_ProcessKey( p_intf, (char )i_key ) )
{
......
......@@ -4,9 +4,9 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.77 2001/02/08 13:08:02 massiot Exp $
* $Id: input.c,v 1.78 2001/02/08 13:52:35 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......@@ -197,14 +197,28 @@ static void RunThread( input_thread_t *p_input )
p_input->c_loops++;
#endif
vlc_mutex_lock( &p_input->stream.control.control_lock );
if( p_input->stream.control.i_status == BACKWARD_S
&& p_input->pf_rewind != NULL )
vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.i_seek )
{
p_input->pf_rewind( p_input );
/* FIXME: probably don't do it every loop, but when ? */
if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
{
p_input->pf_seek( p_input, p_input->stream.i_seek );
for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{
pgrm_descriptor_t * p_pgrm
= p_input->stream.pp_programs[i];
/* Escape all decoders for the stream discontinuity they
* will encounter. */
input_EscapeDiscontinuity( p_input, p_pgrm );
/* Reinitialize synchro. */
p_pgrm->i_synchro_state = SYNCHRO_REINIT;
}
}
p_input->stream.i_seek = 0;
}
vlc_mutex_unlock( &p_input->stream.control.control_lock );
vlc_mutex_unlock( &p_input->stream.stream_lock );
i_error = p_input->pf_read( p_input, pp_packets );
......
......@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_clock.c,v 1.5 2001/02/08 13:08:03 massiot Exp $
* $Id: input_clock.c,v 1.6 2001/02/08 13:52:35 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -114,10 +114,10 @@ static mtime_t ClockCurrent( input_thread_t * p_input,
}
/*****************************************************************************
* input_ClockNewRef: writes a new clock reference
* ClockNewRef: writes a new clock reference
*****************************************************************************/
void input_ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate )
static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate )
{
intf_WarnMsg( 1, "Old ref: %lld/%lld, New ref: %lld/%lld", p_pgrm->cr_ref,
p_pgrm->sysdate_ref, i_clock, i_sysdate );
......@@ -125,44 +125,6 @@ void input_ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
p_pgrm->sysdate_ref = i_sysdate;
}
/*****************************************************************************
* EscapeDiscontinuity: send a NULL packet to the decoders
*****************************************************************************/
static void EscapeDiscontinuity( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm )
{
int i_es;
for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
{
es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
if( p_es->p_decoder_fifo != NULL )
{
input_NullPacket( p_input, p_es );
}
}
}
/*****************************************************************************
* EscapeAudioDiscontinuity: send a NULL packet to the audio decoders
*****************************************************************************/
static void EscapeAudioDiscontinuity( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm )
{
int i_es;
for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
{
es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
if( p_es->p_decoder_fifo != NULL && p_es->b_audio )
{
input_NullPacket( p_input, p_es );
}
}
}
/*****************************************************************************
* input_ClockInit: reinitializes the clock reference after a stream
* discontinuity
......@@ -185,7 +147,7 @@ void input_ClockManageRef( input_thread_t * p_input,
if( p_pgrm->i_synchro_state != SYNCHRO_OK )
{
/* Feed synchro with a new reference point. */
input_ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
p_pgrm->i_synchro_state = SYNCHRO_OK;
}
else
......@@ -200,7 +162,7 @@ void input_ClockManageRef( input_thread_t * p_input,
intf_WarnMsg( 3, "Clock gap, unexpected stream discontinuity" );
input_ClockInit( p_pgrm );
p_pgrm->i_synchro_state = SYNCHRO_START;
EscapeDiscontinuity( p_input, p_pgrm );
input_EscapeDiscontinuity( p_input, p_pgrm );
}
p_pgrm->last_cr = i_clock;
......@@ -221,11 +183,11 @@ void input_ClockManageRef( input_thread_t * p_input,
{
vlc_cond_wait( &p_input->stream.stream_wait,
&p_input->stream.stream_lock );
input_ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
}
else
{
input_ClockNewRef( p_input, p_pgrm, i_clock,
ClockNewRef( p_input, p_pgrm, i_clock,
ClockToSysdate( p_input, p_pgrm, i_clock ) );
}
......@@ -240,7 +202,7 @@ void input_ClockManageRef( input_thread_t * p_input,
/* Feed the audio decoders with a NULL packet to avoid
* discontinuities. */
EscapeAudioDiscontinuity( p_input, p_pgrm );
input_EscapeAudioDiscontinuity( p_input, p_pgrm );
}
else
{
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_dec.c,v 1.7 2001/01/15 06:18:23 sam Exp $
* $Id: input_dec.c,v 1.8 2001/02/08 13:52:35 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -59,7 +59,7 @@ void input_EndDecoder( input_thread_t * p_input, es_descriptor_t * p_es )
/* Make sure the thread leaves the NextDataPacket() function by
* sending it a few null packets. */
for( i_dummy = 0; i_dummy < 10; i_dummy++ )
for( i_dummy = 0; i_dummy < PADDING_PACKET_NUMBER; i_dummy++ )
{
input_NullPacket( p_input, p_es );
}
......@@ -115,3 +115,48 @@ void input_DecodePES( decoder_fifo_t * p_decoder_fifo, pes_packet_t * p_pes )
}
vlc_mutex_unlock( &p_decoder_fifo->data_lock );
}
/*****************************************************************************
* input_EscapeDiscontinuity: send a NULL packet to the decoders
*****************************************************************************/
void input_EscapeDiscontinuity( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm )
{
int i_es, i;
for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
{
es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
if( p_es->p_decoder_fifo != NULL )
{
for( i = 0; i < PADDING_PACKET_NUMBER; i++ )
{
input_NullPacket( p_input, p_es );
}
}
}
}
/*****************************************************************************
* input_EscapeAudioDiscontinuity: send a NULL packet to the audio decoders
*****************************************************************************/
void input_EscapeAudioDiscontinuity( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm )
{
int i_es, i;
for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
{
es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
if( p_es->p_decoder_fifo != NULL && p_es->b_audio )
{
for( i = 0; i < PADDING_PACKET_NUMBER; i++ )
{
input_NullPacket( p_input, p_es );
}
}
}
}
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......@@ -84,8 +84,23 @@ void input_Forward( input_thread_t * p_input, int i_rate )
*****************************************************************************/
void input_Pause( input_thread_t * p_input )
{
intf_Msg( "input: paused" );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_new_status = PAUSE_S;
vlc_cond_signal( &p_input->stream.stream_wait );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
/*****************************************************************************
* input_Seek: changes the stream postion
*****************************************************************************/
void input_Seek( input_thread_t * p_input, off_t i_position )
{
intf_Msg( "input: seeking position %d/%d", i_position,
p_input->stream.i_size );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_seek = i_position;
vlc_cond_signal( &p_input->stream.stream_wait );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
......@@ -2,9 +2,9 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.29 2001/02/08 04:43:28 sam Exp $
* $Id: input_programs.c,v 1.30 2001/02/08 13:52:35 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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
......
......@@ -2,9 +2,12 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.32 2001/02/08 04:43:28 sam Exp $
* $Id: mpeg_system.c,v 1.33 2001/02/08 13:52:35 massiot Exp $
*
* Authors:
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
* Benot Steiner <benny@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
*
* 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
......
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