Commit fcfa54ca authored by Laurent Aimar's avatar Laurent Aimar

* all: do not use input_Clock* anymore (use ES_OUT_SET_PCR instead).

 (text subs with mpg aren't working anymore unless using ps2)
parent 2c878b9a
......@@ -123,7 +123,6 @@ struct demux_sys_t
{
mtime_t i_time;
mtime_t i_length;
mtime_t i_pcr;
vlc_bool_t b_seekable;
avi_chunk_t ck_root;
......@@ -223,7 +222,6 @@ static int Open( vlc_object_t * p_this )
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->i_time = 0;
p_sys->i_length = 0;
p_sys->i_pcr = 0;
p_sys->i_movi_lastchunk_pos = 0;
p_sys->b_odml = VLC_FALSE;
p_sys->i_track = 0;
......@@ -630,13 +628,7 @@ static int Demux_Seekable( input_thread_t *p_input )
}
/* wait for the good time */
p_sys->i_pcr = p_sys->i_time * 9 / 100;
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_sys->i_pcr );
es_out_Control( p_input->p_es_out, ES_OUT_SET_PCR, p_sys->i_time );
p_sys->i_time += 25*1000; /* read 25ms */
/* init toread */
......@@ -897,11 +889,6 @@ static int Demux_Seekable( input_thread_t *p_input )
b_stream = VLC_TRUE; /* at least one read succeed */
p_frame->i_pts =
input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
p_frame->i_pts * 9/100);
if( tk->i_cat != VIDEO_ES )
p_frame->i_dts = p_frame->i_pts;
else
......@@ -932,9 +919,7 @@ static int Demux_UnSeekable( input_thread_t *p_input )
/* Check if we need to send the audio data to decoder */
b_audio = !p_input->stream.control.b_mute;
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_sys->i_pcr );
es_out_Control( p_input->p_es_out, ES_OUT_SET_PCR, p_sys->i_time );
/* *** find master stream for data packet skipping algo *** */
/* *** -> first video, if any, or first audio ES *** */
......@@ -961,7 +946,7 @@ static int Demux_UnSeekable( input_thread_t *p_input )
return( 0 );
}
p_sys->i_pcr = AVI_GetPTS( p_stream_master ) * 9 / 100;
p_sys->i_time = AVI_GetPTS( p_stream_master ) * 9 / 100;
for( i_packet = 0; i_packet < 10; i_packet++)
{
......@@ -1025,10 +1010,7 @@ static int Demux_UnSeekable( input_thread_t *p_input )
{
return( -1 );
}
p_frame->i_pts =
input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
AVI_GetPTS( p_stream ) * 9/100);
p_frame->i_pts = AVI_GetPTS( p_stream );
if( avi_pk.i_cat != VIDEO_ES )
p_frame->i_dts = p_frame->i_pts;
......
......@@ -32,7 +32,6 @@
#include "vlc_meta.h"
#include "libmp4.h"
#include "mp4.h"
#include "drms.h"
/*****************************************************************************
......@@ -58,6 +57,93 @@ static int DemuxRef( input_thread_t *p_input )
static int Seek ( input_thread_t *, mtime_t );
static int Control ( input_thread_t *, int, va_list );
/* Contain all information about a chunk */
typedef struct
{
uint64_t i_offset; /* absolute position of this chunk in the file */
uint32_t i_sample_description_index; /* index for SampleEntry to use */
uint32_t i_sample_count; /* how many samples in this chunk */
uint32_t i_sample_first; /* index of the first sample in this chunk */
/* now provide way to calculate pts, dts, and offset without to
much memory and with fast acces */
/* with this we can calculate dts/pts without waste memory */
uint64_t i_first_dts;
uint32_t *p_sample_count_dts;
uint32_t *p_sample_delta_dts; /* dts delta */
/* TODO if needed add pts
but quickly *add* support for edts and seeking */
} mp4_chunk_t;
/* Contain all needed information for read all track with vlc */
typedef struct
{
int i_track_ID; /* this should be unique */
int b_ok; /* The track is usable */
int b_enable; /* is the trak enable by default */
vlc_bool_t b_selected; /* is the trak being played */
es_format_t fmt;
es_out_id_t *p_es;
/* display size only ! */
int i_width;
int i_height;
/* more internal data */
uint64_t i_timescale; /* time scale for this track only */
/* elst */
int i_elst; /* current elst */
int64_t i_elst_time; /* current elst start time (in movie time scale)*/
MP4_Box_t *p_elst; /* elst (could be NULL) */
/* give the next sample to read, i_chunk is to find quickly where
the sample is located */
uint32_t i_sample; /* next sample to read */
uint32_t i_chunk; /* chunk where next sample is stored */
/* total count of chunk and sample */
uint32_t i_chunk_count;
uint32_t i_sample_count;
mp4_chunk_t *chunk; /* always defined for each chunk */
/* sample size, p_sample_size defined only if i_sample_size == 0
else i_sample_size is size for all sample */
uint32_t i_sample_size;
uint32_t *p_sample_size; /* XXX perhaps add file offset if take
too much time to do sumations each time*/
MP4_Box_t *p_stbl; /* will contain all timing information */
MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */
MP4_Box_t *p_sample;/* point on actual sdsd */
vlc_bool_t b_drms;
void *p_drms;
} mp4_track_t;
struct demux_sys_t
{
MP4_Box_t *p_root; /* container for the whole file */
mtime_t i_pcr;
uint64_t i_time; /* time position of the presentation
* in movie timescale */
uint64_t i_timescale; /* movie time scale */
uint64_t i_duration; /* movie duration */
unsigned int i_tracks; /* number of tracks */
mp4_track_t *track; /* array of track */
};
/*****************************************************************************
* Declaration of local function
*****************************************************************************/
......@@ -465,12 +551,10 @@ static int Demux( input_thread_t *p_input )
}
/* first wait for the good time to read a packet */
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_sys->i_pcr );
es_out_Control( p_input->p_es_out, ES_OUT_SET_PCR, p_sys->i_pcr );
/* update pcr XXX in mpeg scale so in 90000 unit/s */
p_sys->i_pcr = MP4_GetMoviePTS( p_sys ) * 9 / 100;
p_sys->i_pcr = MP4_GetMoviePTS( p_sys );
/* we will read 100ms for each stream so ...*/
p_sys->i_time += __MAX( p_sys->i_timescale / 10 , 1 );
......@@ -523,10 +607,7 @@ static int Demux( input_thread_t *p_input )
(uint32_t*)p_block->p_buffer,
p_block->i_buffer );
}
p_block->i_dts =
input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
MP4_TrackGetPTS( p_input, tk ) * 9/100 );
p_block->i_dts = MP4_TrackGetPTS( p_input, tk );
p_block->i_pts = tk->fmt.i_cat == VIDEO_ES ? 0 : p_block->i_dts;
......
/*****************************************************************************
* mp4.h : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id$
* Authors: Laurent Aimar <fenrir@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.
*****************************************************************************/
/*****************************************************************************
* Contain all information about a chunk
*****************************************************************************/
typedef struct
{
uint64_t i_offset; /* absolute position of this chunk in the file */
uint32_t i_sample_description_index; /* index for SampleEntry to use */
uint32_t i_sample_count; /* how many samples in this chunk */
uint32_t i_sample_first; /* index of the first sample in this chunk */
/* now provide way to calculate pts, dts, and offset without to
much memory and with fast acces */
/* with this we can calculate dts/pts without waste memory */
uint64_t i_first_dts;
uint32_t *p_sample_count_dts;
uint32_t *p_sample_delta_dts; /* dts delta */
/* TODO if needed add pts
but quickly *add* support for edts and seeking */
} mp4_chunk_t;
/*****************************************************************************
* Contain all needed information for read all track with vlc
*****************************************************************************/
typedef struct
{
int i_track_ID; /* this should be unique */
int b_ok; /* The track is usable */
int b_enable; /* is the trak enable by default */
vlc_bool_t b_selected; /* is the trak being played */
es_format_t fmt;
es_out_id_t *p_es;
/* display size only ! */
int i_width;
int i_height;
/* more internal data */
uint64_t i_timescale; /* time scale for this track only */
/* elst */
int i_elst; /* current elst */
int64_t i_elst_time; /* current elst start time (in movie time scale)*/
MP4_Box_t *p_elst; /* elst (could be NULL) */
/* give the next sample to read, i_chunk is to find quickly where
the sample is located */
uint32_t i_sample; /* next sample to read */
uint32_t i_chunk; /* chunk where next sample is stored */
/* total count of chunk and sample */
uint32_t i_chunk_count;
uint32_t i_sample_count;
mp4_chunk_t *chunk; /* always defined for each chunk */
/* sample size, p_sample_size defined only if i_sample_size == 0
else i_sample_size is size for all sample */
uint32_t i_sample_size;
uint32_t *p_sample_size; /* XXX perhaps add file offset if take
too much time to do sumations each time*/
MP4_Box_t *p_stbl; /* will contain all timing information */
MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */
MP4_Box_t *p_sample;/* point on actual sdsd */
vlc_bool_t b_drms;
void *p_drms;
} mp4_track_t;
/*****************************************************************************
*
*****************************************************************************/
struct demux_sys_t
{
MP4_Box_t *p_root; /* container for the whole file */
mtime_t i_pcr;
uint64_t i_time; /* time position of the presentation
* in movie timescale */
uint64_t i_timescale; /* movie time scale */
uint64_t i_duration; /* movie duration */
unsigned int i_tracks; /* number of tracks */
mp4_track_t *track; /* array of track */
};
......@@ -558,18 +558,12 @@ static int sub_demux( subtitle_demux_t *p_sub, mtime_t i_maxdate )
continue;
}
p_block->i_pts =
input_ClockGetTS( p_sub->p_input,
p_sub->p_input->stream.p_selected_program,
p_sub->subtitle[p_sub->i_subtitle].i_start*9/100);
p_block->i_pts = p_sub->subtitle[p_sub->i_subtitle].i_start;
p_block->i_dts = 0;
if( p_sub->subtitle[p_sub->i_subtitle].i_stop > 0 )
{
/* FIXME kludge i_dts means end of display... */
p_block->i_dts =
input_ClockGetTS( p_sub->p_input,
p_sub->p_input->stream.p_selected_program,
p_sub->subtitle[p_sub->i_subtitle].i_stop *9/100);
p_block->i_dts = p_sub->subtitle[p_sub->i_subtitle].i_stop;
}
memcpy( p_block->p_buffer, p_sub->subtitle[p_sub->i_subtitle].psz_text, i_len );
......@@ -625,10 +619,7 @@ static int sub_demux( subtitle_demux_t *p_sub, mtime_t i_maxdate )
}
/* pts */
p_block->i_pts =
input_ClockGetTS( p_sub->p_input,
p_sub->p_input->stream.p_selected_program,
p_sub->subtitle[p_sub->i_subtitle].i_start*9/100);
p_block->i_pts = p_sub->subtitle[p_sub->i_subtitle].i_start;
/* demux this block */
DemuxVobSub( p_sub, p_block );
......
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