# include "config.h"
#endif
+#define __STDC_FORMAT_MACROS 1
+#define __STDC_CONSTANT_MACROS 1
+#include <inttypes.h>
+
#include <vlc/vlc.h>
#ifdef HAVE_TIME_H
vlc_module_begin();
set_shortname( "Matroska" );
set_description( _("Matroska stream demuxer" ) );
- set_capability( "demux2", 50 );
+ set_capability( "demux", 50 );
set_callbacks( Open, Close );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_DEMUX );
add_bool( "mkv-use-ordered-chapters", 1, NULL,
N_("Ordered chapters"),
- N_("Play ordered chapters as specified in the segment."), VLC_TRUE );
+ N_("Play ordered chapters as specified in the segment."), true );
add_bool( "mkv-use-chapter-codec", 1, NULL,
N_("Chapter codecs"),
- N_("Use chapter codecs found in the segment."), VLC_TRUE );
+ N_("Use chapter codecs found in the segment."), true );
add_bool( "mkv-preload-local-dir", 1, NULL,
N_("Preload Directory"),
- N_("Preload matroska files from the same family in the same directory (not good for broken files)."), VLC_TRUE );
+ N_("Preload matroska files from the same family in the same directory (not good for broken files)."), true );
add_bool( "mkv-seek-percent", 0, NULL,
N_("Seek based on percent not time"),
- N_("Seek based on percent not time."), VLC_TRUE );
+ N_("Seek based on percent not time."), true );
add_bool( "mkv-use-dummy", 0, NULL,
N_("Dummy Elements"),
- N_("Read and discard unknown EBML elements (not good for broken files)."), VLC_TRUE );
+ N_("Read and discard unknown EBML elements (not good for broken files)."), true );
add_shortcut( "mka" );
add_shortcut( "mkv" );
{
private:
stream_t *s;
- vlc_bool_t mb_eof;
- vlc_bool_t b_owner;
+ bool mb_eof;
+ bool b_owner;
public:
- vlc_stream_io_callback( stream_t *, vlc_bool_t );
+ vlc_stream_io_callback( stream_t *, bool );
virtual ~vlc_stream_io_callback()
{
EbmlElement *m_got;
int mi_user_level;
- vlc_bool_t mb_keep;
- vlc_bool_t mb_dummy;
+ bool mb_keep;
+ bool mb_dummy;
};
{
// ~mkv_track_t();
- vlc_bool_t b_default;
- vlc_bool_t b_enabled;
+ bool b_default;
+ bool b_enabled;
unsigned int i_number;
int i_extra_data;
/* audio */
unsigned int i_original_rate;
- vlc_bool_t b_inited;
+ bool b_inited;
/* data to be send first */
int i_data_init;
uint8_t *p_data_init;
/* hack : it's for seek */
- vlc_bool_t b_search_keyframe;
- vlc_bool_t b_silent;
+ bool b_search_keyframe;
+ bool b_silent;
/* informative */
const char *psz_codec_name;
int64_t i_position;
int64_t i_time;
- vlc_bool_t b_key;
+ bool b_key;
} mkv_index_t;
class demux_sys_t;
,p_segment_uid(NULL)
,p_prev_segment_uid(NULL)
,p_next_segment_uid(NULL)
- ,b_cues(VLC_FALSE)
+ ,b_cues(false)
,i_index(0)
,i_index_max(1024)
,psz_muxing_application(NULL)
delete tracks[i_track]->p_compression_data;
}
es_format_Clean( &tracks[i_track]->fmt );
- if( tracks[i_track]->p_extra_data )
- free( tracks[i_track]->p_extra_data );
- if( tracks[i_track]->psz_codec )
- free( tracks[i_track]->psz_codec );
+ free( tracks[i_track]->p_extra_data );
+ free( tracks[i_track]->psz_codec );
delete tracks[i_track];
}
- if( psz_writing_application )
- {
- free( psz_writing_application );
- }
- if( psz_muxing_application )
- {
- free( psz_muxing_application );
- }
- if( psz_segment_filename )
- {
- free( psz_segment_filename );
- }
- if( psz_title )
- {
- free( psz_title );
- }
- if( psz_date_utc )
- {
- free( psz_date_utc );
- }
- if ( p_indexes )
- free( p_indexes );
+ free( psz_writing_application );
+ free( psz_muxing_application );
+ free( psz_segment_filename );
+ free( psz_title );
+ free( psz_date_utc );
+ free( p_indexes );
delete ep;
delete segment;
KaxPrevUID *p_prev_segment_uid;
KaxNextUID *p_next_segment_uid;
- vlc_bool_t b_cues;
+ bool b_cues;
int i_index;
int i_index_max;
mkv_index_t *p_indexes;
demux_t *p_demux;
vlc_mutex_t lock;
- vlc_bool_t b_moved;
- vlc_bool_t b_clicked;
- vlc_bool_t b_key;
+ bool b_moved;
+ bool b_clicked;
+ int i_key_action;
} event_thread_t;
{}
virtual ~attachment_c()
{
- if( p_data ) free( p_data );
+ free( p_data );
}
std::string psz_file_name;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = new demux_sys_t( *p_demux );
- p_io_callback = new vlc_stream_io_callback( p_demux->s, VLC_FALSE );
+ p_io_callback = new vlc_stream_io_callback( p_demux->s, false );
p_io_stream = new EbmlStream( *p_io_callback );
if( p_io_stream == NULL )
if ( file_ok )
{
- vlc_stream_io_callback *p_file_io = new vlc_stream_io_callback( p_file_stream, VLC_TRUE );
+ vlc_stream_io_callback *p_file_io = new vlc_stream_io_callback( p_file_stream, true );
EbmlStream *p_estream = new EbmlStream(*p_file_io);
p_stream = p_sys->AnalyseAllSegmentsFound( p_demux, p_estream );
else
#endif
idx.i_time = (*pp_block).GlobalTimecode() / (mtime_t)1000;
- idx.b_key = *pi_ref1 == 0 ? VLC_TRUE : VLC_FALSE;
+ idx.b_key = *pi_ref1 == 0 ? true : false;
}
#undef idx
return VLC_SUCCESS;
// reset silent tracks
for (size_t i=0; i<tracks.size(); i++)
{
- tracks[i]->b_silent = VLC_FALSE;
+ tracks[i]->b_silent = false;
}
ep->Down();
{
if ( tracks[i]->i_number == uint32(track_num))
{
- tracks[i]->b_silent = VLC_TRUE;
+ tracks[i]->b_silent = true;
break;
}
}
size_t i_track;
unsigned int i;
- vlc_bool_t b;
+ bool b;
#define tk p_segment->tracks[i_track]
for( i_track = 0; i_track < p_segment->tracks.size(); i_track++ )
if( !b )
{
- tk->b_inited = VLC_FALSE;
+ tk->b_inited = false;
return;
}
}
p_init = MemToBlock( p_demux, tk->p_data_init, tk->i_data_init, 0 );
if( p_init ) es_out_Send( p_demux->out, tk->p_es, p_init );
}
- tk->b_inited = VLC_TRUE;
+ tk->b_inited = true;
#if LIBMATROSKA_VERSION >= 0x000800
stream_t *p_mp4_stream = stream_MemoryNew( VLC_OBJECT(&sys.demuxer),
tracks[i_track]->p_extra_data,
tracks[i_track]->i_extra_data,
- VLC_FALSE );
+ false );
MP4_ReadBoxCommon( p_mp4_stream, p_box );
MP4_ReadBox_sample_vide( p_mp4_stream, p_box );
tracks[i_track]->fmt.i_codec = p_box->i_type;
/* Now create our event thread catcher */
p_ev = (event_thread_t *) vlc_object_create( &demuxer, sizeof( event_thread_t ) );
p_ev->p_demux = &demuxer;
- p_ev->b_die = VLC_FALSE;
+ p_ev->b_die = false;
vlc_mutex_init( p_ev, &p_ev->lock );
vlc_thread_create( p_ev, "mkv event thread handler", EventThread,
- VLC_THREAD_PRIORITY_LOW, VLC_FALSE );
+ VLC_THREAD_PRIORITY_LOW, false );
}
}
vlc_mutex_lock( &p_ev->lock );
if( psz_var[6] == 'c' )
{
- p_ev->b_clicked = VLC_TRUE;
+ p_ev->b_clicked = true;
msg_Dbg( p_this, "Event Mouse: clicked");
}
else if( psz_var[6] == 'm' )
- p_ev->b_moved = VLC_TRUE;
+ p_ev->b_moved = true;
vlc_mutex_unlock( &p_ev->lock );
return VLC_SUCCESS;
}
-int demux_sys_t::EventKey( vlc_object_t *p_this, char const *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+int demux_sys_t::EventKey( vlc_object_t *p_this, char const *,
+ vlc_value_t, vlc_value_t newval, void *p_data )
{
event_thread_t *p_ev = (event_thread_t *) p_data;
vlc_mutex_lock( &p_ev->lock );
- p_ev->b_key = VLC_TRUE;
+ p_ev->i_key_action = newval.i_int;
vlc_mutex_unlock( &p_ev->lock );
msg_Dbg( p_this, "Event Key");
demux_sys_t *p_sys = p_ev->p_demux->p_sys;
vlc_object_t *p_vout = NULL;
- p_ev->b_moved = VLC_FALSE;
- p_ev->b_clicked = VLC_FALSE;
- p_ev->b_key = VLC_FALSE;
+ p_ev->b_moved = false;
+ p_ev->b_clicked = false;
+ p_ev->i_key_action = 0;
/* catch all key event */
- var_AddCallback( p_ev->p_libvlc, "key-pressed", EventKey, p_ev );
+ var_AddCallback( p_ev->p_libvlc, "key-action", EventKey, p_ev );
/* main loop */
while( !p_ev->b_die )
continue;
}
- vlc_bool_t b_activated = VLC_FALSE;
+ bool b_activated = false;
/* KEY part */
- if( p_ev->b_key )
+ if( p_ev->i_key_action )
{
- vlc_value_t valk;
- struct libvlc_int_t::hotkey *p_hotkeys = p_ev->p_libvlc->p_hotkeys;
- int i, i_action = -1;
+ int i;
msg_Dbg( p_ev->p_demux, "Handle Key Event");
pci_t *pci = (pci_t *) &p_sys->pci_packet;
- var_Get( p_ev->p_libvlc, "key-pressed", &valk );
- for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
- {
- if( p_hotkeys[i].i_key == valk.i_int )
- {
- i_action = p_hotkeys[i].i_action;
- }
- }
-
uint16 i_curr_button = p_sys->dvd_interpretor.GetSPRM( 0x88 );
- switch( i_action )
+ switch( p_ev->i_key_action )
{
case ACTIONID_NAV_LEFT:
if ( i_curr_button > 0 && i_curr_button <= pci->hli.hl_gi.btn_ns )
}
break;
case ACTIONID_NAV_ACTIVATE:
- b_activated = VLC_TRUE;
+ b_activated = true;
if ( i_curr_button > 0 && i_curr_button <= pci->hli.hl_gi.btn_ns )
{
default:
break;
}
- p_ev->b_key = VLC_FALSE;
+ p_ev->i_key_action = 0;
vlc_mutex_unlock( &p_ev->lock );
}
msg_Dbg( p_ev->p_demux, "Handle Mouse Event: Mouse clicked x(%d)*y(%d)", (unsigned)valx.i_int, (unsigned)valy.i_int);
- b_activated = VLC_TRUE;
+ b_activated = true;
// get current button
best = 0;
dist = 0x08000000; /* >> than (720*720)+(567*567); */
val.p_address = (void *)p_sys->palette;
var_Set( p_sys->p_input, "menu-palette", val );
- val.b_bool = VLC_TRUE; var_Set( p_sys->p_input, "highlight", val );
+ val.b_bool = true; var_Set( p_sys->p_input, "highlight", val );
vlc_mutex_unlock( p_mutex );
}
}
// dvdnav_mouse_select( NULL, pci, valx.i_int, valy.i_int );
}
- p_ev->b_moved = VLC_FALSE;
- p_ev->b_clicked = VLC_FALSE;
+ p_ev->b_moved = false;
+ p_ev->b_clicked = false;
vlc_mutex_unlock( &p_ev->lock );
}
var_DelCallback( p_vout, "mouse-clicked", EventMouse, p_ev );
vlc_object_release( p_vout );
}
- var_DelCallback( p_ev->p_libvlc, "key-pressed", EventKey, p_ev );
+ var_DelCallback( p_ev->p_libvlc, "key-action", EventKey, p_ev );
vlc_mutex_destroy( &p_ev->lock );
/*****************************************************************************
* Stream managment
*****************************************************************************/
-vlc_stream_io_callback::vlc_stream_io_callback( stream_t *s_, vlc_bool_t b_owner_ )
+vlc_stream_io_callback::vlc_stream_io_callback( stream_t *s_, bool b_owner_ )
{
s = s_;
b_owner = b_owner_;
- mb_eof = VLC_FALSE;
+ mb_eof = false;
}
uint32 vlc_stream_io_callback::read( void *p_buffer, size_t i_size )
if( i_pos < 0 || i_pos >= stream_Size( s ) )
{
- mb_eof = VLC_TRUE;
+ mb_eof = true;
return;
}
- mb_eof = VLC_FALSE;
+ mb_eof = false;
if( stream_Seek( s, i_pos ) )
{
- mb_eof = VLC_TRUE;
+ mb_eof = true;
}
return;
}
}
mi_level = 1;
mi_user_level = 1;
- mb_keep = VLC_FALSE;
+ mb_keep = false;
mb_dummy = config_GetInt( p_demux, "mkv-use-dummy" );
}
{
delete m_el[i];
}
- mb_keep = VLC_FALSE;
+ mb_keep = false;
}
}
}
}
m_got = NULL;
- mb_keep = VLC_FALSE;
+ mb_keep = false;
if ( m_el[1]->GetElementPosition() == i_cluster_pos )
{
m_es->I_O().setFilePointer( i_block_pos, seek_beginning );
void EbmlParser::Keep( void )
{
- mb_keep = VLC_TRUE;
+ mb_keep = true;
}
int EbmlParser::GetLevel( void )
{
delete m_el[mi_level];
}
- mb_keep = VLC_FALSE;
+ mb_keep = false;
}
m_el[mi_level] = m_es->FindNextElement( m_el[mi_level - 1]->Generic().Context, i_ulev, 0xFFFFFFFFL, mb_dummy != 0, 1 );
// IndexAppendCluster( cluster );
}
- vlc_bool_t b_seekable;
+ bool b_seekable;
stream_Control( sys.demuxer.s, STREAM_CAN_FASTSEEK, &b_seekable );
if( !b_seekable )
idx.i_block_number= -1;
idx.i_position = -1;
idx.i_time = 0;
- idx.b_key = VLC_TRUE;
+ idx.b_key = true;
ep->Down();
while( ( el = ep->Get() ) != NULL )
delete ep;
delete cues;
- b_cues = VLC_TRUE;
+ b_cues = true;
msg_Dbg( &sys.demuxer, "loading cues done." );
es.I_O().setFilePointer( i_sav_position, seek_beginning );
tk->fmt.psz_language = strdup("English");
tk->fmt.psz_description = NULL;
- tk->b_default = VLC_TRUE;
- tk->b_enabled = VLC_TRUE;
- tk->b_silent = VLC_FALSE;
+ 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->i_default_duration = 0;
tk->f_timecodescale = 1.0;
- tk->b_inited = VLC_FALSE;
+ tk->b_inited = false;
tk->i_data_init = 0;
tk->p_data_init = NULL;
if( i_tags_position >= 0 )
{
- vlc_bool_t b_seekable;
+ bool b_seekable;
stream_Control( sys.demuxer.s, STREAM_CAN_FASTSEEK, &b_seekable );
if( b_seekable )
idx.i_block_number= -1;
idx.i_position = cluster->GetElementPosition();
idx.i_time = -1;
- idx.b_key = VLC_TRUE;
+ idx.b_key = true;
i_index++;
if( i_index >= i_index_max )
{
if( tracks[i_track]->fmt.i_cat == VIDEO_ES )
{
- tracks[i_track]->b_search_keyframe = VLC_TRUE;
+ tracks[i_track]->b_search_keyframe = true;
i_track_skipping++;
}
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, tracks[i_track]->p_es, i_date );
{
if( i_block_ref1 == 0 && tracks[i_track]->b_search_keyframe )
{
- tracks[i_track]->b_search_keyframe = VLC_FALSE;
+ tracks[i_track]->b_search_keyframe = false;
i_track_skipping--;
}
if( !tracks[i_track]->b_search_keyframe )