Commit 4a3faf87 authored by Laurent Aimar's avatar Laurent Aimar

* mp4: cosmetics.

parent 72550238
This diff is collapsed.
......@@ -2,7 +2,7 @@
* mp4.h : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.h,v 1.11 2004/01/09 04:37:43 jlj Exp $
* $Id: mp4.h,v 1.12 2004/01/18 18:31:50 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -24,7 +24,7 @@
/*****************************************************************************
* Contain all information about a chunk
*****************************************************************************/
typedef struct chunk_data_mp4_s
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 */
......@@ -42,13 +42,13 @@ typedef struct chunk_data_mp4_s
/* TODO if needed add pts
but quickly *add* support for edts and seeking */
} chunk_data_mp4_t;
} mp4_chunk_t;
/*****************************************************************************
* Contain all needed information for read all track with vlc
*****************************************************************************/
typedef struct track_data_mp4_s
typedef struct
{
int i_track_ID; /* this should be unique */
......@@ -74,7 +74,7 @@ typedef struct track_data_mp4_s
uint32_t i_chunk_count;
uint32_t i_sample_count;
chunk_data_mp4_t *chunk; /* always defined for each chunk */
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 */
......@@ -89,7 +89,7 @@ typedef struct track_data_mp4_s
vlc_bool_t b_drms;
void *p_drms;
} track_data_mp4_t;
} mp4_track_t;
/*****************************************************************************
......@@ -106,75 +106,7 @@ struct demux_sys_t
uint64_t i_timescale; /* movie time scale */
uint64_t i_duration; /* movie duration */
unsigned int i_tracks; /* number of tracks */
track_data_mp4_t *track; /* array of track */
mp4_track_t *track; /* array of track */
};
#if 0
static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track )
{
unsigned int i_sample;
uint64_t i_pos;
i_pos = p_track->chunk[p_track->i_chunk].i_offset;
if( p_track->i_sample_size )
{
i_pos += ( p_track->i_sample -
p_track->chunk[p_track->i_chunk].i_sample_first ) *
p_track->i_sample_size;
}
else
{
for( i_sample = p_track->chunk[p_track->i_chunk].i_sample_first;
i_sample < p_track->i_sample; i_sample++ )
{
i_pos += p_track->p_sample_size[i_sample];
}
}
return( i_pos );
}
#endif
/* Return time in s of a track */
static inline mtime_t MP4_GetTrackPTS( track_data_mp4_t *p_track )
{
unsigned int i_sample;
unsigned int i_index;
uint64_t i_dts;
i_sample = p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first;
i_dts = p_track->chunk[p_track->i_chunk].i_first_dts;
i_index = 0;
while( i_sample > 0 )
{
if( i_sample > p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] )
{
i_dts += p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] *
p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index];
i_sample -= p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index];
i_index++;
}
else
{
i_dts += i_sample *
p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index];
i_sample = 0;
break;
}
}
return( (mtime_t)(
(mtime_t)1000000 *
(mtime_t)i_dts /
(mtime_t)p_track->i_timescale ) );
}
static inline mtime_t MP4_GetMoviePTS(demux_sys_t *p_demux )
{
return( (mtime_t)(
(mtime_t)1000000 *
(mtime_t)p_demux->i_time /
(mtime_t)p_demux->i_timescale )
);
}
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