Commit 091aff73 authored by Laurent Aimar's avatar Laurent Aimar

* all : demuxers *have to* set pf_demux_control. (demux_vaControlDefault

 is a generic handler)
 * avi, mp4 : begin to implement a specific pf_demux_control.
parent fce2672f
......@@ -2,7 +2,7 @@
* a52.c : Raw a52 Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52sys.c,v 1.4 2003/08/01 00:04:28 fenrir Exp $
* $Id: a52sys.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -29,8 +29,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <ninput.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -129,6 +127,7 @@ static int Open( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
......
......@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aac.c,v 1.2 2003/08/01 00:40:05 fenrir Exp $
* $Id: aac.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -29,8 +29,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <ninput.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -136,6 +134,7 @@ static int Open( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
......
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.36 2003/08/25 23:36:16 fenrir Exp $
* $Id: asf.c,v 1.37 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -28,7 +28,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
......@@ -117,7 +116,8 @@ static int Open( vlc_object_t * p_this )
}
/* Set p_input field */
p_input->pf_demux = Demux;
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->i_time = -1;
......
......@@ -2,7 +2,7 @@
* libasf.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libasf.c,v 1.17 2003/08/24 15:05:27 fenrir Exp $
* $Id: libasf.c,v 1.18 2003/09/07 22:48:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -24,7 +24,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
......
......@@ -2,7 +2,7 @@
* au.c : au file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: au.c,v 1.5 2003/08/22 20:32:27 fenrir Exp $
* $Id: au.c,v 1.6 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -30,7 +30,6 @@
#include <vlc/input.h>
#include <codecs.h>
#include <ninput.h>
/*****************************************************************************
* Module descriptor
......@@ -320,6 +319,7 @@ static int Open( vlc_object_t * p_this )
(mtime_t)p_sys->wf.nSamplesPerSec;
p_input->pf_demux = DemuxPCM;
p_input->pf_demux_control = demux_vaControlDefault;
}
/* create one program */
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.59 2003/08/23 11:46:06 fenrir Exp $
* $Id: avi.c,v 1.60 2003/09/07 22:48:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -27,7 +27,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "ninput.h"
#include "codecs.h"
#include "../util/sub.h"
......@@ -58,6 +57,7 @@ vlc_module_end();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Control ( input_thread_t *, int, va_list );
static int Seek ( input_thread_t *, mtime_t, int );
static int Demux_Seekable ( input_thread_t * );
static int Demux_UnSeekable( input_thread_t *p_input );
......@@ -159,6 +159,7 @@ static int Open( vlc_object_t * p_this )
}
stream_Control( p_avi->s, STREAM_CAN_FASTSEEK, &p_avi->b_seekable );
p_input->pf_demux_control = Control;
p_input->pf_demux = Demux_Seekable;
/* For unseekable stream, automaticaly use Demux_UnSeekable */
if( !p_avi->b_seekable || config_GetInt( p_input, "avi-interleaved" ) )
......@@ -460,7 +461,6 @@ static int Open( vlc_object_t * p_this )
{
msg_Warn( p_input, "broken or missing index, 'seek' will be axproximative or will have strange behavour" );
}
/* fix some BeOS MediaKit generated file */
for( i = 0 ; i < p_avi->i_streams; i++ )
{
......@@ -656,7 +656,7 @@ static int Demux_Seekable( input_thread_t *p_input )
msg_Warn( p_input, "no track selected, exiting..." );
return( 0 );
}
#if 0
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
mtime_t i_date;
......@@ -678,7 +678,7 @@ static int Demux_Seekable( input_thread_t *p_input )
subtitle_Seek( p_avi->p_sub, p_avi->i_time );
}
}
#endif
/* wait for the good time */
......@@ -1131,8 +1131,7 @@ static int Demux_UnSeekable( input_thread_t *p_input )
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
static int Seek ( input_thread_t *p_input,
mtime_t i_date, int i_percent )
static int Seek( input_thread_t *p_input, mtime_t i_date, int i_percent )
{
demux_sys_t *p_avi = p_input->p_demux_data;
......@@ -1184,7 +1183,7 @@ static int Seek ( input_thread_t *p_input,
return( -1 );
}
/* be sure that the index exit */
/* be sure that the index exist */
if( AVI_StreamChunkSet( p_input,
i_stream,
0 ) )
......@@ -1253,6 +1252,93 @@ static int Seek ( input_thread_t *p_input,
}
}
/*****************************************************************************
* Control:
*****************************************************************************
*
*****************************************************************************/
static int Control( input_thread_t *p_input, int i_query, va_list args )
{
demux_sys_t *p_sys = p_input->p_demux_data;
double f, *pf;
int64_t i64, *pi64;
switch( i_query )
{
case DEMUX_GET_POSITION:
pf = (double*)va_arg( args, double * );
if( p_sys->i_length > 0 )
{
*pf = (double)p_sys->i_time / (double)( p_sys->i_length * (mtime_t)1000000 );
return VLC_SUCCESS;
}
else if( stream_Size( p_sys->s ) > 0 )
{
unsigned int i;
int64_t i_tmp;
i64 = 0;
/* search the more advanced selected es */
for( i = 0; i < p_sys->i_streams; i++ )
{
#define tk p_sys->pp_info[i]
if( tk->b_activated && tk->i_idxposc < tk->i_idxnb )
{
i_tmp = tk->p_index[tk->i_idxposc].i_pos +
tk->p_index[tk->i_idxposc].i_length + 8;
if( i_tmp > i64 )
{
i64 = i_tmp;
}
}
#undef tk
}
*pf = (double)i64 / (double)stream_Size( p_sys->s );
return VLC_SUCCESS;
}
else
{
*pf = 0.0;
return VLC_SUCCESS;
}
case DEMUX_SET_POSITION:
if( p_sys->b_seekable )
{
int i_ret;
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
{
return demux_vaControlDefault( p_input, i_query, args );
}
case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * );
*pi64 = p_sys->i_time;
return VLC_SUCCESS;
case DEMUX_SET_TIME:
msg_Err( p_input, "FIXME DEMUX_SET_TIME to be implemented" );
return VLC_EGENERIC;
/* return demux_vaControlDefault( p_input, i_query, args ); */
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
*pi64 = p_sys->i_length * (mtime_t)1000000;
return VLC_SUCCESS;
default:
return demux_vaControlDefault( p_input, i_query, args );
}
return VLC_EGENERIC;
}
/*****************************************************************************
* Function to convert pts to chunk or byte
......
......@@ -2,7 +2,7 @@
* libavi.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.25 2003/08/30 02:03:44 fenrir Exp $
* $Id: libavi.c,v 1.26 2003/09/07 22:48:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -24,7 +24,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER */
#include "libavi.h"
......
......@@ -2,7 +2,7 @@
* demuxdump.c : Pseudo demux module for vlc (dump raw stream)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demuxdump.c,v 1.9 2003/05/15 22:27:37 massiot Exp $
* $Id: demuxdump.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -84,6 +84,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
......
......@@ -2,7 +2,7 @@
* flac.c : FLAC demuc module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: flac.c,v 1.4 2003/08/17 13:56:26 gbazin Exp $
* $Id: flac.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -72,6 +72,7 @@ static int Init( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->pf_rewind = NULL;
/* Have a peep at the show. */
......
......@@ -2,7 +2,7 @@
* mkv.cpp : matroska demuxer
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mkv.cpp,v 1.25 2003/08/26 19:43:51 hartman Exp $
* $Id: mkv.cpp,v 1.26 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -36,7 +36,6 @@
#include <codecs.h> /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "iso_lang.h"
#include "ninput.h"
#include <iostream>
#include <cassert>
......@@ -300,6 +299,7 @@ static int Open( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* peek the begining */
if( input_Peek( p_input, &p_peek, 4 ) < 4 )
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* mpeg_es.c : Elementary Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.c,v 1.3 2003/05/05 22:23:36 gbazin Exp $
* $Id: es.c,v 1.4 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -67,6 +67,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
......
......@@ -2,7 +2,7 @@
* m4v.c : MPEG-4 video Stream input module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: m4v.c,v 1.6 2003/08/01 00:05:07 gbazin Exp $
* $Id: m4v.c,v 1.7 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -71,6 +71,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
......
......@@ -2,7 +2,7 @@
* mpga.c : MPEG-I/II Audio input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mpga.c,v 1.2 2003/08/17 23:02:52 fenrir Exp $
* $Id: mpga.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -29,8 +29,6 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <ninput.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -237,6 +235,7 @@ static int Open( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
......
......@@ -2,7 +2,7 @@
* ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ps.c,v 1.9 2003/03/09 23:39:05 jlj Exp $
* $Id: ps.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -74,6 +74,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
......
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.34 2003/08/14 23:32:51 fenrir Exp $
* $Id: ts.c,v 1.35 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -136,6 +136,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
#if 0
/* XXX Unused already done by src/input.c */
......
......@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ogg.c,v 1.32 2003/09/02 20:19:26 gbazin Exp $
* $Id: ogg.c,v 1.33 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -1092,6 +1092,7 @@ static int Activate( vlc_object_t * p_this )
/* Set the demux function */
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
......
......@@ -2,7 +2,7 @@
* rawdv.c : raw dv input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: rawdv.c,v 1.9 2003/08/17 23:02:52 fenrir Exp $
* $Id: rawdv.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -139,6 +139,7 @@ static int Activate( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
/* Have a peep at the show. */
if( input_Peek(p_input, &p_peek, DV_PAL_FRAME_SIZE) < DV_NTSC_FRAME_SIZE )
......
......@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.c,v 1.5 2003/08/22 20:32:27 fenrir Exp $
* $Id: wav.c,v 1.6 2003/09/07 22:48:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -30,7 +30,6 @@
#include <vlc/input.h>
#include <codecs.h>
#include <ninput.h>
/*****************************************************************************
* Module descriptor
......@@ -104,6 +103,7 @@ static int Open( vlc_object_t * p_this )
}
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->p_wf = NULL;
p_sys->p_es = NULL;
......
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