⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 input.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 5 页
字号:
                    i_seekpoint_time = p_input->input.title[p_demux->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;                    if( i_seekpoint_time >= 0 &&                         !demux2_Control( p_demux,                                          DEMUX_GET_TIME, &i_input_time ) )                    {                        if ( i_input_time < i_seekpoint_time + 3000000 )                            i_seekpoint--;                    }                    else                        i_seekpoint--;                }                else if( i_type == INPUT_CONTROL_SET_SEEKPOINT_NEXT )                    i_seekpoint = p_demux->info.i_seekpoint + 1;                else                    i_seekpoint = val.i_int;                if( i_seekpoint >= 0 && i_seekpoint <                    p_input->input.title[p_demux->info.i_title]->i_seekpoint )                {                    demux2_Control( p_demux, DEMUX_SET_SEEKPOINT, i_seekpoint );                    input_EsOutDiscontinuity( p_input->p_es_out, VLC_FALSE );                    es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );                }            }            else if( p_input->input.i_title > 0 )            {                demux_t *p_demux = p_input->input.p_demux;                access_t *p_access = p_input->input.p_access;                int i_seekpoint;                int64_t i_input_time;                int64_t i_seekpoint_time;                if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )                {                    i_seekpoint = p_access->info.i_seekpoint;                    i_seekpoint_time = p_input->input.title[p_access->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;                    if( i_seekpoint_time >= 0 &&                        demux2_Control( p_demux,                                        DEMUX_GET_TIME, &i_input_time ) )                    {                        if ( i_input_time < i_seekpoint_time + 3000000 )                            i_seekpoint--;                    }                    else                        i_seekpoint--;                }                else if( i_type == INPUT_CONTROL_SET_SEEKPOINT_NEXT )                     i_seekpoint = p_access->info.i_seekpoint + 1;                else                    i_seekpoint = val.i_int;                if( i_seekpoint >= 0 && i_seekpoint <                    p_input->input.title[p_access->info.i_title]->i_seekpoint )                {                    access2_Control( p_access, ACCESS_SET_SEEKPOINT, i_seekpoint );                    stream_AccessReset( p_input->input.p_stream );                    input_EsOutDiscontinuity( p_input->p_es_out, VLC_FALSE );                    es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );                }            }            break;        case INPUT_CONTROL_ADD_SLAVE:            if( val.psz_string )            {                input_source_t *slave = InputSourceNew( p_input );                if( !InputSourceInit( p_input, slave, val.psz_string, NULL,                                      VLC_FALSE ) )                {                    vlc_meta_t *p_meta_new = NULL;                    vlc_meta_t *p_meta;                    int64_t i_time;                    /* Add the slave */                    msg_Dbg( p_input, "adding %s as slave on the fly",                             val.psz_string );                    /* Set position */                    if( demux2_Control( p_input->input.p_demux,                                        DEMUX_GET_TIME, &i_time ) )                    {                        msg_Err( p_input, "demux doesn't like DEMUX_GET_TIME" );                        InputSourceClean( p_input, slave );                        free( slave );                        break;                    }                    if( demux2_Control( slave->p_demux,                                        DEMUX_SET_TIME, i_time ) )                    {                        msg_Err( p_input, "seek failed for new slave" );                        InputSourceClean( p_input, slave );                        free( slave );                        break;                    }                    /* Get meta (access and demux) */                    if( access2_Control( slave->p_access,                                          ACCESS_GET_META, &p_meta_new ) )                        p_meta_new = NULL;                    if( !demux2_Control( slave->p_demux,                                         DEMUX_GET_META, &p_meta ) )                    {                        if( p_meta_new )                        {                            vlc_meta_Merge( p_meta_new, p_meta );                            vlc_meta_Delete( p_meta );                        }                        else                        {                            p_meta_new = p_meta;                        }                    }                    /* Update meta */                    if( p_meta_new )                    {                        if( p_input->p_meta )                        {                            vlc_meta_Merge( p_input->p_meta, p_meta_new );                            vlc_meta_Delete( p_meta_new );                        }                        else                        {                            p_input->p_meta = p_meta_new;                        }                        UpdateMeta( p_input, VLC_FALSE );                    }                    TAB_APPEND( p_input->i_slave, p_input->slave, slave );                }                else                {                    msg_Warn( p_input, "failed to add %s as slave",                              val.psz_string );                }                free( val.psz_string );            }            break;        case INPUT_CONTROL_SET_BOOKMARK:        default:            msg_Err( p_input, "not yet implemented" );            break;    }    return b_force_update;}/***************************************************************************** * UpdateFromDemux: *****************************************************************************/static int UpdateFromDemux( input_thread_t *p_input ){    demux_t *p_demux = p_input->input.p_demux;    vlc_value_t v;    if( p_demux->info.i_update & INPUT_UPDATE_TITLE )    {        v.i_int = p_demux->info.i_title;        var_Change( p_input, "title", VLC_VAR_SETVALUE, &v, NULL );        input_ControlVarTitle( p_input, p_demux->info.i_title );        p_demux->info.i_update &= ~INPUT_UPDATE_TITLE;    }    if( p_demux->info.i_update & INPUT_UPDATE_SEEKPOINT )    {        v.i_int = p_demux->info.i_seekpoint;        var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &v, NULL);        p_demux->info.i_update &= ~INPUT_UPDATE_SEEKPOINT;    }    p_demux->info.i_update &= ~INPUT_UPDATE_SIZE;    /* Hmmm only works with master input */    if( p_input->input.p_demux == p_demux )    {        int i_title_end = p_input->input.i_title_end -            p_input->input.i_title_offset;        int i_seekpoint_end = p_input->input.i_seekpoint_end -            p_input->input.i_seekpoint_offset;        if( i_title_end >= 0 && i_seekpoint_end >= 0 )        {            if( p_demux->info.i_title > i_title_end ||                ( p_demux->info.i_title == i_title_end &&                  p_demux->info.i_seekpoint > i_seekpoint_end ) ) return 0;        }        else if( i_seekpoint_end >=0 )        {            if( p_demux->info.i_seekpoint > i_seekpoint_end ) return 0;        }        else if( i_title_end >= 0 )        {            if( p_demux->info.i_title > i_title_end ) return 0;        }    }    return 1;}/***************************************************************************** * UpdateFromAccess: *****************************************************************************/static int UpdateFromAccess( input_thread_t *p_input ){    access_t *p_access = p_input->input.p_access;    vlc_value_t v;    if( p_access->info.i_update & INPUT_UPDATE_TITLE )    {        v.i_int = p_access->info.i_title;        var_Change( p_input, "title", VLC_VAR_SETVALUE, &v, NULL );        input_ControlVarTitle( p_input, p_access->info.i_title );        stream_AccessUpdate( p_input->input.p_stream );        p_access->info.i_update &= ~INPUT_UPDATE_TITLE;    }    if( p_access->info.i_update & INPUT_UPDATE_SEEKPOINT )    {        v.i_int = p_access->info.i_seekpoint;        var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &v, NULL);        p_access->info.i_update &= ~INPUT_UPDATE_SEEKPOINT;    }    if( p_access->info.i_update & INPUT_UPDATE_META )    {        /* TODO maybe multi - access ? */        vlc_meta_t *p_meta;        if( !access2_Control( p_input->input.p_access,ACCESS_GET_META,&p_meta))        {            if( p_input->p_meta )            {                vlc_meta_Merge( p_input->p_meta, p_meta );                vlc_meta_Delete( p_meta );            }            else            {                p_input->p_meta = p_meta;            }            UpdateMeta( p_input, VLC_FALSE );            var_SetBool( p_input, "item-change", p_input->input.p_item->i_id );        }        p_access->info.i_update &= ~INPUT_UPDATE_META;    }    p_access->info.i_update &= ~INPUT_UPDATE_SIZE;    /* Hmmm only works with master input */    if( p_input->input.p_access == p_access )    {        int i_title_end = p_input->input.i_title_end -            p_input->input.i_title_offset;        int i_seekpoint_end = p_input->input.i_seekpoint_end -            p_input->input.i_seekpoint_offset;        if( i_title_end >= 0 && i_seekpoint_end >=0 )        {            if( p_access->info.i_title > i_title_end ||                ( p_access->info.i_title == i_title_end &&                  p_access->info.i_seekpoint > i_seekpoint_end ) ) return 0;        }        else if( i_seekpoint_end >=0 )        {            if( p_access->info.i_seekpoint > i_seekpoint_end ) return 0;        }        else if( i_title_end >= 0 )        {            if( p_access->info.i_title > i_title_end ) return 0;        }    }    return 1;}/***************************************************************************** * UpdateMeta: *****************************************************************************/static int  UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick ){    vlc_meta_t *p_meta = p_input->p_meta;    int i;    if( !p_meta || p_meta->i_meta == 0 )        return VLC_SUCCESS;    if( !b_quick ) msg_Dbg( p_input, "meta information:" );    for( i = 0; i < p_meta->i_meta; i++ )    {        if( !b_quick )            msg_Dbg( p_input, "  - '%s' = '%s'",                     _(p_meta->name[i]), p_meta->value[i] );        if( !strcmp(p_meta->name[i], VLC_META_TITLE) && p_meta->value[i] &&            !p_input->input.p_item->b_fixed_name )            input_Control( p_input, INPUT_SET_NAME, p_meta->value[i] );        if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )            input_Control( p_input, INPUT_ADD_INFO, _("General"),                           _("Author"), p_meta->value[i] );        input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),                      _(p_meta->name[i]), "%s", p_meta->value[i] );    }    for( i = 0; i < p_meta->i_track; i++ )    {        vlc_meta_t *tk = p_meta->track[i];        int j;        if( tk->i_meta > 0 )        {            char *psz_cat = malloc( strlen(_("Stream")) + 10 );            msg_Dbg( p_input, "  - track[%d]:", i );            sprintf( psz_cat, "%s %d", _("Stream"), i );            for( j = 0; j < tk->i_meta; j++ )            {                msg_Dbg( p_input, "     - '%s' = '%s'", _(tk->name[j]),                         tk->value[j] );                input_Control( p_input, INPUT_ADD_INFO, psz_cat,                               _(tk->name[j]), "%s", tk->value[j] );            }        }    }    if( p_input->p_sout && p_input->p_sout->p_meta == NULL )    {        p_input->p_sout->p_meta = vlc_meta_Duplicate( p_meta );    }    return VLC_SUCCESS;}/***************************************************************************** * UpdateItemLength: *****************************************************************************/static void UpdateItemLength( input_thread_t *p_input, int64_t i_length,                              vlc_bool_t b_quick ){    playlist_t *p_playlist;    char psz_buffer[MSTRTIME_MAX_SIZE];    vlc_mutex_lock( &p_input->input.p_item->lock );    p_input->input.p_item->i_duration = i_length;    vlc_mutex_unlock( &p_input->input.p_item->lock );        p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,                                               FIND_PARENT);    if( p_playlist )    {        var_SetInteger( p_playlist, "item-change",                        p_input->input.p_item->i_id );        vlc_object_release( p_playlist );    }    input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"),                   msecstotimestr( psz_buffer, i_length / 1000 ) );}/***************************************************************************** * InputSourceNew: *****************************************************************************/static input_source_t *InputSourceNew( input_thread_t *p_input ){    input_source_t *in = malloc( sizeof( input_source_t ) );    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -