Changeset ac3afe50d884bdc2ff8d8776381b5de088d69847

Show
Ignore:
Timestamp:
24/09/06 15:13:40 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1159103620 +0000
git-parent:

[bf7394d35e13c81a0435b992a4fe436e7b16d764]

git-author:
Clément Stenac <zorglub@videolan.org> 1159103620 +0000
Message:

Don't notify playlist several times while preparsing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_input.h

    r857b51f rac3afe5  
    388388    vlc_bool_t  b_can_pace_control; 
    389389    vlc_bool_t  b_can_pause; 
     390    vlc_bool_t  b_preparsing; 
    390391 
    391392    /* Global state */ 
  • src/input/control.c

    r857b51f rac3afe5  
    196196            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
    197197 
    198             NotifyPlaylist( p_input ); 
     198            if( !p_input->b_preparsing ) 
     199                NotifyPlaylist( p_input ); 
    199200        } 
    200201        return VLC_SUCCESS; 
     
    241242                return VLC_EGENERIC; 
    242243 
    243             NotifyPlaylist( p_input ); 
     244            if( !p_input->b_preparsing ) 
     245                NotifyPlaylist( p_input ); 
    244246        } 
    245247        return VLC_SUCCESS; 
     
    271273            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
    272274 
    273             NotifyPlaylist( p_input ); 
     275            if( !p_input->b_preparsing ) 
     276                NotifyPlaylist( p_input ); 
    274277 
    275278            return VLC_SUCCESS; 
  • src/input/input.c

    rb50966f rac3afe5  
    5656static input_thread_t * Create  ( vlc_object_t *, input_item_t *, char *, 
    5757                                  vlc_bool_t ); 
    58 static  int             Init    ( input_thread_t *p_input, vlc_bool_t b_quick ); 
     58static  int             Init    ( input_thread_t *p_input ); 
    5959static void             Error   ( input_thread_t *p_input ); 
    6060static void             End     ( input_thread_t *p_input ); 
     
    6767static int  UpdateFromAccess( input_thread_t * ); 
    6868static int  UpdateFromDemux( input_thread_t * ); 
    69 static int  UpdateMeta( input_thread_t *, vlc_bool_t ); 
    70  
    71 static void UpdateItemLength( input_thread_t *, int64_t i_length, vlc_bool_t ); 
     69static int  UpdateMeta( input_thread_t * ); 
     70 
     71static void UpdateItemLength( input_thread_t *, int64_t i_length ); 
    7272 
    7373static void DecodeUrl( char * ); 
     
    7676static input_source_t *InputSourceNew( input_thread_t *); 
    7777static int  InputSourceInit( input_thread_t *, input_source_t *, 
    78                              char *, char *psz_forced_demux, 
    79                              vlc_bool_t b_quick ); 
     78                             char *, char *psz_forced_demux ); 
    8079static void InputSourceClean( input_thread_t *, input_source_t * ); 
    8180 
     
    125124        return NULL; 
    126125    } 
     126    p_input->b_preparsing = b_quick; 
    127127    p_input->psz_header = psz_header ? strdup( psz_header ) : NULL; 
    128128 
     
    186186    p_input->input.i_cr_average = var_GetInteger( p_input, "cr-average" ); 
    187187 
    188     if( !b_quick
     188    if( !p_input->b_preparsing
    189189    { 
    190190        var_Get( p_input, "bookmarks", &val ); 
     
    338338    vlc_object_attach( p_input, p_parent ); 
    339339 
    340     Init( p_input, VLC_TRUE ); 
     340    Init( p_input ); 
    341341 
    342342    /* Clean up master */ 
     
    463463    vlc_thread_ready( p_input ); 
    464464 
    465     if( Init( p_input, VLC_FALSE ) ) 
     465    if( Init( p_input ) ) 
    466466    { 
    467467        /* If we failed, wait before we are killed, and exit */ 
     
    517517    vlc_thread_ready( p_input ); 
    518518 
    519     if( Init( p_input, VLC_FALSE ) ) 
     519    if( Init( p_input ) ) 
    520520    { 
    521521        /* If we failed, just exit */ 
     
    699699                if( old_val.i_time != val.i_time ) 
    700700                { 
    701                     UpdateItemLength( p_input, i_length, VLC_TRUE ); 
     701                    UpdateItemLength( p_input, i_length ); 
    702702                } 
    703703            } 
     
    710710 
    711711 
    712 static int Init( input_thread_t * p_input, vlc_bool_t b_quick
     712static int Init( input_thread_t * p_input
    713713{ 
    714714    char *psz; 
     
    728728     */ 
    729729    memset( &p_input->counters, 0, sizeof( p_input->counters ) ); 
    730     if( !b_quick
     730    if( !p_input->b_preparsing
    731731    { 
    732732        /* Prepare statistics */ 
     
    791791 
    792792    if( InputSourceInit( p_input, &p_input->input, 
    793                          p_input->input.p_item->psz_uri, NULL, b_quick ) ) 
     793                         p_input->input.p_item->psz_uri, NULL ) ) 
    794794    { 
    795795        goto error; 
     
    797797 
    798798    /* Create global title (from master) */ 
    799     if( !b_quick
     799    if( !p_input->b_preparsing
    800800    { 
    801801        p_input->i_title = p_input->input.i_title; 
     
    835835    { 
    836836        var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL ); 
    837         UpdateItemLength( p_input, val.i_time, b_quick ); 
     837        UpdateItemLength( p_input, val.i_time ); 
    838838        p_input->input.p_item->i_duration = val.i_time; 
    839839    } 
    840840 
    841841    /* Start title/chapter */ 
    842     if( !b_quick
     842    if( !p_input->b_preparsing
    843843    { 
    844844        val.i_int = p_input->input.i_title_start - 
     
    941941                { 
    942942                    sub = InputSourceNew( p_input ); 
    943                     if( !InputSourceInit( p_input, sub, subs[i], "subtitle", 
    944                                           VLC_FALSE ) ) 
     943                    if( !InputSourceInit( p_input, sub, subs[i], "subtitle" ) ) 
    945944                    { 
    946945                        TAB_APPEND( p_input->i_slave, p_input->slave, sub ); 
     
    977976                msg_Dbg( p_input, "adding slave input '%s'", psz ); 
    978977                slave = InputSourceNew( p_input ); 
    979                 if( !InputSourceInit( p_input, slave, psz, NULL, VLC_FALSE ) ) 
     978                if( !InputSourceInit( p_input, slave, psz, NULL ) ) 
    980979                { 
    981980                    TAB_APPEND( p_input->i_slave, p_input->slave, slave ); 
     
    993992 
    994993    /* Set up es_out */ 
    995     if( !b_quick
     994    if( !p_input->b_preparsing
    996995    { 
    997996        es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE ); 
     
    10671066 
    10681067    /* Access_file does not give any meta, and there are no slave */ 
    1069     if( !b_quick
     1068    if( !p_input->b_preparsing
    10701069    { 
    10711070        if( p_input->input.p_access ) 
     
    10861085    } 
    10871086 
    1088     UpdateMeta( p_input, b_quick ); 
    1089  
    1090     if( !b_quick
     1087    UpdateMeta( p_input ); 
     1088 
     1089    if( !p_input->b_preparsing
    10911090    { 
    10921091        msg_Dbg( p_input, "`%s' successfully opened", 
     
    16731672                input_source_t *slave = InputSourceNew( p_input ); 
    16741673 
    1675                 if( !InputSourceInit( p_input, slave, val.psz_string, NULL, 
    1676                                       VLC_FALSE ) ) 
     1674                if( !InputSourceInit( p_input, slave, val.psz_string, NULL ) ) 
    16771675                { 
    16781676                    vlc_meta_t *p_meta = p_input->input.p_item->p_meta; 
     
    17051703                                     p_meta ); 
    17061704                    demux2_Control( slave->p_demux, DEMUX_GET_META, p_meta ); 
    1707                     UpdateMeta( p_input, VLC_FALSE ); 
     1705                    UpdateMeta( p_input ); 
    17081706 
    17091707                    TAB_APPEND( p_input->i_slave, p_input->slave, slave ); 
     
    18111809        vlc_meta_t *p_meta = p_input->input.p_item->p_meta; 
    18121810        access2_Control( p_input->input.p_access,ACCESS_GET_META, p_meta ); 
    1813         UpdateMeta( p_input, VLC_FALSE ); 
     1811        UpdateMeta( p_input ); 
    18141812        var_SetBool( p_input, "item-change", p_input->input.p_item->i_id ); 
    18151813        p_access->info.i_update &= ~INPUT_UPDATE_META; 
     
    18481846 * UpdateMeta: 
    18491847 *****************************************************************************/ 
    1850 static int  UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick
     1848static int  UpdateMeta( input_thread_t *p_input
    18511849{ 
    18521850    vlc_meta_t *p_meta = p_input->input.p_item->p_meta; 
     
    18651863 * UpdateItemLength: 
    18661864 *****************************************************************************/ 
    1867 static void UpdateItemLength( input_thread_t *p_input, int64_t i_length, 
    1868                               vlc_bool_t b_quick ) 
    1869 
    1870     char psz_buffer[MSTRTIME_MAX_SIZE]; 
    1871  
     1865static void UpdateItemLength( input_thread_t *p_input, int64_t i_length ) 
     1866
    18721867    vlc_mutex_lock( &p_input->input.p_item->lock ); 
    18731868    p_input->input.p_item->i_duration = i_length; 
    18741869    vlc_mutex_unlock( &p_input->input.p_item->lock ); 
    18751870 
    1876     pl_Yield( p_input ); 
    1877     var_SetInteger( pl_Get( p_input ), "item-change", 
    1878                     p_input->input.p_item->i_id ); 
    1879     pl_Release( p_input ) 
    1880  
    1881     input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"), 
    1882                    msecstotimestr( psz_buffer, i_length / 1000 ) ); 
     1871    if( !p_input->b_preparsing ) 
     1872    { 
     1873        pl_Yield( p_input ); 
     1874        var_SetInteger( pl_Get( p_input ), "item-change", 
     1875                        p_input->input.p_item->i_id ); 
     1876        pl_Release( p_input ) 
     1877    } 
    18831878} 
    18841879 
     
    19151910static int InputSourceInit( input_thread_t *p_input, 
    19161911                            input_source_t *in, char *psz_mrl, 
    1917                             char *psz_forced_demux, vlc_bool_t b_quick
     1912                            char *psz_forced_demux
    19181913{ 
    19191914    char *psz_dup = strdup( psz_mrl ); 
     
    19281923 
    19291924    /* Split uri */ 
    1930     if( !b_quick
     1925    if( !p_input->b_preparsing
    19311926    { 
    19321927        MRLSplit( VLC_OBJECT(p_input), psz_dup, 
     
    20192014        /* Now try a real access */ 
    20202015        in->p_access = access2_New( p_input, psz_access, psz_demux, psz_path, 
    2021                                     b_quick ); 
     2016                                    p_input->b_preparsing ); 
    20222017 
    20232018        /* Access failed, URL encoded ? */ 
     
    20312026            in->p_access = access2_New( p_input, 
    20322027                                        psz_access, psz_demux, psz_path, 
    2033                                         b_quick ); 
     2028                                        p_input->b_preparsing ); 
    20342029        } 
    20352030#ifndef WIN32      /* Remove this gross hack from the win32 build as colons 
     
    20522047            in->p_access = access2_New( p_input, 
    20532048                                        psz_access, psz_demux, psz_path, 
    2054                                         b_quick ); 
     2049                                        p_input->b_preparsing ); 
    20552050        } 
    20562051#endif 
     
    20892084 
    20902085        /* Get infos from access */ 
    2091         if( !b_quick
     2086        if( !p_input->b_preparsing
    20922087        { 
    20932088            access2_Control( in->p_access, 
     
    21162111 
    21172112        /* Create the stream_t */ 
    2118         in->p_stream = stream_AccessNew( in->p_access, b_quick ); 
     2113        in->p_stream = stream_AccessNew( in->p_access, p_input->b_preparsing ); 
    21192114        if( in->p_stream == NULL ) 
    21202115        { 
     
    21292124        } 
    21302125        in->p_demux = demux2_New( p_input, psz_access, psz_demux, psz_path, 
    2131                                   in->p_stream, p_input->p_es_out, b_quick ); 
     2126                                  in->p_stream, p_input->p_es_out, 
     2127                                  p_input->b_preparsing ); 
    21322128        if( in->p_demux == NULL ) 
    21332129        { 
     
    21422138 
    21432139        /* TODO get title from demux */ 
    2144         if( !b_quick && in->i_title <= 0 ) 
     2140        if( !p_input->b_preparsing && in->i_title <= 0 ) 
    21452141        { 
    21462142            if( demux2_Control( in->p_demux, DEMUX_GET_TITLE_INFO, 
     
    25132509 
    25142510    sub = InputSourceNew( p_input ); 
    2515     if( !InputSourceInit( p_input, sub, psz_subtitle, "subtitle", VLC_FALSE ) ) 
     2511    if( !InputSourceInit( p_input, sub, psz_subtitle, "subtitle" ) ) 
    25162512    { 
    25172513        TAB_APPEND( p_input->i_slave, p_input->slave, sub );