* 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>
*
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include <ninput.h>
-
/*****************************************************************************
* Module descriptor
*****************************************************************************/
}
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;
* 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>
*
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include <ninput.h>
-
/*****************************************************************************
* Module descriptor
*****************************************************************************/
}
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;
* 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>
*
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
}
/* 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;
* 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
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
* 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>
*
#include <vlc/input.h>
#include <codecs.h>
-#include <ninput.h>
/*****************************************************************************
* Module descriptor
(mtime_t)p_sys->wf.nSamplesPerSec;
p_input->pf_demux = DemuxPCM;
+ p_input->pf_demux_control = demux_vaControlDefault;
}
/* create one program */
* 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
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include "ninput.h"
#include "codecs.h"
#include "../util/sub.h"
/*****************************************************************************
* 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 );
}
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" ) )
{
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++ )
{
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;
subtitle_Seek( p_avi->p_sub, p_avi->i_time );
}
}
-
+#endif
/* wait for the good time */
*****************************************************************************
* 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;
return( -1 );
}
- /* be sure that the index exit */
+ /* be sure that the index exist */
if( AVI_StreamChunkSet( p_input,
i_stream,
0 ) )
}
}
+/*****************************************************************************
+ * 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
* 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
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include "ninput.h"
#include "codecs.h" /* BITMAPINFOHEADER */
#include "libavi.h"
* 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>
*
/* 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 )
* 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>
*
}
p_input->pf_demux = Demux;
+ p_input->pf_demux_control = demux_vaControlDefault;
p_input->pf_rewind = NULL;
/* Have a peep at the show. */
* 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>
*
#include <codecs.h> /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "iso_lang.h"
-#include "ninput.h"
#include <iostream>
#include <cassert>
/* 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 )
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: libmp4.c,v 1.31 2003/08/17 23:02:52 fenrir Exp $
+ * $Id: libmp4.c,v 1.32 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
/*****************************************************************************
- * MP4_MP4_NextBox : Go to the next box
+ * MP4_NextBox : Go to the next box
*****************************************************************************
* if p_box == NULL, go to the next box in witch we are( at the begining ).
*****************************************************************************/
* after called one of theses functions, file position is unknown
* you need to call MP4_GotoBox to go where you want
*****************************************************************************/
-int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container )
+static int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container )
{
MP4_Box_t *p_box;
}
-int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container )
+static int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container )
{
if( p_container->i_size <= (size_t)MP4_BOX_HEADERSIZE(p_container ) + 8 )
{
return( MP4_ReadBoxContainerRaw( p_stream, p_container ) );
}
-void MP4_FreeBox_Common( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_Common( MP4_Box_t *p_box )
{
/* Up to now do nothing */
}
-int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
/* XXX sometime moov is hiden in a free box */
if( p_box->p_father && p_box->p_father->i_type == VLC_FOURCC( 'r', 'o', 'o', 't' )&&
return( 1 );
}
-int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_ftyp_t );
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_ftyp( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_ftyp( MP4_Box_t *p_box )
{
FREE( p_box->data.p_ftyp->i_compatible_brands );
}
-int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
#ifdef MP4_VERBOSE
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
#ifdef MP4_VERBOSE
}
-int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
uint16_t i_language;
}
-int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_hdlr_t );
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_hdlr( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_hdlr( MP4_Box_t *p_box )
{
FREE( p_box->data.p_hdlr->psz_name );
}
-int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_smhd_t );
}
-int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_hmhd_t );
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_url( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_url_t );
}
-void MP4_FreeBox_url( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_url( MP4_Box_t *p_box )
{
FREE( p_box->data.p_url->psz_location )
}
-int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_urn( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_urn_t );
#endif
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_urn( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_urn( MP4_Box_t *p_box )
{
FREE( p_box->data.p_urn->psz_name );
FREE( p_box->data.p_urn->psz_location );
}
-int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_dref_t );
}
-int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_ENTER( MP4_Box_data_stts_t );
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stts( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stts( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stts->i_sample_count );
FREE( p_box->data.p_stts->i_sample_delta );
}
-int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_ENTER( MP4_Box_data_ctts_t );
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_ctts( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_ctts( MP4_Box_t *p_box )
{
FREE( p_box->data.p_ctts->i_sample_count );
FREE( p_box->data.p_ctts->i_sample_offset );
return( i_len );
}
-int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
#define es_descriptor p_box->data.p_esds->es_descriptor
unsigned int i_len;
#undef es_descriptor
}
-void MP4_FreeBox_esds( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_esds( MP4_Box_t *p_box )
{
FREE( p_box->data.p_esds->es_descriptor.psz_URL );
if( p_box->data.p_esds->es_descriptor.p_decConfigDescr )
FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr );
}
-int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
}
-int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
}
-int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stsd_t );
}
-int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stsz( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stsz( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stsz->i_entry_size );
}
-int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stsc( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stsc( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stsc->i_first_chunk );
FREE( p_box->data.p_stsc->i_samples_per_chunk );
FREE( p_box->data.p_stsc->i_sample_description_index );
}
-int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stco_co64( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stco_co64( MP4_Box_t *p_box )
{
FREE( p_box->data.p_co64->i_chunk_offset );
}
-int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stss( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stss( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stss->i_sample_number )
}
-int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stsh( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stsh( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stsh->i_shadowed_sample_number )
FREE( p_box->data.p_stsh->i_sync_sample_number )
}
-int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_stdp( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_stdp( MP4_Box_t *p_box )
{
FREE( p_box->data.p_stdp->i_priority )
}
-int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_padb( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_padb( MP4_Box_t *p_box )
{
FREE( p_box->data.p_padb->i_reserved1 );
FREE( p_box->data.p_padb->i_pad2 );
FREE( p_box->data.p_padb->i_pad1 );
}
-int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_elst( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_elst( MP4_Box_t *p_box )
{
FREE( p_box->data.p_elst->i_segment_duration );
FREE( p_box->data.p_elst->i_media_time );
FREE( p_box->data.p_elst->i_media_rate_fraction );
}
-int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i_language;
unsigned int i;
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_cprt( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_cprt( MP4_Box_t *p_box )
{
FREE( p_box->data.p_cprt->psz_notice );
}
-int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_dcom_t );
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_cmvd_t );
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_cmvd( input_thread_t *p_input, MP4_Box_t *p_box )
+static void MP4_FreeBox_cmvd( MP4_Box_t *p_box )
{
FREE( p_box->data.p_cmvd->p_data );
}
-int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_Stream_t *p_stream_memory;
MP4_Box_t *p_umov;
#endif /* HAVE_ZLIB_H */
}
-int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
uint32_t i_len;
MP4_READBOX_ENTER( MP4_Box_data_rdrf_t );
#endif
MP4_READBOX_EXIT( 1 );
}
-void MP4_FreeBox_rdrf( input_thread_t *p_input, MP4_Box_t *p_box )
+
+static void MP4_FreeBox_rdrf( MP4_Box_t *p_box )
{
FREE( p_box->data.p_rdrf->psz_ref )
}
-int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmdr_t );
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmqu_t );
MP4_READBOX_EXIT( 1 );
}
-int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmvc_t );
MP4_GETVERSIONFLAGS( p_box->data.p_rmvc );
{
uint32_t i_type;
int (*MP4_ReadBox_function )( MP4_Stream_t *p_stream, MP4_Box_t *p_box );
- void (*MP4_FreeBox_function )( input_thread_t *p_input, MP4_Box_t *p_box );
+ void (*MP4_FreeBox_function )( MP4_Box_t *p_box );
} MP4_Box_Function [] =
{
/* Containers */
}
else
{
- MP4_Box_Function[i_index].MP4_FreeBox_function( p_input, p_box );
+ MP4_Box_Function[i_index].MP4_FreeBox_function( p_box );
}
free( p_box->data.p_data );
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: mp4.c,v 1.34 2003/07/23 01:13:47 gbazin Exp $
+ * $Id: mp4.c,v 1.35 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
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
-#include <string.h> /* strdup() */
-#include <errno.h>
-#include <sys/types.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "libmp4.h"
#include "mp4.h"
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int MP4Init ( vlc_object_t * );
-static void __MP4End ( vlc_object_t * );
-static int MP4Demux ( input_thread_t * );
-
-static int MP4DemuxRef( input_thread_t *p_input )
-{
- return 0;
-}
-
-/* New input could have something like that... */
-static int MP4Seek ( input_thread_t *, mtime_t );
-
-#define MP4End(a) __MP4End(VLC_OBJECT(a))
-
/*****************************************************************************
* Module descriptor
*****************************************************************************/
+static int Open ( vlc_object_t * );
+static void Close ( vlc_object_t * );
+
vlc_module_begin();
set_description( _("MP4 demuxer") );
set_capability( "demux", 242 );
- set_callbacks( MP4Init, __MP4End );
+ set_callbacks( Open, Close );
vlc_module_end();
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int Demux ( input_thread_t * );
+static int DemuxRef( input_thread_t *p_input )
+{
+ return 0;
+}
+static int Seek ( input_thread_t *, mtime_t );
+static int Control ( input_thread_t *, int, va_list );
+
/*****************************************************************************
* Declaration of local function
*****************************************************************************/
-static void MP4_TrackCreate ( input_thread_t *,
- track_data_mp4_t *,
- MP4_Box_t * );
-static void MP4_TrackDestroy( input_thread_t *,
- track_data_mp4_t * );
+static void MP4_TrackCreate ( input_thread_t *, track_data_mp4_t *, MP4_Box_t *);
+static void MP4_TrackDestroy( input_thread_t *, track_data_mp4_t * );
-static int MP4_TrackSelect ( input_thread_t *,
- track_data_mp4_t *,
- mtime_t );
-static void MP4_TrackUnselect(input_thread_t *,
- track_data_mp4_t * );
+static int MP4_TrackSelect ( input_thread_t *, track_data_mp4_t *, mtime_t );
+static void MP4_TrackUnselect(input_thread_t *, track_data_mp4_t * );
-static int MP4_TrackSeek ( input_thread_t *,
- track_data_mp4_t *,
- mtime_t );
+static int MP4_TrackSeek ( input_thread_t *, track_data_mp4_t *, mtime_t );
-static uint64_t MP4_GetTrackPos( track_data_mp4_t * );
-static int MP4_TrackSampleSize( track_data_mp4_t * );
-static int MP4_TrackNextSample( input_thread_t *,
- track_data_mp4_t * );
+static uint64_t MP4_GetTrackPos ( track_data_mp4_t * );
+static int MP4_TrackSampleSize( track_data_mp4_t * );
+static int MP4_TrackNextSample( input_thread_t *, track_data_mp4_t * );
#define MP4_Set4BytesLE( p, dw ) \
*((uint8_t*)p) = ( (dw)&0xff ); \
if( p ) { free( p ); (p) = NULL;}
/*****************************************************************************
- * MP4Init: check file and initializes MP4 structures
+ * Open: check file and initializes MP4 structures
*****************************************************************************/
-static int MP4Init( vlc_object_t * p_this )
+static int Open( vlc_object_t * p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
uint8_t *p_peek;
unsigned int i;
vlc_bool_t b_audio;
- /* I need to seek */
- if( !p_input->stream.b_seekable )
- {
- msg_Warn( p_input, "MP4 plugin discarded (unseekable)" );
- return( VLC_EGENERIC );
-
- }
- /* Initialize access plug-in structures. */
- if( p_input->i_mtu == 0 )
- {
- /* Improve speed. */
- p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE ;
- }
-
- p_input->pf_demux = MP4Demux;
-
/* a little test to see if it could be a mp4 */
if( input_Peek( p_input, &p_peek, 8 ) < 8 )
{
msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
-
-
switch( VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ) )
{
- case( FOURCC_ftyp ):
- case( FOURCC_moov ):
- case( FOURCC_foov ):
- case( FOURCC_moof ):
- case( FOURCC_mdat ):
- case( FOURCC_udta ):
- case( FOURCC_free ):
- case( FOURCC_skip ):
- case( FOURCC_wide ):
+ case FOURCC_ftyp:
+ case FOURCC_moov:
+ case FOURCC_foov:
+ case FOURCC_moof:
+ case FOURCC_mdat:
+ case FOURCC_udta:
+ case FOURCC_free:
+ case FOURCC_skip:
+ case FOURCC_wide:
break;
default:
msg_Warn( p_input, "MP4 plugin discarded (not a valid file)" );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
-
- /* create our structure that will contains all data */
- if( !( p_input->p_demux_data =
- p_demux = malloc( sizeof( demux_sys_t ) ) ) )
+ /* I need to seek */
+ if( !p_input->stream.b_seekable )
{
- msg_Err( p_input, "out of memory" );
- return( VLC_EGENERIC );
+ msg_Warn( p_input, "MP4 plugin discarded (unseekable)" );
+ return VLC_EGENERIC;
}
- memset( p_demux, 0, sizeof( demux_sys_t ) );
- p_input->p_demux_data = p_demux;
+ /*Set exported functions */
+ p_input->pf_demux = Demux;
+ p_input->pf_demux_control = Control;
+
+
+ /* create our structure that will contains all data */
+ p_input->p_demux_data = p_demux = malloc( sizeof( demux_sys_t ) );
+ memset( p_demux, 0, sizeof( demux_sys_t ) );
/* Now load all boxes ( except raw data ) */
if( !MP4_BoxGetRoot( p_input, &p_demux->box_root ) )
{
msg_Warn( p_input, "MP4 plugin discarded (not a valid file)" );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
MP4_BoxDumpStructure( p_input, &p_demux->box_root );
if( !p_foov )
{
msg_Err( p_input, "MP4 plugin discarded (no moov box)" );
- MP4End( p_input );
- return( VLC_EGENERIC );
+ goto error;
}
/* we have a free box as a moov, rename it */
p_foov->i_type = FOURCC_moov;
if( !p_rmra )
{
msg_Err( p_input, "cannot find /moov/mvhd" );
- MP4End( p_input );
- return VLC_EGENERIC;
+ goto error;
}
else
{
msg_Warn( p_input, "cannot find /moov/mvhd (pure ref file)" );
- p_input->pf_demux = MP4DemuxRef;
+ p_input->pf_demux = DemuxRef;
return VLC_SUCCESS;
}
}
MP4_BoxCount( &p_demux->box_root, "/moov/trak" ) ) )
{
msg_Err( p_input, "cannot find any /moov/trak" );
- MP4End( p_input );
- return( VLC_EGENERIC );
+ goto error;
}
msg_Dbg( p_input, "find %d track%c",
p_demux->i_tracks,
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot init stream" );
- MP4End( p_input );
- return( VLC_EGENERIC );
+ goto error;
}
/* Needed to create program _before_ MP4_TrackCreate */
if( input_AddProgram( p_input, 0, 0) == NULL )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot add program" );
- MP4End( p_input );
- return( VLC_EGENERIC );
+ goto error;
}
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
- /* XXX beurk and beurk, see MP4Demux and MP4Seek */
if( p_demux->i_duration/p_demux->i_timescale > 0 )
{
p_input->stream.i_mux_rate =
p_input->stream.p_selected_program->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
- return( VLC_SUCCESS );
+ return VLC_SUCCESS;
+
+error:
+ Close( VLC_OBJECT( p_input ) );
+ return VLC_EGENERIC;
}
/*****************************************************************************
- * MP4Demux: read packet and send them to decoders
+ * Demux: read packet and send them to decoders
*****************************************************************************
* TODO check for newly selected track (ie audio upt to now )
*****************************************************************************/
-static int MP4Demux( input_thread_t *p_input )
+static int Demux( input_thread_t *p_input )
{
demux_sys_t *p_demux = p_input->p_demux_data;
unsigned int i_track;
return( 0 );
}
-
- /* XXX beurk, beuRK and BEURK,
- but only way I've found to detect seek from interface */
- if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
- {
- mtime_t i_date;
-
- /* first wait for empty buffer, arbitrary time FIXME */
- msleep( DEFAULT_PTS_DELAY );
- /* *** calculate new date *** */
-
- i_date = (mtime_t)1000000 *
- (mtime_t)p_demux->i_duration /
- (mtime_t)p_demux->i_timescale *
- (mtime_t)MP4_TellAbsolute( p_input ) /
- (mtime_t)p_input->stream.p_selected_area->i_size;
- MP4Seek( p_input, i_date );
- }
-
/* first wait for the good time to read a packet */
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
return( 1 );
}
/*****************************************************************************
- * MP4Seek: Got to i_date
+ * Seek: Got to i_date
******************************************************************************/
-static int MP4Seek ( input_thread_t *p_input, mtime_t i_date )
+static int Seek ( input_thread_t *p_input, mtime_t i_date )
{
demux_sys_t *p_demux = p_input->p_demux_data;
unsigned int i_track;
}
/*****************************************************************************
- * MP4End: frees unused data
+ * Control:
*****************************************************************************/
-static void __MP4End ( vlc_object_t * p_this )
+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_duration > 0 )
+ {
+ *pf = (double)p_sys->i_time / (double)p_sys->i_duration;
+ }
+ else
+ {
+ *pf = 0.0;
+ }
+ return VLC_SUCCESS;
+
+ case DEMUX_SET_POSITION:
+ f = (double)va_arg( args, double );
+ i64 = (int64_t)( f *
+ (double)1000000 *
+ (double)p_sys->i_duration /
+ (double)p_sys->i_timescale );
+ return Seek( p_input, i64 );
+
+ case DEMUX_GET_TIME:
+ pi64 = (int64_t*)va_arg( args, int64_t * );
+ *pi64 = (mtime_t)1000000 *
+ (mtime_t)p_sys->i_time /
+ (mtime_t)p_sys->i_timescale;
+ return VLC_SUCCESS;
+
+ case DEMUX_SET_TIME:
+ i64 = (int64_t)va_arg( args, int64_t );
+ return Seek( p_input, i64 );
+
+ case DEMUX_GET_LENGTH:
+ pi64 = (int64_t*)va_arg( args, int64_t * );
+ *pi64 = (mtime_t)1000000 *
+ (mtime_t)p_sys->i_duration /
+ (mtime_t)p_sys->i_timescale;
+ return VLC_SUCCESS;
+
+ default:
+ msg_Err( p_input, "control query unimplemented !!!" );
+ return demux_vaControlDefault( p_input, i_query, args );
+ }
+}
+
+/*****************************************************************************
+ * Close: frees unused data
+ *****************************************************************************/
+static void Close ( vlc_object_t * p_this )
{
unsigned int i_track;
input_thread_t * p_input = (input_thread_t *)p_this;
}
+
/****************************************************************************
* Local functions, specific to vlc
****************************************************************************/
* 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>
*
/* 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 )
* 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>
*
/* 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 )
* 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>
*
#include <vlc/vlc.h>
#include <vlc/input.h>
-#include <ninput.h>
-
/*****************************************************************************
* Module descriptor
*****************************************************************************/
}
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;
* 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>
*
/* 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 )
* 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>
/* 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 */
* 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>
*
/* 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 )
* 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>
*
}
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 )
* 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>
*
#include <vlc/input.h>
#include <codecs.h>
-#include <ninput.h>
/*****************************************************************************
* Module descriptor
}
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;