Changeset 2aebce79d5f564b25de506071c2de578315cb14a

Show
Ignore:
Timestamp:
23/06/04 19:49:26 (4 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1088012966 +0000
git-parent:

[cb45b4c518bd2197c1522189397ec29aacb500c4]

git-author:
Laurent Aimar <fenrir@videolan.org> 1088012966 +0000
Message:

* all: - added a boolean "seekable" object variable to p_input.

(becarefull, it's just if you can seek or not, and not if you have to
display the progress bar, for thet last you have to check if "position"
value get != 0.0 )

  • added "audio-delay" and "spu-delay" object variables to delay

audio/spu to the video. They can be changed on the fly (untested).

  • renamed INPUTGET/SET_SUBDELAY into

INPUT_SET_SPU_DELAY and added INPUT_SET_AUDIO_DELAY
(wrapper to "audio-delay" and "spu-delay")

  • readded INPUT_ADD/GET_INFO/INPUT_SET_NAME. Becarefull to not over-use

them, a demuxer should export DEMUX_GET_META and not using them.

Files:

Legend:

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

    r7d01a7e r2aebce7  
    312312    INPUT_SET_STATE,            /* arg1= int            res=can fail    */ 
    313313 
     314    /* input variable "audio-delay" and "spu-delay" */ 
     315    INPUT_GET_AUDIO_DELAY,      /* arg1 = int* res=can fail */ 
     316    INPUT_SET_AUDIO_DELAY,      /* arg1 = int  res=can fail */ 
     317    INPUT_GET_SPU_DELAY,        /* arg1 = int* res=can fail */ 
     318    INPUT_SET_SPU_DELAY,        /* arg1 = int  res=can fail */ 
     319 
     320    /* Meta datas */ 
     321    INPUT_ADD_INFO,   /* arg1= char * arg2= char * arg3=...  res=can fail    */ 
     322    INPUT_GET_INFO,   /* arg1= char * arg2= char * arg3= char ** res=can fail*/ 
     323 
     324    INPUT_SET_NAME,   /* arg1= char * res=can fail    */ 
     325 
    314326    /* XXX: all next query aren't working for now */ 
    315  
    316327    /* bookmarks */ 
    317328    INPUT_GET_BOOKMARKS,   /* arg1= seekpoint_t *** arg2= int * res=can fail */ 
     
    321332    INPUT_DEL_BOOKMARK,    /* arg1= seekpoint_t *  res=can fail   */ 
    322333    INPUT_SET_BOOKMARK,    /* arg1= int  res=can fail    */ 
    323  
    324     INPUT_ADD_OPTION, /* arg1= char * arg2= char *  res=can fail    */ 
    325  
    326     /* */ 
    327     INPUT_ADD_INFO,   /* arg1= char * arg2= char * arg3=...  res=can fail    */ 
    328     INPUT_GET_INFO,   /* arg1= char * arg2= char * arg3= char ** res=can fail*/ 
    329  
    330     INPUT_SET_NAME,   /* arg1= char * res=can fail    */ 
    331  
    332     /* */ 
    333     INPUT_GET_SUBDELAY,    /* arg1 = int* res=can fail */ 
    334     INPUT_SET_SUBDELAY,    /* arg1 = int  res=can fail */ 
    335334}; 
    336335 
  • modules/control/hotkeys.c

    r1b834a3 r2aebce7  
    292292        else if( i_action == ACTIONID_SUBDELAY_DOWN ) 
    293293        { 
    294             int i_delay; 
    295             if( input_Control( p_input, INPUT_GET_SUBDELAY, &i_delay ) == 
    296                 VLC_SUCCESS ) 
    297             { 
    298                 i_delay--; 
    299                 input_Control( p_input, INPUT_SET_SUBDELAY, i_delay ); 
    300                 ClearChannels( p_intf, p_vout ); 
    301                 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms", 
    302                                  i_delay*100); 
    303             } 
     294            int64_t i_delay = var_GetTime( p_input, "spu-delay" ); 
     295 
     296            i_delay -= 10000;    /* 10 ms */ 
     297 
     298            var_SetTime( p_input, "spu-delay", i_delay ); 
     299            ClearChannels( p_intf, p_vout ); 
     300            vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms", 
     301                                 (int)(i_delay/1000) ); 
    304302        } 
    305303        else if( i_action == ACTIONID_SUBDELAY_UP ) 
    306304        { 
    307             int i_delay; 
    308             if( input_Control( p_input, INPUT_GET_SUBDELAY, &i_delay ) == 
    309                 VLC_SUCCESS ) 
    310             { 
    311                 i_delay++; 
    312                 input_Control( p_input, INPUT_SET_SUBDELAY, i_delay ); 
    313                 ClearChannels( p_intf, p_vout ); 
    314                 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms", 
    315                                  i_delay*100); 
    316             } 
     305            int64_t i_delay = var_GetTime( p_input, "spu-delay" ); 
     306 
     307            i_delay += 10000;    /* 10 ms */ 
     308 
     309            var_SetTime( p_input, "spu-delay", i_delay ); 
     310            ClearChannels( p_intf, p_vout ); 
     311            vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms", 
     312                                 (int)(i_delay/1000) ); 
    317313        } 
    318314        else if( i_action == ACTIONID_FULLSCREEN && p_vout ) 
  • modules/demux/util/sub.c

    re444b4f r2aebce7  
    7777               N_("Frames per second"), 
    7878               SUB_FPS_LONGTEXT, VLC_TRUE ); 
    79     add_integer( "sub-delay", 0, NULL, 
    80                  N_("Delay subtitles (in 1/10s)"), 
    81                  SUB_DELAY_LONGTEXT, VLC_TRUE ); 
    8279    add_string( "sub-type", "auto", NULL, "Subtitles fileformat", 
    8380                SUB_TYPE_LONGTEXT, VLC_TRUE ); 
     
    491488    vlc_bool_t     b; 
    492489    vlc_value_t    val; 
    493     mtime_t i_delay; 
    494490 
    495491    es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, p_sub->p_es, &b ); 
     
    508504    if( p_sub->i_sub_type != SUB_TYPE_VOBSUB ) 
    509505    { 
    510         var_Get( p_sub, "sub-delay", &val ); 
    511         i_delay = (mtime_t) val.i_int * 100000; 
    512506        while( p_sub->i_subtitle < p_sub->i_subtitles && 
    513                p_sub->subtitle[p_sub->i_subtitle].i_start < i_maxdate - i_delay
     507               p_sub->subtitle[p_sub->i_subtitle].i_start < i_maxdate
    514508        { 
    515509            block_t *p_block; 
     
    527521                p_sub->i_subtitle++; 
    528522                continue; 
    529             } 
    530  
    531             /* XXX we should convert all demuxers to use es_out_Control to set              * pcr and then remove that */ 
    532             if( i_delay != 0 ) 
    533             { 
    534                 p_sub->subtitle[p_sub->i_subtitle].i_start += i_delay; 
    535                 p_sub->subtitle[p_sub->i_subtitle].i_stop += i_delay; 
    536523            } 
    537524 
     
    687674        } 
    688675    } while( !i_done ); 
    689 #if 0 
    690     /* We do not do this here anymore */ 
    691     /* *** and at the end add delay *** */ 
    692     var_Get( p_sub, "sub-delay", &val ); 
    693     i_delay = (mtime_t) val.i_int * 100000; 
    694     if( i_delay != 0 ) 
    695     { 
    696         for( i = 0; i < p_sub->i_subtitles; i++ ) 
    697         { 
    698             p_sub->subtitle[i].i_start += i_delay; 
    699             p_sub->subtitle[i].i_stop += i_delay; 
    700             if( p_sub->subtitle[i].i_start < 0 ) 
    701             { 
    702                 p_sub->i_subtitle = i + 1; 
    703             } 
    704         } 
    705     } 
    706 #endif 
    707676} 
    708677 
  • modules/demux/util/sub.h

    rd6f72ea r2aebce7  
    8282 *      - i_microsecperframe is used only for microdvd file. (overriden 
    8383 *        by --sub-fps ) 
    84  *      - it's at this point that --sub-delay is applied 
    8584 * 
    8685 *****************************************************************************/ 
  • src/input/control.c

    r68d2178 r2aebce7  
    3131 
    3232static void UpdateBookmarksOption( input_thread_t * ); 
     33static void NotifyPlaylist( input_thread_t * ); 
    3334 
    3435/**************************************************************************** 
     
    5556int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) 
    5657{ 
    57     seekpoint_t *p_bkmk, ***ppp_bkmk; 
     58    /* seekpoint_t *p_bkmk, ***ppp_bkmk; 
    5859    int i_bkmk = 0; 
    5960    int *pi_bkmk; 
    60     int i, *pi; 
    61     vlc_value_t val, text; 
    62     char *psz_option, *psz_value; 
     61    */ 
    6362    int i_int, *pi_int; 
    6463    double f, *pf; 
     
    108107            return var_SetInteger( p_input, "state", i_int ); 
    109108 
    110 #if 0 
    111         case INPUT_ADD_OPTION: 
    112         { 
    113             psz_option = (char *)va_arg( args, char * ); 
    114             psz_value = (char *)va_arg( args, char * ); 
    115             i_ret = VLC_EGENERIC; 
    116  
    117             vlc_mutex_lock( &p_input->p_item->lock ); 
    118             /* Check if option already exists */ 
    119             for( i = 0; i < p_input->p_item->i_options; i++ ) 
    120             { 
    121                 if( !strncmp( p_input->p_item->ppsz_options[i], psz_option, 
    122                               strlen( psz_option ) ) && 
    123                     p_input->p_item->ppsz_options[i][strlen(psz_option)] 
    124                       == '=' ) 
    125                 { 
    126                     free( p_input->p_item->ppsz_options[i] ); 
    127                     break; 
    128                 } 
    129             } 
    130             if( i == p_input->p_item->i_options ) 
    131             { 
    132                 p_input->p_item->i_options++; 
    133                 p_input->p_item->ppsz_options = 
    134                     realloc( p_input->p_item->ppsz_options, 
    135                              p_input->p_item->i_options * sizeof(char **) ); 
    136             } 
    137  
    138             asprintf( &p_input->p_item->ppsz_options[i], 
    139                       "%s=%s", psz_option, psz_value ) ; 
    140             vlc_mutex_unlock( &p_input->p_item->lock ); 
    141  
    142             i_ret = VLC_SUCCESS; 
    143             break; 
    144         } 
    145  
    146         case INPUT_SET_NAME: 
    147         { 
    148             char *psz_name = (char *)va_arg( args, char * ); 
    149             i_ret = VLC_EGENERIC; 
    150             if( !psz_name ) break; 
    151             vlc_mutex_lock( &p_input->p_item->lock ); 
    152             if( p_input->p_item->psz_name ) free( p_input->p_item->psz_name ); 
    153             p_input->p_item->psz_name = strdup( psz_name ); 
    154             vlc_mutex_unlock( &p_input->p_item->lock ); 
    155             i_ret = VLC_SUCCESS; 
    156  
    157             /* Notify playlist */ 
    158             { 
    159                 vlc_value_t val; 
    160                 playlist_t *p_playlist = 
    161                 (playlist_t *)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, 
    162                                                FIND_PARENT ); 
    163                 if( p_playlist ) 
    164                 { 
    165                     val.i_int = p_playlist->i_index; 
    166                     vlc_mutex_unlock( &p_input->stream.stream_lock ); 
    167                     var_Set( p_playlist, "item-change", val ); 
    168                     vlc_mutex_lock( &p_input->stream.stream_lock ); 
    169                     vlc_object_release( p_playlist ); 
    170                 } 
    171             } 
    172             break; 
    173         } 
     109        case INPUT_GET_AUDIO_DELAY: 
     110            pi_64 = (int64_t*)va_arg( args, int64_t * ); 
     111            *pi_64 = var_GetTime( p_input, "audio-delay" ); 
     112            return VLC_SUCCESS; 
     113 
     114        case INPUT_GET_SPU_DELAY: 
     115            pi_64 = (int64_t*)va_arg( args, int64_t * ); 
     116            *pi_64 = var_GetTime( p_input, "spu-delay" ); 
     117            return VLC_SUCCESS; 
     118 
     119        case INPUT_SET_AUDIO_DELAY: 
     120            i_64 = (int64_t)va_arg( args, int64_t ); 
     121            return var_SetTime( p_input, "audio-delay", i_64 ); 
     122 
     123        case INPUT_SET_SPU_DELAY: 
     124            i_64 = (int64_t)va_arg( args, int64_t ); 
     125            return var_SetTime( p_input, "spu-delay", i_64 ); 
    174126 
    175127        case INPUT_ADD_INFO: 
     
    183135            int i; 
    184136 
    185             i_ret = VLC_EGENERIC; 
    186  
    187             vlc_mutex_lock( &p_input->p_item->lock ); 
    188             for( i = 0; i < p_input->p_item->i_categories; i++ ) 
    189             { 
    190                 if( !strcmp( p_input->p_item->pp_categories[i]->psz_name, 
     137            vlc_mutex_lock( &p_input->input.p_item->lock ); 
     138            for( i = 0; i < p_input->input.p_item->i_categories; i++ ) 
     139            { 
     140                if( !strcmp( p_input->input.p_item->pp_categories[i]->psz_name, 
    191141                             psz_cat ) ) 
    192                     break
    193             } 
    194  
    195             if( i == p_input->p_item->i_categories ) 
     142                    return VLC_EGENERIC
     143            } 
     144 
     145            if( i == p_input->input.p_item->i_categories ) 
    196146            { 
    197147                p_cat = malloc( sizeof( info_category_t ) ); 
    198                 if( !p_cat ) break; 
     148                if( !p_cat ) 
     149                    return VLC_EGENERIC; 
    199150                p_cat->psz_name = strdup( psz_cat ); 
    200151                p_cat->i_infos = 0; 
    201152                p_cat->pp_infos = NULL; 
    202                 INSERT_ELEM( p_input->p_item->pp_categories, 
    203                              p_input->p_item->i_categories, 
    204                              p_input->p_item->i_categories, p_cat ); 
    205             } 
    206  
    207             p_cat = p_input->p_item->pp_categories[i]; 
     153                INSERT_ELEM( p_input->input.p_item->pp_categories, 
     154                             p_input->input.p_item->i_categories, 
     155                             p_input->input.p_item->i_categories, p_cat ); 
     156            } 
     157 
     158            p_cat = p_input->input.p_item->pp_categories[i]; 
    208159 
    209160            for( i = 0; i < p_cat->i_infos; i++ ) 
     
    213164                    if( p_cat->pp_infos[i]->psz_value ) 
    214165                        free( p_cat->pp_infos[i]->psz_value ); 
    215                     break
     166                    return VLC_EGENERIC
    216167                } 
    217168            } 
     
    220171            { 
    221172                p_info = malloc( sizeof( info_t ) ); 
    222                 if( !p_info ) break; 
     173                if( !p_info ) 
     174                    return VLC_EGENERIC; 
    223175                INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, 
    224176                             p_cat->i_infos, p_info ); 
     
    229181            vasprintf( &p_info->psz_value, psz_format, args ); 
    230182 
    231             vlc_mutex_unlock( &p_input->p_item->lock ); 
    232  
    233             i_ret = VLC_SUCCESS; 
    234  
    235             /* Notify playlist */ 
    236             { 
    237                 vlc_value_t val; 
    238                 playlist_t *p_playlist = 
    239                 (playlist_t *)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, 
    240                                                FIND_PARENT ); 
    241                 if( p_playlist ) 
    242                 { 
    243                     val.i_int = p_playlist->i_index; 
    244                     vlc_mutex_unlock( &p_input->stream.stream_lock ); 
    245                     var_Set( p_playlist, "item-change", val ); 
    246                     vlc_mutex_lock( &p_input->stream.stream_lock ); 
    247                     vlc_object_release( p_playlist ); 
    248                 } 
    249             } 
     183            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     184 
     185            NotifyPlaylist( p_input ); 
    250186        } 
    251         break
     187        return VLC_SUCCESS
    252188 
    253189        case INPUT_GET_INFO: 
     
    256192            char *psz_name = (char *)va_arg( args, char * ); 
    257193            char **ppsz_value = (char **)va_arg( args, char ** ); 
     194            int i_ret = VLC_EGENERIC; 
    258195            int i; 
    259  
    260             i_ret = VLC_EGENERIC; 
    261196            *ppsz_value = NULL; 
    262197 
    263             vlc_mutex_lock( &p_input->p_item->lock ); 
    264             for( i = 0; i < p_input->p_item->i_categories; i++ ) 
    265             { 
    266                 if( !strcmp( p_input->p_item->pp_categories[i]->psz_name, 
     198            vlc_mutex_lock( &p_input->input.p_item->lock ); 
     199            for( i = 0; i < p_input->input.p_item->i_categories; i++ ) 
     200            { 
     201                if( !strcmp( p_input->input.p_item->pp_categories[i]->psz_name, 
    267202                             psz_cat ) ) 
    268                     break
    269             } 
    270  
    271             if( i != p_input->p_item->i_categories ) 
     203                    return VLC_EGENERIC
     204            } 
     205 
     206            if( i != p_input->input.p_item->i_categories ) 
    272207            { 
    273208                info_category_t *p_cat; 
    274                 p_cat = p_input->p_item->pp_categories[i]; 
     209                p_cat = p_input->input.p_item->pp_categories[i]; 
    275210 
    276211                for( i = 0; i < p_cat->i_infos; i++ ) 
     
    287222                } 
    288223            } 
    289             vlc_mutex_unlock( &p_input->p_item->lock ); 
     224            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     225            return i_ret; 
    290226        } 
    291         break; 
    292  
     227 
     228        case INPUT_SET_NAME: 
     229        { 
     230            char *psz_name = (char *)va_arg( args, char * ); 
     231 
     232            if( !psz_name ) 
     233                return VLC_EGENERIC; 
     234 
     235            vlc_mutex_lock( &p_input->input.p_item->lock ); 
     236            if( p_input->input.p_item->psz_name ) 
     237                free( p_input->input.p_item->psz_name ); 
     238            p_input->input.p_item->psz_name = strdup( psz_name ); 
     239            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     240 
     241            NotifyPlaylist( p_input ); 
     242 
     243            return VLC_SUCCESS; 
     244        } 
     245 
     246#if 0 
    293247        case INPUT_ADD_BOOKMARK: 
    294248            p_bkmk = (seekpoint_t *)va_arg( args, seekpoint_t * ); 
     
    441395            break; 
    442396 
    443         case INPUT_GET_SUBDELAY: 
    444             pi = (int*)va_arg( args, int *); 
    445             /* We work on the first subtitle */ 
    446             if( p_input->p_sys != NULL ) 
    447             { 
    448                 if( p_input->p_sys->i_sub > 0 ) 
    449                 { 
    450                     i_ret = var_Get( (vlc_object_t *)p_input->p_sys->sub[0], 
    451                                       "sub-delay", &val ); 
    452                     *pi = val.i_int; 
    453                 } 
    454                 else 
    455                 { 
    456                     msg_Dbg( p_input,"no subtitle track"); 
    457                     i_ret = VLC_EGENERIC; 
    458                 } 
    459             } 
    460             else 
    461             { 
    462                 i_ret = VLC_EGENERIC; 
    463             } 
    464             break; 
    465  
    466         case INPUT_SET_SUBDELAY: 
    467             i = (int)va_arg( args, int ); 
    468             /* We work on the first subtitle */ 
    469             if( p_input->p_sys ) 
    470             { 
    471                 if( p_input->p_sys->i_sub > 0 ) 
    472                 { 
    473                     val.i_int = i; 
    474                     i_ret = var_Set( (vlc_object_t *)p_input->p_sys->sub[0], 
    475                                       "sub-delay", val ); 
    476                 } 
    477                 else 
    478                 { 
    479                     msg_Dbg( p_input,"no subtitle track"); 
    480                     i_ret = VLC_EGENERIC; 
    481                 } 
    482             } 
    483             else 
    484             { 
    485                 i_ret = VLC_EGENERIC; 
    486             } 
    487             break; 
    488397#endif 
    489398        case INPUT_GET_BOOKMARKS: 
     
    493402        case INPUT_DEL_BOOKMARK: 
    494403        case INPUT_SET_BOOKMARK: 
    495         case INPUT_ADD_OPTION: 
    496         case INPUT_ADD_INFO: 
    497         case INPUT_GET_INFO: 
    498         case INPUT_SET_NAME: 
    499         case INPUT_GET_SUBDELAY: 
    500         case INPUT_SET_SUBDELAY: 
    501404            /* FIXME */ 
    502405            msg_Err( p_input, "unimplemented query in input_vaControl" ); 
     
    507410} 
    508411 
     412static void NotifyPlaylist( input_thread_t *p_input ) 
     413{ 
     414    playlist_t *p_playlist = 
     415        (playlist_t *)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, 
     416                                       FIND_PARENT ); 
     417    if( p_playlist ) 
     418    { 
     419        var_SetInteger( p_playlist, "item-change", p_playlist->i_index ); 
     420        vlc_object_release( p_playlist ); 
     421    } 
     422} 
     423 
    509424static void UpdateBookmarksOption( input_thread_t *p_input ) 
    510425{ 
     426#if 0 
    511427    int i, i_len = 0; 
    512428    char *psz_value = NULL, *psz_next = NULL; 
    513429    /* FIXME */ 
    514 #if 0 
    515430    vlc_mutex_unlock( &p_input->stream.stream_lock ); 
    516431 
  • src/input/es_out.c

    r68d2178 r2aebce7  
    9898    es_out_id_t *p_es_video; 
    9999    es_out_id_t *p_es_sub; 
     100 
     101    /* delay */ 
     102    int64_t i_audio_delay; 
     103    int64_t i_spu_delay; 
    100104}; 
    101105 
     
    154158    p_sys->p_es_sub   = NULL; 
    155159 
     160    p_sys->i_audio_delay= 0; 
     161    p_sys->i_spu_delay  = 0; 
     162 
    156163    return out; 
    157164} 
     
    224231        } 
    225232    } 
     233} 
     234 
     235void input_EsOutSetDelay( es_out_t *out, int i_cat, int64_t i_delay ) 
     236{ 
     237    es_out_sys_t *p_sys = out->p_sys; 
     238 
     239    if( i_cat == AUDIO_ES ) 
     240        p_sys->i_audio_delay = i_delay; 
     241    else if( i_cat == SPU_ES ) 
     242        p_sys->i_spu_delay = i_delay; 
    226243} 
    227244 
     
    716733    input_thread_t    *p_input = p_sys->p_input; 
    717734    es_out_pgrm_t *p_pgrm = es->p_pgrm; 
     735    int64_t i_delay; 
     736 
     737    if( es->fmt.i_cat == AUDIO_ES ) 
     738        i_delay = p_sys->i_audio_delay; 
     739    else if( es->fmt.i_cat == SPU_ES ) 
     740        i_delay = p_sys->i_spu_delay; 
     741    else 
     742        i_delay = 0; 
    718743 
    719744    /* +11 -> avoid null value with non null dts/pts */ 
     
    721746    { 
    722747        p_block->i_dts = 
    723             input_ClockGetTS( p_input, &p_pgrm->clock, ( p_block->i_dts + 11 ) * 9 / 100 ); 
     748            input_ClockGetTS( p_input, &p_pgrm->clock, 
     749                              ( p_block->i_dts + 11 ) * 9 / 100 ) + i_delay; 
    724750    } 
    725751    if( p_block->i_pts > 0 ) 
    726752    { 
    727753        p_block->i_pts = 
    728             input_ClockGetTS( p_input, &p_pgrm->clock, ( p_block->i_pts + 11 )* 9 / 100 ); 
     754            input_ClockGetTS( p_input, &p_pgrm->clock, 
     755                              ( p_block->i_pts + 11 ) * 9 / 100 ) + i_delay; 
    729756    } 
    730757 
  • src/input/input.c

    reb3c709 r2aebce7  
    7676 *  - chapter,chapter-next, chapter-prev 
    7777 *  - program, audio-es, video-es, spu-es 
     78 *  - audio-delay, spu-delay 
    7879 *  - bookmark 
    7980 * * Get only: 
    8081 *  - length 
    8182 *  - bookmarks 
     83 *  - seekable (if you can seek, it doesn't say if 'bar display' has be shown or not, for that check position != 0.0) 
    8284 * * For intf callback upon changes 
    8385 *  - intf-change 
     
    281283 ***************************************************************************** 
    282284 * Thread in charge of processing the network packets and demultiplexing. 
     285 * 
     286 * TODO: 
     287 *  read subtitle support (XXX take care of spu-delay in the right way). 
     288 *  multi-input support (XXX may be done with subs) 
    283289 *****************************************************************************/ 
    284290static int Run( input_thread_t *p_input ) 
     
    674680        demux2_Control( p_input->input.p_demux, DEMUX_CAN_PAUSE, 
    675681                        &p_input->input.b_can_pause ); 
     682 
     683        /* FIXME todo 
     684        demux2_Control( p_input->input.p_demux, DEMUX_CAN_SEEK, 
     685                        &val.b_bool ); 
     686        */ 
    676687    } 
    677688    else 
     
    729740        access2_Control( p_input->input.p_access, ACCESS_CAN_PAUSE, 
    730741                         &p_input->input.b_can_pace_control ); 
     742        access2_Control( p_input->input.p_access, ACCESS_CAN_SEEK, 
     743                         &val.b_bool ); 
     744        var_Set( p_input, "seekable", val ); 
    731745 
    732746        /* Create the stream_t */ 
     
    15291543            break; 
    15301544 
     1545        case INPUT_CONTROL_SET_AUDIO_DELAY: 
     1546            input_EsOutSetDelay( p_input->p_es_out, 
     1547                                 AUDIO_ES, val.i_time ); 
     1548            var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL ); 
     1549            break; 
     1550 
     1551        case INPUT_CONTROL_SET_SPU_DELAY: 
     1552            input_EsOutSetDelay( p_input->p_es_out, 
     1553                                 SPU_ES, val.i_time ); 
     1554            var_Change( p_input, "spu-delay", VLC_VAR_SETVALUE, &val, NULL ); 
     1555            break; 
     1556 
    15311557        case INPUT_CONTROL_SET_TITLE: 
    15321558        case INPUT_CONTROL_SET_TITLE_NEXT: 
  • src/input/input_internal.h

    r7291747 r2aebce7  
    5757 
    5858    INPUT_CONTROL_SET_ES, 
     59 
     60    INPUT_CONTROL_SET_AUDIO_DELAY, 
     61    INPUT_CONTROL_SET_SPU_DELAY, 
    5962}; 
    6063struct input_thread_sys_t 
     
    120123es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id ); 
    121124void      input_EsOutDiscontinuity( es_out_t *, vlc_bool_t b_audio ); 
     125void      input_EsOutSetDelay( es_out_t *, int i_cat, int64_t ); 
    122126 
    123127/* clock.c */ 
  • src/input/var.c

    r51d78b6 r2aebce7  
    6363static int ESCallback      ( vlc_object_t *p_this, char const *psz_cmd, 
    6464                             vlc_value_t oldval, vlc_value_t newval, void * ); 
     65static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd, 
     66                             vlc_value_t oldval, vlc_value_t newval, void * ); 
     67 
    6568static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd, 
    6669                             vlc_value_t oldval, vlc_value_t newval, void * ); 
     
    145148    var_Change( p_input, "navigation", VLC_VAR_SETTEXT, &text, NULL ); 
    146149 
     150    /* Delay */ 
     151    var_Create( p_input, "audio-delay", VLC_VAR_TIME ); 
     152    val.i_time = 0; 
     153    var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL ); 
     154    var_AddCallback( p_input, "audio-delay", EsDelayCallback, NULL ); 
     155    var_Create( p_input, "spu-delay", VLC_VAR_TIME ); 
     156    val.i_time = 0; 
     157    var_Change( p_input, "spu-delay", VLC_VAR_SETVALUE, &val, NULL ); 
     158    var_AddCallback( p_input, "spu-delay", EsDelayCallback, NULL ); 
     159 
     160 
    147161    /* Video ES */ 
    148162    var_Create( p_input, "video-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); 
     
    193207    var_Destroy( p_input, "time" ); 
    194208    var_Destroy( p_input, "time-offset" ); 
     209 
     210    var_Destroy( p_input, "audio-delay" ); 
     211    var_Destroy( p_input, "spu-delay" ); 
    195212 
    196213    var_Destroy( p_input, "bookmark" ); 
     
    385402 
    386403    var_Create( p_input, "cr-average", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); 
     404 
     405    var_Create( p_input, "seekable", VLC_VAR_BOOL ); 
     406    val.b_bool = VLC_TRUE; /* Fixed later*/ 
     407    var_Change( p_input, "seekable", VLC_VAR_SETVALUE, &val, NULL ); 
     408 
    387409} 
    388410 
     
    624646} 
    625647 
     648static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd, 
     649                             vlc_value_t oldval, vlc_value_t newval, void *p ) 
     650{ 
     651    input_thread_t *p_input = (input_thread_t*)p_this; 
     652 
     653    if( !strcmp( psz_cmd, "audio-delay" ) ) 
     654        input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval ); 
     655    else if( !strcmp( psz_cmd, "spu-delay" ) ) 
     656        input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval ); 
     657    return VLC_SUCCESS; 
     658} 
     659 
    626660static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd, 
    627661                             vlc_value_t oldval, vlc_value_t newval, void *p_data )