mirror of
https://github.com/videolan/vlc.git
synced 2024-12-04 07:15:24 +08:00
MKV: code cosmetics and copyright update
This commit is contained in:
parent
c7bc593d42
commit
162f56f7ca
@ -24,13 +24,10 @@
|
||||
|
||||
#include "chapter_command.hpp"
|
||||
|
||||
|
||||
void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
uint32 codec_time = uint32(-1);
|
||||
for( i = 0; i < command.ListSize(); i++ )
|
||||
for( size_t i = 0; i < command.ListSize(); i++ )
|
||||
{
|
||||
const EbmlElement *k = command[i];
|
||||
|
||||
@ -41,7 +38,7 @@ void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command
|
||||
}
|
||||
}
|
||||
|
||||
for( i = 0; i < command.ListSize(); i++ )
|
||||
for( size_t i = 0; i < command.ListSize(); i++ )
|
||||
{
|
||||
const EbmlElement *k = command[i];
|
||||
|
||||
@ -286,10 +283,10 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
|
||||
if ( !b_test_positive )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// strip the test command
|
||||
i_command &= 0xFF0F;
|
||||
|
||||
|
||||
switch ( i_command )
|
||||
{
|
||||
case CMD_DVD_NOP:
|
||||
@ -519,7 +516,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
|
||||
case CMD_DVD_SET_GPRMMD:
|
||||
{
|
||||
msg_Dbg( &sys.demuxer, "Set GPRMMD [%d]=%d", (p_command[4] << 8) + p_command[5], (p_command[2] << 8) + p_command[3]);
|
||||
|
||||
|
||||
if ( !SetGPRM( (p_command[4] << 8) + p_command[5], (p_command[2] << 8) + p_command[3] ) )
|
||||
msg_Dbg( &sys.demuxer, "Set GPRMMD failed" );
|
||||
break;
|
||||
@ -527,7 +524,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
|
||||
case CMD_DVD_LINKPGCN:
|
||||
{
|
||||
uint16 i_pgcn = (p_command[6] << 8) + p_command[7];
|
||||
|
||||
|
||||
msg_Dbg( &sys.demuxer, "Link PGCN(%d)", i_pgcn );
|
||||
p_chapter = sys.p_current_segment->BrowseCodecPrivate( 1, MatchPgcNumber, &i_pgcn, 2 );
|
||||
if ( p_chapter != NULL )
|
||||
@ -543,7 +540,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
|
||||
case CMD_DVD_LINKCN:
|
||||
{
|
||||
uint8 i_cn = p_command[7];
|
||||
|
||||
|
||||
p_chapter = sys.p_current_segment->CurrentChapter();
|
||||
|
||||
msg_Dbg( &sys.demuxer, "LinkCN (cell %d)", i_cn );
|
||||
@ -607,7 +604,7 @@ bool dvd_command_interpretor_c::MatchVTSNumber( const chapter_codec_cmds_c &data
|
||||
{
|
||||
if ( i_cookie_size != 2 || data.p_private_data == NULL || data.p_private_data->GetSize() < 4 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_SS || data.p_private_data->GetBuffer()[1] != 0x80 )
|
||||
return false;
|
||||
|
||||
@ -621,7 +618,7 @@ bool dvd_command_interpretor_c::MatchVTSMNumber( const chapter_codec_cmds_c &dat
|
||||
{
|
||||
if ( i_cookie_size != 1 || data.p_private_data == NULL || data.p_private_data->GetSize() < 4 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_SS || data.p_private_data->GetBuffer()[1] != 0x40 )
|
||||
return false;
|
||||
|
||||
@ -635,7 +632,7 @@ bool dvd_command_interpretor_c::MatchTitleNumber( const chapter_codec_cmds_c &da
|
||||
{
|
||||
if ( i_cookie_size != 1 || data.p_private_data == NULL || data.p_private_data->GetSize() < 4 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_TT )
|
||||
return false;
|
||||
|
||||
@ -649,7 +646,7 @@ bool dvd_command_interpretor_c::MatchPgcType( const chapter_codec_cmds_c &data,
|
||||
{
|
||||
if ( i_cookie_size != 1 || data.p_private_data == NULL || data.p_private_data->GetSize() < 8 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PGC )
|
||||
return false;
|
||||
|
||||
@ -663,7 +660,7 @@ bool dvd_command_interpretor_c::MatchPgcNumber( const chapter_codec_cmds_c &data
|
||||
{
|
||||
if ( i_cookie_size != 2 || data.p_private_data == NULL || data.p_private_data->GetSize() < 8 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PGC )
|
||||
return false;
|
||||
|
||||
@ -677,7 +674,7 @@ bool dvd_command_interpretor_c::MatchChapterNumber( const chapter_codec_cmds_c &
|
||||
{
|
||||
if ( i_cookie_size != 1 || data.p_private_data == NULL || data.p_private_data->GetSize() < 2 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PTT )
|
||||
return false;
|
||||
|
||||
@ -691,7 +688,7 @@ bool dvd_command_interpretor_c::MatchCellNumber( const chapter_codec_cmds_c &dat
|
||||
{
|
||||
if ( i_cookie_size != 1 || data.p_private_data == NULL || data.p_private_data->GetSize() < 5 )
|
||||
return false;
|
||||
|
||||
|
||||
if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_CN )
|
||||
return false;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
,i_codec_id( codec_id )
|
||||
,sys( demuxer )
|
||||
{}
|
||||
|
||||
|
||||
virtual ~chapter_codec_cmds_c()
|
||||
{
|
||||
delete p_private_data;
|
||||
@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
void AddCommand( const KaxChapterProcessCommand & command );
|
||||
|
||||
|
||||
/// \return wether the codec has seeked in the files or not
|
||||
virtual bool Enter() { return false; }
|
||||
virtual bool Leave() { return false; }
|
||||
@ -110,9 +110,9 @@ public:
|
||||
p_PRMs[ 0x80 + 16 ] = 0xFFFFu;
|
||||
p_PRMs[ 0x80 + 18 ] = 0xFFFFu;
|
||||
}
|
||||
|
||||
|
||||
bool Interpret( const binary * p_command, size_t i_size = 8 );
|
||||
|
||||
|
||||
uint16 GetPRM( size_t index ) const
|
||||
{
|
||||
if ( index < 256 )
|
||||
@ -144,7 +144,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SetGPRM( size_t index, uint16 value )
|
||||
{
|
||||
if ( index < 16 )
|
||||
@ -201,7 +201,7 @@ protected:
|
||||
|
||||
uint16 p_PRMs[256];
|
||||
demux_sys_t & sys;
|
||||
|
||||
|
||||
// DVD command IDs
|
||||
|
||||
// Tests
|
||||
@ -214,7 +214,7 @@ protected:
|
||||
static const uint16 CMD_DVD_IF_GPREG_SUP = (5 << 4);
|
||||
static const uint16 CMD_DVD_IF_GPREG_INF_EQUAL = (6 << 4);
|
||||
static const uint16 CMD_DVD_IF_GPREG_INF = (7 << 4);
|
||||
|
||||
|
||||
static const uint16 CMD_DVD_NOP = 0x0000;
|
||||
static const uint16 CMD_DVD_GOTO_LINE = 0x0001;
|
||||
static const uint16 CMD_DVD_BREAK = 0x0002;
|
||||
@ -243,7 +243,7 @@ protected:
|
||||
static const uint16 CMD_DVD_MULT_GPREG = 0x7500;
|
||||
static const uint16 CMD_DVD_GPREG_DIV_VALUE = 0x7600;
|
||||
static const uint16 CMD_DVD_GPREG_AND_VALUE = 0x7900;
|
||||
|
||||
|
||||
// callbacks when browsing inside CodecPrivate
|
||||
static bool MatchIsDomain ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
|
||||
static bool MatchIsVMG ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
|
||||
@ -280,10 +280,10 @@ public:
|
||||
{}
|
||||
|
||||
bool Interpret( const binary * p_command, size_t i_size );
|
||||
|
||||
|
||||
// DVD command IDs
|
||||
static const std::string CMD_MS_GOTO_AND_PLAY;
|
||||
|
||||
|
||||
protected:
|
||||
demux_sys_t & sys;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* mkv.cpp : matroska demuxer
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2004 the VideoLAN team
|
||||
* Copyright (C) 2003-2010 the VideoLAN team
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -349,7 +349,6 @@ void matroska_segment_c::IndexAppendCluster( KaxCluster *cluster )
|
||||
#undef idx
|
||||
}
|
||||
|
||||
|
||||
bool matroska_segment_c::PreloadFamily( const matroska_segment_c & of_segment )
|
||||
{
|
||||
if ( b_preloaded )
|
||||
@ -721,12 +720,10 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int matroska_segment_c::BlockFindTrackIndex( size_t *pi_track,
|
||||
const KaxBlock *p_block, const KaxSimpleBlock *p_simpleblock )
|
||||
{
|
||||
size_t i_track;
|
||||
|
||||
for( i_track = 0; i_track < tracks.size(); i_track++ )
|
||||
{
|
||||
const mkv_track_t *tk = tracks[i_track];
|
||||
@ -1183,7 +1180,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
|
||||
}
|
||||
}
|
||||
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_start_time );
|
||||
|
||||
|
||||
sys.i_start_pts = i_start_time;
|
||||
// reset the stream reading to the first cluster of the segment used
|
||||
es.I_O().setFilePointer( i_start_pos );
|
||||
@ -1196,9 +1193,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
|
||||
|
||||
void matroska_segment_c::UnSelect( )
|
||||
{
|
||||
size_t i_track;
|
||||
|
||||
for( i_track = 0; i_track < tracks.size(); i_track++ )
|
||||
for( size_t i_track = 0; i_track < tracks.size(); i_track++ )
|
||||
{
|
||||
if ( tracks[i_track]->p_es != NULL )
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* mkv.cpp : matroska demuxer
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2004 the VideoLAN team
|
||||
* Copyright (C) 2003-2010 the VideoLAN team
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -140,7 +140,7 @@ static void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ...
|
||||
va_list args;
|
||||
if( i_level > 9 )
|
||||
{
|
||||
msg_Err( &demuxer, "too deep tree" );
|
||||
msg_Err( &demuxer, "MKV tree is too deep" );
|
||||
return;
|
||||
}
|
||||
va_start( args, psz_format );
|
||||
@ -163,41 +163,38 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
|
||||
{
|
||||
bool bSupported = true;
|
||||
|
||||
mkv_track_t *tk;
|
||||
|
||||
msg_Dbg( &sys.demuxer, "| | + Track Entry" );
|
||||
|
||||
tk = new mkv_track_t();
|
||||
|
||||
/* Init the track */
|
||||
mkv_track_t *tk = new mkv_track_t();
|
||||
memset( tk, 0, sizeof( mkv_track_t ) );
|
||||
|
||||
es_format_Init( &tk->fmt, UNKNOWN_ES, 0 );
|
||||
tk->fmt.psz_language = strdup("English");
|
||||
tk->fmt.psz_description = NULL;
|
||||
tk->fmt.psz_language = strdup("English");
|
||||
tk->fmt.psz_description = NULL;
|
||||
|
||||
tk->b_default = true;
|
||||
tk->b_enabled = true;
|
||||
tk->b_silent = false;
|
||||
tk->i_number = tracks.size() - 1;
|
||||
tk->i_extra_data = 0;
|
||||
tk->p_extra_data = NULL;
|
||||
tk->psz_codec = NULL;
|
||||
tk->b_dts_only = false;
|
||||
tk->i_default_duration = 0;
|
||||
tk->f_timecodescale = 1.0;
|
||||
tk->b_default = true;
|
||||
tk->b_enabled = true;
|
||||
tk->b_silent = false;
|
||||
tk->i_number = tracks.size() - 1;
|
||||
tk->i_extra_data = 0;
|
||||
tk->p_extra_data = NULL;
|
||||
tk->psz_codec = NULL;
|
||||
tk->b_dts_only = false;
|
||||
tk->i_default_duration = 0;
|
||||
tk->f_timecodescale = 1.0;
|
||||
|
||||
tk->b_inited = false;
|
||||
tk->i_data_init = 0;
|
||||
tk->p_data_init = NULL;
|
||||
tk->b_inited = false;
|
||||
tk->i_data_init = 0;
|
||||
tk->p_data_init = NULL;
|
||||
|
||||
tk->psz_codec_name = NULL;
|
||||
tk->psz_codec_settings = NULL;
|
||||
tk->psz_codec_info_url = NULL;
|
||||
tk->psz_codec_name = NULL;
|
||||
tk->psz_codec_settings = NULL;
|
||||
tk->psz_codec_info_url = NULL;
|
||||
tk->psz_codec_download_url = NULL;
|
||||
|
||||
tk->i_compression_type = MATROSKA_COMPRESSION_NONE;
|
||||
tk->p_compression_data = NULL;
|
||||
tk->i_compression_type = MATROSKA_COMPRESSION_NONE;
|
||||
tk->p_compression_data = NULL;
|
||||
|
||||
msg_Dbg( &sys.demuxer, "| | + Track Entry" );
|
||||
|
||||
for( size_t i = 0; i < m->ListSize(); i++ )
|
||||
{
|
||||
@ -580,11 +577,11 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
|
||||
}
|
||||
if( i_crop_left || i_crop_right || i_crop_top || i_crop_bottom )
|
||||
{
|
||||
tk->fmt.video.i_visible_width = tk->fmt.video.i_width;
|
||||
tk->fmt.video.i_visible_height = tk->fmt.video.i_height;
|
||||
tk->fmt.video.i_x_offset = i_crop_left;
|
||||
tk->fmt.video.i_y_offset = i_crop_top;
|
||||
tk->fmt.video.i_visible_width -= i_crop_left + i_crop_right;
|
||||
tk->fmt.video.i_visible_width = tk->fmt.video.i_width;
|
||||
tk->fmt.video.i_visible_height = tk->fmt.video.i_height;
|
||||
tk->fmt.video.i_x_offset = i_crop_left;
|
||||
tk->fmt.video.i_y_offset = i_crop_top;
|
||||
tk->fmt.video.i_visible_width -= i_crop_left + i_crop_right;
|
||||
tk->fmt.video.i_visible_height -= i_crop_top + i_crop_bottom;
|
||||
}
|
||||
/* FIXME: i_display_* allows you to not only set DAR, but also a zoom factor.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* mkv.cpp : matroska demuxer
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2004 the VideoLAN team
|
||||
* Copyright (C) 2003-2005, 2008, 2010 the VideoLAN team
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* mkv.cpp : matroska demuxer
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2004 the VideoLAN team
|
||||
* Copyright (C) 2003-2005, 2008 the VideoLAN team
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
|
Loading…
Reference in New Issue
Block a user