X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Favi%2Favi.c;h=ec31313e0e831b88ba83bbb41996ba62b199a08e;hb=9ad7f61f78c566792ef30c9218e6785f48efb621;hp=ad7443f29a118968fff06f5fb8ae713bc1455169;hpb=b1dd2eb4027d90ced29acaf31dbf7558a3f3388f;p=vlc diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index ad7443f29a..ec31313e0e 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include @@ -68,10 +68,10 @@ vlc_module_begin () set_subcategory( SUBCAT_INPUT_DEMUX ) add_bool( "avi-interleaved", 0, NULL, - INTERLEAVE_TEXT, INTERLEAVE_LONGTEXT, true ); + INTERLEAVE_TEXT, INTERLEAVE_LONGTEXT, true ) add_integer( "avi-index", 0, NULL, - INDEX_TEXT, INDEX_LONGTEXT, false ); - change_integer_list( pi_index, ppsz_indexes, NULL ); + INDEX_TEXT, INDEX_LONGTEXT, false ) + change_integer_list( pi_index, ppsz_indexes, NULL ) set_callbacks( Open, Close ) vlc_module_end () @@ -339,11 +339,11 @@ static int Open( vlc_object_t * p_this ) if( ( p_sys->meta = vlc_meta_New() ) ) { char buffer[200]; - sprintf( buffer, "%s%s%s%s", - p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"", - p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"", - p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"", - p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" ); + snprintf( buffer, sizeof(buffer), "%s%s%s%s", + p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"", + p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"", + p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"", + p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" ); vlc_meta_SetSetting( p_sys->meta, buffer ); } @@ -584,7 +584,7 @@ static int Open( vlc_object_t * p_this ) { const uint8_t *p_pal = fmt.p_extra; - fmt.video.p_palette = calloc( sizeof(video_palette_t), 1 ); + fmt.video.p_palette = calloc( 1, sizeof(video_palette_t) ); fmt.video.p_palette->i_entries = __MIN(fmt.i_extra/4, 256); for( int i = 0; i < fmt.video.p_palette->i_entries; i++ ) @@ -630,11 +630,7 @@ static int Open( vlc_object_t * p_this ) continue; } if( p_strn ) - { - /* The charset of p_strn is undefined */ - EnsureUTF8( p_strn->p_str ); - fmt.psz_description = strdup( p_strn->p_str ); - } + fmt.psz_description = FromLatin1( p_strn->p_str ); if( tk->p_out_muxed == NULL ) tk->p_es = es_out_Add( p_demux->out, &fmt ); TAB_APPEND( p_sys->i_track, p_sys->track, tk ); @@ -679,23 +675,20 @@ aviindex: b_index = true; goto aviindex; } - int i_create; - i_create = intf_UserYesNo( p_demux, _("AVI Index") , - _( "This AVI file is broken. Seeking will not " - "work correctly.\nDo you want to " - "try to repair it?\n\nThis might take a long time." ), - _( "Repair" ), _( "Don't repair" ), _( "Cancel") ); - if( i_create == DIALOG_OK_YES ) - { - b_index = true; - msg_Dbg( p_demux, "Fixing AVI index" ); - goto aviindex; - } - else if( i_create == DIALOG_CANCELLED ) + switch( dialog_Question( p_demux, _("AVI Index") , + _( "This AVI file is broken. Seeking will not work correctly.\n" + "Do you want to try to fix it?\n\n" + "This might take a long time." ), + _( "Repair" ), _( "Don't repair" ), _( "Cancel") ) ) { - /* Kill input */ - vlc_object_kill( p_demux->p_parent ); - goto error; + case 1: + b_index = true; + msg_Dbg( p_demux, "Fixing AVI index" ); + goto aviindex; + case 3: + /* Kill input */ + vlc_object_kill( p_demux->p_parent ); + goto error; } } } @@ -1989,6 +1982,7 @@ static void AVI_ParseStreamHeader( vlc_fourcc_t i_id, break; case AVITWOCC_dc: case AVITWOCC_db: + case AVITWOCC_AC: SET_PTR( pi_type, VIDEO_ES ); break; default: @@ -2378,7 +2372,7 @@ static void AVI_IndexCreate( demux_t *p_demux ) off_t i_movi_end; mtime_t i_dialog_update; - int i_dialog_id; + dialog_progress_bar_t *p_dialog = NULL; p_riff = AVI_ChunkFind( &p_sys->ck_root, AVIFOURCC_RIFF, 0); p_movi = AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0); @@ -2403,10 +2397,10 @@ static void AVI_IndexCreate( demux_t *p_demux ) /* Only show dialog if AVI is > 10MB */ - i_dialog_id = -1; i_dialog_update = mdate(); if( stream_Size( p_demux->s ) > 10000000 ) - i_dialog_id = intf_IntfProgress( p_demux, _("Fixing AVI Index..."), 0.0 ); + p_dialog = dialog_ProgressCreate( p_demux, NULL, + _("Fixing AVI Index..."), _("Cancel") ); for( ;; ) { @@ -2416,15 +2410,14 @@ static void AVI_IndexCreate( demux_t *p_demux ) break; /* Don't update/check dialog too often */ - if( i_dialog_id > 0 && mdate() - i_dialog_update > 100000 ) + if( p_dialog && mdate() - i_dialog_update > 100000 ) { - if( intf_ProgressIsCancelled( p_demux, i_dialog_id ) ) + if( dialog_ProgressCancelled( p_dialog ) ) break; - double f_pos = 100.0 * stream_Tell( p_demux->s ) / - stream_Size( p_demux->s ); - intf_ProgressUpdate( p_demux, i_dialog_id, - _( "Fixing AVI Index..." ), f_pos, -1 ); + float f_pos = (float)stream_Tell( p_demux->s ) / + (float)stream_Size( p_demux->s ); + dialog_ProgressSet( p_dialog, NULL, f_pos ); i_dialog_update = mdate(); } @@ -2487,8 +2480,8 @@ static void AVI_IndexCreate( demux_t *p_demux ) } print_stat: - if( i_dialog_id > 0 ) - intf_UserHide( p_demux, i_dialog_id ); + if( p_dialog != NULL ) + dialog_ProgressDestroy( p_dialog ); for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ ) {