您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vlc_mutex_lock函数代码示例

51自学网 2021-06-03 09:44:36
  C++
这篇教程C++ vlc_mutex_lock函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vlc_mutex_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ vlc_mutex_lock函数的具体用法?C++ vlc_mutex_lock怎么用?C++ vlc_mutex_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vlc_mutex_lock函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SAP_Add

/** * Add a SAP announce */int SAP_Add (sap_handler_t *p_sap, session_descriptor_t *p_session){    int i;    char psz_addr[NI_MAXNUMERICHOST];    sap_session_t *p_sap_session;    mtime_t i_hash;    union    {        struct sockaddr     a;        struct sockaddr_in  in;        struct sockaddr_in6 in6;    } addr;    socklen_t addrlen;    addrlen = p_session->addrlen;    if ((addrlen == 0) || (addrlen > sizeof (addr)))    {        msg_Err( p_sap, "No/invalid address specified for SAP announce" );        return VLC_EGENERIC;    }    /* Determine SAP multicast address automatically */    memcpy (&addr, &p_session->addr, addrlen);    switch (addr.a.sa_family)    {#if defined (HAVE_INET_PTON) || defined (WIN32)        case AF_INET6:        {            /* See RFC3513 for list of valid IPv6 scopes */            struct in6_addr *a6 = &addr.in6.sin6_addr;            memcpy( a6->s6_addr + 2, "/x00/x00/x00/x00/x00/x00"                   "/x00/x00/x00/x00/x00/x02/x7f/xfe", 14 );            if( IN6_IS_ADDR_MULTICAST( a6 ) )                /* force flags to zero, preserve scope */                a6->s6_addr[1] &= 0xf;            else                /* Unicast IPv6 - assume global scope */                memcpy( a6->s6_addr, "/xff/x0e", 2 );            break;        }#endif        case AF_INET:        {            /* See RFC2365 for IPv4 scopes */            uint32_t ipv4 = addr.in.sin_addr.s_addr;            /* 224.0.0.0/24 => 224.0.0.255 */            if ((ipv4 & htonl (0xffffff00)) == htonl (0xe0000000))                ipv4 =  htonl (0xe00000ff);            else            /* 239.255.0.0/16 => 239.255.255.255 */            if ((ipv4 & htonl (0xffff0000)) == htonl (0xefff0000))                ipv4 =  htonl (0xefffffff);            else            /* 239.192.0.0/14 => 239.195.255.255 */            if ((ipv4 & htonl (0xfffc0000)) == htonl (0xefc00000))                ipv4 =  htonl (0xefc3ffff);            else            if ((ipv4 & htonl (0xff000000)) == htonl (0xef000000))                ipv4 = 0;            else            /* other addresses => 224.2.127.254 */                ipv4 = htonl (0xe0027ffe);            if( ipv4 == 0 )            {                msg_Err( p_sap, "Out-of-scope multicast address "                         "not supported by SAP" );                return VLC_EGENERIC;            }            addr.in.sin_addr.s_addr = ipv4;            break;        }        default:            msg_Err( p_sap, "Address family %d not supported by SAP",                     addr.a.sa_family );            return VLC_EGENERIC;    }    i = vlc_getnameinfo( &addr.a, addrlen,                         psz_addr, sizeof( psz_addr ), NULL, NI_NUMERICHOST );    if( i )    {        msg_Err( p_sap, "%s", gai_strerror( i ) );        return VLC_EGENERIC;    }    /* Find/create SAP address thread */    msg_Dbg( p_sap, "using SAP address: %s", psz_addr);    vlc_mutex_lock (&p_sap->lock);//.........这里部分代码省略.........
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:101,


示例2: DecSysHold

static void DecSysHold( decoder_sys_t *p_sys ){    vlc_mutex_lock( &p_sys->lock );    p_sys->i_refcount++;    vlc_mutex_unlock( &p_sys->lock );}
开发者ID:creationst,项目名称:Creation2,代码行数:6,


示例3: CommonManage

void CommonManage( vout_thread_t *p_vout ){    /* If we do not control our window, we check for geometry changes     * ourselves because the parent might not send us its events. */    vlc_mutex_lock( &p_vout->p_sys->lock );    if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )    {        RECT rect_parent;        POINT point;        vlc_mutex_unlock( &p_vout->p_sys->lock );        GetClientRect( p_vout->p_sys->hparent, &rect_parent );        point.x = point.y = 0;        ClientToScreen( p_vout->p_sys->hparent, &point );        OffsetRect( &rect_parent, point.x, point.y );        if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )        {            p_vout->p_sys->rect_parent = rect_parent;            /* FIXME I find such #ifdef quite weirds. Are they really needed ? */#if defined(MODULE_NAME_IS_direct3d)            SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,                          rect_parent.right - rect_parent.left,                          rect_parent.bottom - rect_parent.top,                          SWP_NOZORDER );            UpdateRects( p_vout, true );#else            /* This one is to force the update even if only             * the position has changed */            SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,                          rect_parent.right - rect_parent.left,                          rect_parent.bottom - rect_parent.top, 0 );            SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,                          rect_parent.right - rect_parent.left,                          rect_parent.bottom - rect_parent.top, 0 );#if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)            unsigned int i_x, i_y, i_width, i_height;            vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left,                               rect_parent.bottom - rect_parent.top,                               &i_x, &i_y, &i_width, &i_height );            SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,                          i_x, i_y, i_width, i_height, 0 );#endif#endif        }    }    else    {        vlc_mutex_unlock( &p_vout->p_sys->lock );    }    /* autoscale toggle */    if( p_vout->i_changes & VOUT_SCALE_CHANGE )    {        p_vout->i_changes &= ~VOUT_SCALE_CHANGE;        p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );        p_vout->i_zoom = (int) ZOOM_FP_FACTOR;        UpdateRects( p_vout, true );    }    /* scaling factor */    if( p_vout->i_changes & VOUT_ZOOM_CHANGE )    {        p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;        p_vout->b_autoscale = false;        p_vout->i_zoom =            (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );        UpdateRects( p_vout, true );    }    /* Check for cropping / aspect changes */    if( p_vout->i_changes & VOUT_CROP_CHANGE ||        p_vout->i_changes & VOUT_ASPECT_CHANGE )    {        p_vout->i_changes &= ~VOUT_CROP_CHANGE;        p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;        p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;        p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;        p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;        p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;        p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;        p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;        p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;        p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;        UpdateRects( p_vout, true );    }    /* We used to call the Win32 PeekMessage function here to read the window     * messages. But since window can stay blocked into this function for a     * long time (for example when you move your window on the screen), I//.........这里部分代码省略.........
开发者ID:FLYKingdom,项目名称:vlc,代码行数:101,


示例4: msg_Err

static picture_t *decode(decoder_t *dec, block_t **pblock){    decoder_sys_t *sys = dec->p_sys;    block_t *block;    MMAL_BUFFER_HEADER_T *buffer;    bool need_flush = false;    uint32_t len;    uint32_t flags = 0;    MMAL_STATUS_T status;    picture_t *ret = NULL;    /*     * Configure output port if necessary     */    if (sys->output_format) {        if (change_output_format(dec) < 0)            msg_Err(dec, "Failed to change output port format");    }    if (!pblock)        goto out;    block = *pblock;    /*     * Check whether full flush is required     */    if (block && block->i_flags & BLOCK_FLAG_DISCONTINUITY) {        flush_decoder(dec);        block_Release(*pblock);        return NULL;    }    /*     * Send output buffers     */    if (atomic_load(&sys->started)) {        buffer = mmal_queue_get(sys->decoded_pictures);        if (buffer) {            ret = (picture_t *)buffer->user_data;            ret->date = buffer->pts;            ret->b_progressive = sys->b_progressive;            ret->b_top_field_first = sys->b_top_field_first;            if (sys->output_pool) {                buffer->data = NULL;                mmal_buffer_header_reset(buffer);                mmal_buffer_header_release(buffer);            }        }        fill_output_port(dec);    }    if (ret)        goto out;    /*     * Process input     */    if (!block)        goto out;    *pblock = NULL;    if (block->i_flags & BLOCK_FLAG_CORRUPTED)        flags |= MMAL_BUFFER_HEADER_FLAG_CORRUPTED;    vlc_mutex_lock(&sys->mutex);    while (block->i_buffer > 0) {        buffer = mmal_queue_timedwait(sys->input_pool->queue, 2);        if (!buffer) {            msg_Err(dec, "Failed to retrieve buffer header for input data");            need_flush = true;            break;        }        mmal_buffer_header_reset(buffer);        buffer->cmd = 0;        buffer->pts = block->i_pts != 0 ? block->i_pts : block->i_dts;        buffer->dts = block->i_dts;        buffer->alloc_size = sys->input->buffer_size;        len = block->i_buffer;        if (len > buffer->alloc_size)            len = buffer->alloc_size;        buffer->data = block->p_buffer;        block->p_buffer += len;        block->i_buffer -= len;        buffer->length = len;        if (block->i_buffer == 0)            buffer->user_data = block;        buffer->flags = flags;        status = mmal_port_send_buffer(sys->input, buffer);        if (status != MMAL_SUCCESS) {            msg_Err(dec, "Failed to send buffer to input port (status=%"PRIx32" %s)",                    status, mmal_status_to_string(status));            break;        }//.........这里部分代码省略.........
开发者ID:J861449197,项目名称:vlc,代码行数:101,


示例5: libvlc_media_list_retain

/************************************************************************** *       libvlc_media_list_retain (Public) * * Increase an object refcount. **************************************************************************/void libvlc_media_list_retain( libvlc_media_list_t * p_mlist ){    vlc_mutex_lock( &p_mlist->refcount_lock );    p_mlist->i_refcount++;    vlc_mutex_unlock( &p_mlist->refcount_lock );}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:11,


示例6: Run

/***************************************************************************** * Run: xosd thread ***************************************************************************** * This part of the interface runs in a separate thread *****************************************************************************/static void Run( intf_thread_t *p_intf ){    playlist_t *p_playlist;    playlist_item_t *p_item = NULL;    char *psz_display = NULL;    int cancel = vlc_savecancel();    while( true )    {        // Wait for a signal        vlc_restorecancel( cancel );        vlc_mutex_lock( &p_intf->p_sys->lock );        mutex_cleanup_push( &p_intf->p_sys->lock );        while( !p_intf->p_sys->b_need_update )            vlc_cond_wait( &p_intf->p_sys->cond, &p_intf->p_sys->lock );        p_intf->p_sys->b_need_update = false;        vlc_cleanup_run();        // Compute the signal        cancel = vlc_savecancel();        p_playlist = pl_Get( p_intf );        PL_LOCK;        // If the playlist is empty don't do anything        if( playlist_IsEmpty( p_playlist ) )        {            PL_UNLOCK;            continue;        }        free( psz_display );        int i_status = playlist_Status( p_playlist );        if( i_status == PLAYLIST_STOPPED )        {            psz_display = strdup(_("Stop"));        }        else if( i_status == PLAYLIST_PAUSED )        {            psz_display = strdup(_("Pause"));        }        else        {            p_item = playlist_CurrentPlayingItem( p_playlist );            if( !p_item )            {                psz_display = NULL;                PL_UNLOCK;                continue;            }            input_item_t *p_input = p_item->p_input;            mtime_t i_duration = input_item_GetDuration( p_input );            if( i_duration != -1 )            {                char psz_durationstr[MSTRTIME_MAX_SIZE];                secstotimestr( psz_durationstr, i_duration / 1000000 );                if( asprintf( &psz_display, "%s (%s)", p_input->psz_name, psz_durationstr ) == -1 )                    psz_display = NULL;            }            else                psz_display = strdup( p_input->psz_name );        }        PL_UNLOCK;        /* Display */        xosd_display( p_intf->p_sys->p_osd, 0, /* first line */                      XOSD_string, psz_display );    }}
开发者ID:CSRedRat,项目名称:vlc,代码行数:74,


示例7: filter_NewPicture

/** * Video filter */static picture_t *FilterVideo( filter_t *p_filter, picture_t *p_src ){    filter_sys_t *p_sys = p_filter->p_sys;    logo_list_t *p_list = &p_sys->list;    picture_t *p_dst = filter_NewPicture( p_filter );    if( !p_dst )        goto exit;    picture_Copy( p_dst, p_src );    /* */    vlc_mutex_lock( &p_sys->lock );    logo_t *p_logo;    if( p_list->i_next_pic < p_src->date )        p_logo = LogoListNext( p_list, p_src->date );    else        p_logo = LogoListCurrent( p_list );    /* */    const picture_t *p_pic = p_logo->p_pic;    if( p_pic )    {        const video_format_t *p_fmt = &p_pic->format;        const int i_dst_w = p_filter->fmt_out.video.i_visible_width;        const int i_dst_h = p_filter->fmt_out.video.i_visible_height;        if( p_sys->i_pos )        {            if( p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM )            {                p_sys->i_pos_y = i_dst_h - p_fmt->i_visible_height;            }            else if ( !(p_sys->i_pos & SUBPICTURE_ALIGN_TOP) )            {                p_sys->i_pos_y = ( i_dst_h - p_fmt->i_visible_height ) / 2;            }            else            {                p_sys->i_pos_y = 0;            }            if( p_sys->i_pos & SUBPICTURE_ALIGN_RIGHT )            {                p_sys->i_pos_x = i_dst_w - p_fmt->i_visible_width;            }            else if ( !(p_sys->i_pos & SUBPICTURE_ALIGN_LEFT) )            {                p_sys->i_pos_x = ( i_dst_w - p_fmt->i_visible_width ) / 2;            }            else            {                p_sys->i_pos_x = 0;            }        }        /* */        const int i_alpha = p_logo->i_alpha != -1 ? p_logo->i_alpha : p_list->i_alpha;        if( filter_ConfigureBlend( p_sys->p_blend, i_dst_w, i_dst_h, p_fmt ) ||            filter_Blend( p_sys->p_blend, p_dst, p_sys->i_pos_x, p_sys->i_pos_y,                          p_pic, i_alpha ) )        {            msg_Err( p_filter, "failed to blend a picture" );        }    }    vlc_mutex_unlock( &p_sys->lock );exit:    picture_Release( p_src );    return p_dst;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:75,


示例8: CreateFilter

/***************************************************************************** * CreateFiler: allocate mosaic video filter *****************************************************************************/static int CreateFilter( vlc_object_t *p_this ){    filter_t *p_filter = (filter_t *)p_this;    filter_sys_t *p_sys;    vlc_object_t *p_libvlc = VLC_OBJECT( p_filter->p_libvlc );    char *psz_order, *_psz_order;    char *psz_offsets;    int i_index;    vlc_value_t val;    int i_command;    /* The mosaic thread is more important than the decoder threads */    vlc_thread_set_priority( p_this, VLC_THREAD_PRIORITY_OUTPUT );    /* Allocate structure */    p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );    if( p_sys == NULL )        return VLC_ENOMEM;    p_filter->pf_sub_filter = Filter;    vlc_mutex_init( &p_sys->lock );    vlc_mutex_lock( &p_sys->lock );    var_Create( p_libvlc, "mosaic-lock", VLC_VAR_MUTEX );    var_Get( p_libvlc, "mosaic-lock", &val );    p_sys->p_lock = val.p_address;    config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,                       p_filter->p_cfg );#define GET_VAR( name, min, max )                                           /    i_command = var_CreateGetIntegerCommand( p_filter, CFG_PREFIX #name );  /    p_sys->i_##name = __MIN( max, __MAX( min, i_command ) );                /    var_AddCallback( p_filter, CFG_PREFIX #name, MosaicCallback, p_sys );    GET_VAR( width, 0, INT_MAX );    GET_VAR( height, 0, INT_MAX );    GET_VAR( xoffset, 0, INT_MAX );    GET_VAR( yoffset, 0, INT_MAX );    GET_VAR( align, 0, 10 );    if( p_sys->i_align == 3 || p_sys->i_align == 7 )        p_sys->i_align = 5; /* FIXME: NOT THREAD SAFE w.r.t. callback */    GET_VAR( borderw, 0, INT_MAX );    GET_VAR( borderh, 0, INT_MAX );    GET_VAR( rows, 1, INT_MAX );    GET_VAR( cols, 1, INT_MAX );    GET_VAR( alpha, 0, 255 );    GET_VAR( position, 0, 2 );    GET_VAR( delay, 100, INT_MAX );#undef GET_VAR    p_sys->i_delay *= 1000; /* FIXME: NOT THREAD SAFE w.r.t. callback */    p_sys->b_ar = var_CreateGetBoolCommand( p_filter,                                            CFG_PREFIX "keep-aspect-ratio" );    var_AddCallback( p_filter, CFG_PREFIX "keep-aspect-ratio", MosaicCallback,                     p_sys );    p_sys->b_keep = var_CreateGetBoolCommand( p_filter,                                              CFG_PREFIX "keep-picture" );    if ( !p_sys->b_keep )    {        p_sys->p_image = image_HandlerCreate( p_filter );    }    p_sys->i_order_length = 0;    p_sys->ppsz_order = NULL;    psz_order = var_CreateGetStringCommand( p_filter, CFG_PREFIX "order" );    _psz_order = psz_order;    var_AddCallback( p_filter, CFG_PREFIX "order", MosaicCallback, p_sys );    if( *psz_order )    {        char *psz_end = NULL;        i_index = 0;        do        {            psz_end = strchr( psz_order, ',' );            i_index++;            p_sys->ppsz_order = realloc( p_sys->ppsz_order,                                         i_index * sizeof(char *) );            p_sys->ppsz_order[i_index - 1] = strndup( psz_order,                                           psz_end - psz_order );            psz_order = psz_end+1;        } while( psz_end );        p_sys->i_order_length = i_index;    }    free( _psz_order );    /* Manage specific offsets for substreams */    psz_offsets = var_CreateGetStringCommand( p_filter, CFG_PREFIX "offsets" );    p_sys->i_offsets_length = 0;    p_sys->pi_x_offsets = NULL;    p_sys->pi_y_offsets = NULL;//.........这里部分代码省略.........
开发者ID:Kafay,项目名称:vlc,代码行数:101,


示例9: input_item_SetURI

void input_item_SetURI( input_item_t *p_i, const char *psz_uri ){    assert( psz_uri );#ifndef NDEBUG    if( !strstr( psz_uri, "://" )     || strchr( psz_uri, ' ' ) || strchr( psz_uri, '"' ) )        fprintf( stderr, "Warning: %s(/"%s/"): file path instead of URL./n",                 __func__, psz_uri );#endif    vlc_mutex_lock( &p_i->lock );    free( p_i->psz_uri );    p_i->psz_uri = strdup( psz_uri );    p_i->i_type = GuessType( p_i );    if( p_i->psz_name )        ;    else    if( p_i->i_type == ITEM_TYPE_FILE || p_i->i_type == ITEM_TYPE_DIRECTORY )    {        const char *psz_filename = strrchr( p_i->psz_uri, '/' );        if( psz_filename && *psz_filename == '/' )            psz_filename++;        if( psz_filename && *psz_filename )            p_i->psz_name = strdup( psz_filename );        /* Make the name more readable */        if( p_i->psz_name )        {            decode_URI( p_i->psz_name );            EnsureUTF8( p_i->psz_name );        }    }    else    {   /* Strip login and password from title */        int r;        vlc_url_t url;        vlc_UrlParse( &url, psz_uri, 0 );        if( url.psz_protocol )        {            if( url.i_port > 0 )                r=asprintf( &p_i->psz_name, "%s://%s:%d%s", url.psz_protocol,                          url.psz_host, url.i_port,                          url.psz_path ? url.psz_path : "" );            else                r=asprintf( &p_i->psz_name, "%s://%s%s", url.psz_protocol,                          url.psz_host ? url.psz_host : "",                          url.psz_path ? url.psz_path : "" );        }        else        {            if( url.i_port > 0 )                r=asprintf( &p_i->psz_name, "%s:%d%s", url.psz_host, url.i_port,                          url.psz_path ? url.psz_path : "" );            else                r=asprintf( &p_i->psz_name, "%s%s", url.psz_host,                          url.psz_path ? url.psz_path : "" );        }        vlc_UrlClean( &url );        if( -1==r )            p_i->psz_name=NULL; /* recover from undefined value */    }    vlc_mutex_unlock( &p_i->lock );}
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:67,


示例10: input_item_SetEpg

void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_update ){    vlc_mutex_lock( &p_item->lock );    /* */    vlc_epg_t *p_epg = NULL;    for( int i = 0; i < p_item->i_epg; i++ )    {        vlc_epg_t *p_tmp = p_item->pp_epg[i];        if( (p_tmp->psz_name == NULL) != (p_update->psz_name == NULL) )            continue;        if( p_tmp->psz_name && p_update->psz_name && strcmp(p_tmp->psz_name, p_update->psz_name) )            continue;        p_epg = p_tmp;        break;    }    /* */    if( !p_epg )    {        p_epg = vlc_epg_New( p_update->psz_name );        if( p_epg )            TAB_APPEND( p_item->i_epg, p_item->pp_epg, p_epg );    }    if( p_epg )        vlc_epg_Merge( p_epg, p_update );    vlc_mutex_unlock( &p_item->lock );    if( !p_epg )        return;#ifdef EPG_DEBUG    char *psz_epg;    if( asprintf( &psz_epg, "EPG %s", p_epg->psz_name ? p_epg->psz_name : "unknown" ) < 0 )        goto signal;    input_item_DelInfo( p_item, psz_epg, NULL );    vlc_mutex_lock( &p_item->lock );    for( int i = 0; i < p_epg->i_event; i++ )    {        const vlc_epg_event_t *p_evt = p_epg->pp_event[i];        time_t t_start = (time_t)p_evt->i_start;        struct tm tm_start;        char psz_start[128];        localtime_r( &t_start, &tm_start );        snprintf( psz_start, sizeof(psz_start), "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",                  1900 + tm_start.tm_year, 1 + tm_start.tm_mon, tm_start.tm_mday,                  tm_start.tm_hour, tm_start.tm_min, tm_start.tm_sec );        if( p_evt->psz_short_description || p_evt->psz_description )            InputItemAddInfo( p_item, psz_epg, psz_start, "%s (%2.2d:%2.2d) - %s %s",                              p_evt->psz_name,                              p_evt->i_duration/60/60, (p_evt->i_duration/60)%60,                              p_evt->psz_short_description ? p_evt->psz_short_description : "" ,                              p_evt->psz_description ? p_evt->psz_description : "" );        else            InputItemAddInfo( p_item, psz_epg, psz_start, "%s (%2.2d:%2.2d)",                              p_evt->psz_name,                              p_evt->i_duration/60/60, (p_evt->i_duration/60)%60 );    }    vlc_mutex_unlock( &p_item->lock );    free( psz_epg );signal:#endif    if( p_epg->i_event > 0 )    {        vlc_event_t event = { .type = vlc_InputItemInfoChanged, };        vlc_event_send( &p_item->event_manager, &event );    }
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:75,


示例11: PORTAUDIOThread

/***************************************************************************** * PORTAUDIOThread: all interactions with libportaudio.a are handled * in this single thread.  Otherwise libportaudio.a is _not_ happy :-( *****************************************************************************/static void* PORTAUDIOThread( vlc_object_t *p_this ){    pa_thread_t *pa_thread = (pa_thread_t*)p_this;    aout_instance_t *p_aout;    aout_sys_t *p_sys;    int i_err;    int canc = vlc_savecancel ();    while( vlc_object_alive (pa_thread) )    {        /* Wait for start of stream */        vlc_mutex_lock( &pa_thread->lock_signal );        if( !pa_thread->b_signal )            vlc_cond_wait( &pa_thread->signal, &pa_thread->lock_signal );        vlc_mutex_unlock( &pa_thread->lock_signal );        pa_thread->b_signal = false;        p_aout = pa_thread->p_aout;        p_sys = p_aout->output.p_sys;        if( PAOpenDevice( p_aout ) != VLC_SUCCESS )        {            msg_Err( p_aout, "cannot open portaudio device" );            pa_thread->b_error = true;        }        if( !pa_thread->b_error && PAOpenStream( p_aout ) != VLC_SUCCESS )        {            msg_Err( p_aout, "cannot open portaudio device" );            pa_thread->b_error = true;            i_err = Pa_Terminate();            if( i_err != paNoError )            {                msg_Err( p_aout, "Pa_Terminate: %d (%s)", i_err,                         Pa_GetErrorText( i_err ) );            }        }        /* Tell the main thread that we are ready */        vlc_mutex_lock( &pa_thread->lock_wait );        pa_thread->b_wait = true;        vlc_cond_signal( &pa_thread->wait );        vlc_mutex_unlock( &pa_thread->lock_wait );        /* Wait for end of stream */        vlc_mutex_lock( &pa_thread->lock_signal );        if( !pa_thread->b_signal )            vlc_cond_wait( &pa_thread->signal, &pa_thread->lock_signal );        vlc_mutex_unlock( &pa_thread->lock_signal );        pa_thread->b_signal = false;        if( pa_thread->b_error ) continue;        i_err = Pa_StopStream( p_sys->p_stream );        if( i_err != paNoError )        {            msg_Err( p_aout, "Pa_StopStream: %d (%s)", i_err,                     Pa_GetErrorText( i_err ) );        }        i_err = Pa_CloseStream( p_sys->p_stream );        if( i_err != paNoError )        {            msg_Err( p_aout, "Pa_CloseStream: %d (%s)", i_err,                     Pa_GetErrorText( i_err ) );        }        i_err = Pa_Terminate();        if( i_err != paNoError )        {            msg_Err( p_aout, "Pa_Terminate: %d (%s)", i_err,                     Pa_GetErrorText( i_err ) );        }        /* Tell the main thread that we are ready */        vlc_mutex_lock( &pa_thread->lock_wait );        pa_thread->b_wait = true;        vlc_cond_signal( &pa_thread->wait );        vlc_mutex_unlock( &pa_thread->lock_wait );    }    vlc_restorecancel (canc);    return NULL;}
开发者ID:Kafay,项目名称:vlc,代码行数:86,


示例12: Open

/***************************************************************************** * Open: open the audio device *****************************************************************************/static int Open( vlc_object_t * p_this ){    aout_instance_t *p_aout = (aout_instance_t *)p_this;    struct aout_sys_t * p_sys;    int i_err;    msg_Dbg( p_aout, "entering Open()");    /* Allocate p_sys structure */    p_sys = malloc( sizeof(aout_sys_t) );    if( p_sys == NULL )        return VLC_ENOMEM;    p_sys->p_aout = p_aout;    p_sys->p_stream = 0;    p_aout->output.p_sys = p_sys;    p_aout->output.pf_play = Play;    /* Retrieve output device id from config */    p_sys->i_device_id = var_CreateGetInteger( p_aout, "portaudio-audio-device" );#ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN    if( !b_init )    {        /* Test device */        if( PAOpenDevice( p_aout ) != VLC_SUCCESS )        {            msg_Err( p_aout, "cannot open portaudio device" );            free( p_sys );            return VLC_EGENERIC;        }        /* Close device for now. We'll re-open it later on */        if( ( i_err = Pa_Terminate() ) != paNoError )        {            msg_Err( p_aout, "closing the device returned %d", i_err );        }        b_init = true;        /* Now we need to setup our DirectSound play notification structure */        pa_thread = vlc_object_create( p_aout, sizeof(pa_thread_t) );        pa_thread->p_aout = p_aout;        pa_thread->b_error = false;        vlc_mutex_init( &pa_thread->lock_wait );        vlc_cond_init( &pa_thread->wait );        pa_thread->b_wait = false;        vlc_mutex_init( &pa_thread->lock_signal );        vlc_cond_init( &pa_thread->signal );        pa_thread->b_signal = false;        /* Create PORTAUDIOThread */        if( vlc_thread_create( pa_thread, "aout", PORTAUDIOThread,                               VLC_THREAD_PRIORITY_OUTPUT ) )        {            msg_Err( p_aout, "cannot create PORTAUDIO thread" );            return VLC_EGENERIC;        }    }    else    {        pa_thread->p_aout = p_aout;        pa_thread->b_wait = false;        pa_thread->b_signal = false;        pa_thread->b_error = false;    }    /* Signal start of stream */    vlc_mutex_lock( &pa_thread->lock_signal );    pa_thread->b_signal = true;    vlc_cond_signal( &pa_thread->signal );    vlc_mutex_unlock( &pa_thread->lock_signal );    /* Wait until thread is ready */    vlc_mutex_lock( &pa_thread->lock_wait );    if( !pa_thread->b_wait )        vlc_cond_wait( &pa_thread->wait, &pa_thread->lock_wait );    vlc_mutex_unlock( &pa_thread->lock_wait );    pa_thread->b_wait = false;    if( pa_thread->b_error )    {        msg_Err( p_aout, "PORTAUDIO thread failed" );        Close( p_this );        return VLC_EGENERIC;    }    return VLC_SUCCESS;#else    if( PAOpenDevice( p_aout ) != VLC_SUCCESS )    {        msg_Err( p_aout, "cannot open portaudio device" );        free( p_sys );        return VLC_EGENERIC;    }//.........这里部分代码省略.........
开发者ID:Kafay,项目名称:vlc,代码行数:101,


示例13: DoFingerprint

static void DoFingerprint( vlc_object_t *p_this, fingerprinter_sys_t *p_sys, acoustid_fingerprint_t *fp ){    p_sys->p_input = NULL;    p_sys->p_item = NULL;    p_sys->chroma_fingerprint.psz_fingerprint = NULL;    vlc_cleanup_push( cancelDoFingerprint, p_sys );    p_sys->p_item = input_item_New( NULL, NULL );    if ( ! p_sys->p_item ) goto end;    char *psz_sout_option;    /* Note: need at -max- 2 channels, but we can't guess it before playing */    /* the stereo upmix could make the mono tracks fingerprint to differ :/ */    if ( asprintf( &psz_sout_option,                   "sout=#transcode{acodec=%s,channels=2}:chromaprint",                   ( VLC_CODEC_S16L == VLC_CODEC_S16N ) ? "s16l" : "s16b" )         == -1 ) goto end;    input_item_AddOption( p_sys->p_item, psz_sout_option, VLC_INPUT_OPTION_TRUSTED );    free( psz_sout_option );    input_item_AddOption( p_sys->p_item, "vout=dummy", VLC_INPUT_OPTION_TRUSTED );    input_item_AddOption( p_sys->p_item, "aout=dummy", VLC_INPUT_OPTION_TRUSTED );    if ( fp->i_duration )    {        if ( asprintf( &psz_sout_option, "stop-time=%u", fp->i_duration ) == -1 ) goto end;        input_item_AddOption( p_sys->p_item, psz_sout_option, VLC_INPUT_OPTION_TRUSTED );        free( psz_sout_option );    }    input_item_SetURI( p_sys->p_item, p_sys->psz_uri ) ;    p_sys->p_input = input_Create( p_this, p_sys->p_item, "fingerprinter", NULL );    if ( p_sys->p_input )    {        p_sys->chroma_fingerprint.i_duration = fp->i_duration;        var_Create( p_sys->p_input, "fingerprint-data", VLC_VAR_ADDRESS );        var_SetAddress( p_sys->p_input, "fingerprint-data", & p_sys->chroma_fingerprint );        input_Start( p_sys->p_input );        /* Wait for input to start && end */        p_sys->condwait.i_input_state = var_GetInteger( p_sys->p_input, "state" );        if ( likely( var_AddCallback( p_sys->p_input, "intf-event",                            inputStateCallback, p_sys ) == VLC_SUCCESS ) )        {            while( p_sys->condwait.i_input_state <= PAUSE_S )            {                vlc_mutex_lock( &p_sys->condwait.lock );                mutex_cleanup_push( &p_sys->condwait.lock );                vlc_cond_wait( &p_sys->condwait.wait, &p_sys->condwait.lock );                vlc_cleanup_run();            }            var_DelCallback( p_sys->p_input, "intf-event", inputStateCallback, p_sys );        }        input_Stop( p_sys->p_input, true );        input_Close( p_sys->p_input );        p_sys->p_input = NULL;        if ( p_sys->chroma_fingerprint.psz_fingerprint )        {            fp->psz_fingerprint = strdup( p_sys->chroma_fingerprint.psz_fingerprint );            if ( ! fp->i_duration ) /* had not given hint */                fp->i_duration = p_sys->chroma_fingerprint.i_duration;        }    }end:    vlc_cleanup_run( );}
开发者ID:Kubink,项目名称:vlc,代码行数:67,


示例14: InputCallback

/* Flls a callback_info_t data structure in response * to an "intf-event" input event. * * @warning This function executes in the input thread. * * @return VLC_SUCCESS on success, VLC_E* on error. */static int InputCallback( vlc_object_t *p_this, const char *psz_var,                          vlc_value_t oldval, vlc_value_t newval, void *data ){    input_thread_t *p_input = (input_thread_t *)p_this;    intf_thread_t *p_intf = data;    intf_sys_t *p_sys = p_intf->p_sys;    dbus_int32_t i_state = PLAYBACK_STATE_INVALID;    callback_info_t *p_info = calloc( 1, sizeof( callback_info_t ) );    if( unlikely(p_info == NULL) )        return VLC_ENOMEM;    switch( newval.i_int )    {        case INPUT_EVENT_DEAD:            i_state = PLAYBACK_STATE_STOPPED;            break;        case INPUT_EVENT_STATE:            switch( var_GetInteger( p_input, "state" ) )            {                case OPENING_S:                case PLAYING_S:                    i_state = PLAYBACK_STATE_PLAYING;                    break;                case PAUSE_S:                    i_state = PLAYBACK_STATE_PAUSED;                    break;                default:                    i_state = PLAYBACK_STATE_STOPPED;            }            break;        case INPUT_EVENT_ITEM_META:            p_info->signal = SIGNAL_INPUT_METADATA;            break;        case INPUT_EVENT_RATE:            p_info->signal = SIGNAL_RATE;            break;        case INPUT_EVENT_POSITION:        {            mtime_t i_now = mdate(), i_pos, i_projected_pos, i_interval;            float f_current_rate;            /* Detect seeks             * XXX: This is way more convoluted than it should be... */            i_pos = var_GetInteger( p_input, "time" );            if( !p_intf->p_sys->i_last_input_pos_event ||                !( var_GetInteger( p_input, "state" ) == PLAYING_S ) )            {                p_intf->p_sys->i_last_input_pos_event = i_now;                p_intf->p_sys->i_last_input_pos = i_pos;                break;            }            f_current_rate = var_GetFloat( p_input, "rate" );            i_interval = ( i_now - p_intf->p_sys->i_last_input_pos_event );            i_projected_pos = p_intf->p_sys->i_last_input_pos +                ( i_interval * f_current_rate );            p_intf->p_sys->i_last_input_pos_event = i_now;            p_intf->p_sys->i_last_input_pos = i_pos;            if( llabs( i_pos - i_projected_pos ) < SEEK_THRESHOLD )                break;            p_info->signal = SIGNAL_SEEK;            break;        }        default:            free( p_info );            return VLC_SUCCESS; /* don't care */    }    vlc_mutex_lock( &p_sys->lock );    if( i_state != PLAYBACK_STATE_INVALID &&        i_state != p_sys->i_playing_state )    {        p_sys->i_playing_state = i_state;        p_info->signal = SIGNAL_STATE;    }    if( p_info->signal )        vlc_array_append( p_intf->p_sys->p_events, p_info );    else        free( p_info );    vlc_mutex_unlock( &p_intf->p_sys->lock );    wakeup_main_loop( p_intf );    (void)psz_var;    (void)oldval;    return VLC_SUCCESS;//.........这里部分代码省略.........
开发者ID:etix,项目名称:vlc,代码行数:101,


示例15: filter_NewSubpicture

/***************************************************************************** * Filter *****************************************************************************/static subpicture_t *Filter( filter_t *p_filter, mtime_t date ){    filter_sys_t *p_sys = p_filter->p_sys;    bridge_t *p_bridge;    subpicture_t *p_spu;    int i_index, i_real_index, i_row, i_col;    int i_greatest_real_index_used = p_sys->i_order_length - 1;    unsigned int col_inner_width, row_inner_height;    subpicture_region_t *p_region;    subpicture_region_t *p_region_prev = NULL;    /* Allocate the subpicture internal data. */    p_spu = filter_NewSubpicture( p_filter );    if( !p_spu )        return NULL;    /* Initialize subpicture */    p_spu->i_channel = 0;    p_spu->i_start  = date;    p_spu->i_stop = 0;    p_spu->b_ephemer = true;    p_spu->i_alpha = p_sys->i_alpha;    p_spu->b_absolute = false;    vlc_mutex_lock( &p_sys->lock );    vlc_mutex_lock( p_sys->p_lock );    p_bridge = GetBridge( p_filter );    if ( p_bridge == NULL )    {        vlc_mutex_unlock( p_sys->p_lock );        vlc_mutex_unlock( &p_sys->lock );        return p_spu;    }    if ( p_sys->i_position == position_offsets )    {        /* If we have either too much or not enough offsets, fall-back         * to automatic positioning. */        if ( p_sys->i_offsets_length != p_sys->i_order_length )        {            msg_Err( p_filter,                     "Number of specified offsets (%d) does not match number "                     "of input substreams in mosaic-order (%d), falling back "                     "to mosaic-position=0",                     p_sys->i_offsets_length, p_sys->i_order_length );            p_sys->i_position = position_auto;        }    }    if ( p_sys->i_position == position_auto )    {        int i_numpics = p_sys->i_order_length; /* keep slots and all */        for ( i_index = 0; i_index < p_bridge->i_es_num; i_index++ )        {            bridged_es_t *p_es = p_bridge->pp_es[i_index];            if ( !p_es->b_empty )            {                i_numpics ++;                if( p_sys->i_order_length && p_es->psz_id != NULL )                {                    /* We also want to leave slots for images given in                     * mosaic-order that are not available in p_vout_picture */                    int i;                    for( i = 0; i < p_sys->i_order_length ; i++ )                    {                        if( !strcmp( p_sys->ppsz_order[i], p_es->psz_id ) )                        {                            i_numpics--;                            break;                        }                    }                }            }        }        p_sys->i_rows = ceil(sqrt( (double)i_numpics ));        p_sys->i_cols = ( i_numpics % p_sys->i_rows == 0 ?                            i_numpics / p_sys->i_rows :                            i_numpics / p_sys->i_rows + 1 );    }    col_inner_width  = ( ( p_sys->i_width - ( p_sys->i_cols - 1 )                       * p_sys->i_borderw ) / p_sys->i_cols );    row_inner_height = ( ( p_sys->i_height - ( p_sys->i_rows - 1 )                       * p_sys->i_borderh ) / p_sys->i_rows );    i_real_index = 0;    for ( i_index = 0; i_index < p_bridge->i_es_num; i_index++ )    {        bridged_es_t *p_es = p_bridge->pp_es[i_index];        video_format_t fmt_in, fmt_out;//.........这里部分代码省略.........
开发者ID:Kafay,项目名称:vlc,代码行数:101,


示例16: MosaicCallback

/****************************************************************************** Callback to update params on the fly*****************************************************************************/static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,                            vlc_value_t oldval, vlc_value_t newval,                            void *p_data ){    VLC_UNUSED(oldval);    filter_sys_t *p_sys = (filter_sys_t *) p_data;#define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a )    if( VAR_IS( "alpha" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing alpha from %d/255 to %d/255",                         p_sys->i_alpha, newval.i_int);        p_sys->i_alpha = __MIN( __MAX( newval.i_int, 0 ), 255 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "height" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing height from %dpx to %dpx",                          p_sys->i_height, newval.i_int );        p_sys->i_height = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "width" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing width from %dpx to %dpx",                         p_sys->i_width, newval.i_int );        p_sys->i_width = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "xoffset" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing x offset from %dpx to %dpx",                         p_sys->i_xoffset, newval.i_int );        p_sys->i_xoffset = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "yoffset" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing y offset from %dpx to %dpx",                         p_sys->i_yoffset, newval.i_int );        p_sys->i_yoffset = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "align" ) )    {        int i_old = 0, i_new = 0;        vlc_mutex_lock( &p_sys->lock );        newval.i_int = __MIN( __MAX( newval.i_int, 0 ), 10 );        if( newval.i_int == 3 || newval.i_int == 7 )            newval.i_int = 5;        while( pi_align_values[i_old] != p_sys->i_align ) i_old++;        while( pi_align_values[i_new] != newval.i_int ) i_new++;        msg_Dbg( p_this, "changing alignment from %d (%s) to %d (%s)",                     p_sys->i_align, ppsz_align_descriptions[i_old],                     newval.i_int, ppsz_align_descriptions[i_new] );        p_sys->i_align = newval.i_int;        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "borderw" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing border width from %dpx to %dpx",                         p_sys->i_borderw, newval.i_int );        p_sys->i_borderw = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "borderh" ) )    {        vlc_mutex_lock( &p_sys->lock );        msg_Dbg( p_this, "changing border height from %dpx to %dpx",                         p_sys->i_borderh, newval.i_int );        p_sys->i_borderh = __MAX( newval.i_int, 0 );        vlc_mutex_unlock( &p_sys->lock );    }    else if( VAR_IS( "position" ) )    {        if( newval.i_int > 2 || newval.i_int < 0 )        {            msg_Err( p_this,                     "Position is either 0 (%s), 1 (%s) or 2 (%s)",                     ppsz_pos_descriptions[0],                     ppsz_pos_descriptions[1],                     ppsz_pos_descriptions[2] );        }        else        {            vlc_mutex_lock( &p_sys->lock );            msg_Dbg( p_this, "changing position method from %d (%s) to %d (%s)",                    p_sys->i_position, ppsz_pos_descriptions[p_sys->i_position],                    newval.i_int, ppsz_pos_descriptions[newval.i_int]);            p_sys->i_position = newval.i_int;            vlc_mutex_unlock( &p_sys->lock );//.........这里部分代码省略.........
开发者ID:Kafay,项目名称:vlc,代码行数:101,


示例17: vlc_mutex_lock

/** * Sub source */static subpicture_t *FilterSub( filter_t *p_filter, mtime_t date ){    filter_sys_t *p_sys = p_filter->p_sys;    logo_list_t *p_list = &p_sys->list;    subpicture_t *p_spu;    subpicture_region_t *p_region;    video_format_t fmt;    picture_t *p_pic;    logo_t *p_logo;    vlc_mutex_lock( &p_sys->lock );    /* Basic test:  b_spu_update occurs on a dynamic change,                    & i_next_pic is the general timer, when to                    look at updating the logo image */    if( ( !p_sys->b_spu_update && p_list->i_next_pic > date ) ||        !p_list->i_repeat )    {        vlc_mutex_unlock( &p_sys->lock );        return NULL;    }    /* adjust index to the next logo */    p_logo = LogoListNext( p_list, date );    p_sys->b_spu_update = false;    p_pic = p_logo->p_pic;    /* Allocate the subpicture internal data. */    p_spu = filter_NewSubpicture( p_filter );    if( !p_spu )        goto exit;    p_spu->b_absolute = p_sys->b_absolute;    p_spu->i_start = date;    p_spu->i_stop = 0;    p_spu->b_ephemer = true;    /* Send an empty subpicture to clear the display when needed */    if( p_list->i_repeat != -1 && p_list->i_counter == 0 )    {        p_list->i_repeat--;        if( p_list->i_repeat < 0 )            goto exit;    }    if( !p_pic || !p_logo->i_alpha ||        ( p_logo->i_alpha == -1 && !p_list->i_alpha ) )        goto exit;    /* Create new SPU region */    memset( &fmt, 0, sizeof(video_format_t) );    fmt.i_chroma = VLC_CODEC_YUVA;    fmt.i_sar_num = fmt.i_sar_den = 1;    fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;    fmt.i_height = fmt.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;    fmt.i_x_offset = fmt.i_y_offset = 0;    p_region = subpicture_region_New( &fmt );    if( !p_region )    {        msg_Err( p_filter, "cannot allocate SPU region" );        p_filter->pf_sub_buffer_del( p_filter, p_spu );        p_spu = NULL;        goto exit;    }    /* */    picture_Copy( p_region->p_picture, p_pic );    /*  where to locate the logo: */    if( p_sys->i_pos < 0 )    {   /*  set to an absolute xy */        p_region->i_align = SUBPICTURE_ALIGN_RIGHT | SUBPICTURE_ALIGN_TOP;        p_spu->b_absolute = true;    }    else    {   /* set to one of the 9 relative locations */        p_region->i_align = p_sys->i_pos;        p_spu->b_absolute = false;    }    p_region->i_x = p_sys->i_pos_x;    p_region->i_y = p_sys->i_pos_y;    p_spu->p_region = p_region;    p_spu->i_alpha = ( p_logo->i_alpha != -1 ?                       p_logo->i_alpha : p_list->i_alpha );exit:    vlc_mutex_unlock( &p_sys->lock );    return p_spu;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:97,


示例18: RunIntf

/***************************************************************************** * RunIntf: main loop *****************************************************************************/static void RunIntf( intf_thread_t *p_intf ){    p_intf->p_sys->p_vout = NULL;    if( InitThread( p_intf ) < 0 )    {        msg_Err( p_intf, "cannot initialize intf" );        return;    }    /* Main loop */    while( !p_intf->b_die )    {        vlc_mutex_lock( &p_intf->change_lock );        /* Notify the interfaces */        if( p_intf->p_sys->b_triggered )        {            playlist_t *p_playlist =                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                               FIND_ANYWHERE );            if( p_playlist != NULL )            {                vlc_value_t val;                val.b_bool = VLC_TRUE;                var_Set( p_playlist, "intf-show", val );                vlc_object_release( p_playlist );            }            p_intf->p_sys->b_triggered = VLC_FALSE;        }        vlc_mutex_unlock( &p_intf->change_lock );        /* Take care of the video output */        if( p_intf->p_sys->p_vout && p_intf->p_sys->p_vout->b_die )        {            var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved",                             MouseEvent, p_intf );            var_DelCallback( p_intf->p_sys->p_vout, "mouse-button-down",                             MouseEvent, p_intf );            vlc_object_release( p_intf->p_sys->p_vout );            p_intf->p_sys->p_vout = NULL;        }        if( p_intf->p_sys->p_vout == NULL )        {            p_intf->p_sys->p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,                                                     FIND_ANYWHERE );            if( p_intf->p_sys->p_vout )            {                var_AddCallback( p_intf->p_sys->p_vout, "mouse-moved",                                 MouseEvent, p_intf );                var_AddCallback( p_intf->p_sys->p_vout, "mouse-button-down",                                 MouseEvent, p_intf );            }        }        /* Wait a bit */        msleep( INTF_IDLE_SLEEP );    }    if( p_intf->p_sys->p_vout )    {        var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved",                         MouseEvent, p_intf );        var_DelCallback( p_intf->p_sys->p_vout, "mouse-button-down",                         MouseEvent, p_intf );        vlc_object_release( p_intf->p_sys->p_vout );    }}
开发者ID:forthyen,项目名称:SDesk,代码行数:75,


示例19: vlc_mutex_lock

/** * Sub source */static subpicture_t *FilterSub(filter_t *p_filter, mtime_t date){    filter_sys_t *p_sys = p_filter->p_sys;    BarGraph_t *p_BarGraph = &(p_sys->p_BarGraph);    subpicture_t *p_spu;    subpicture_region_t *p_region;    video_format_t fmt;    picture_t *p_pic;    vlc_mutex_lock(&p_sys->lock);    /* Basic test:  b_spu_update occurs on a dynamic change */    if (!p_sys->b_spu_update) {        vlc_mutex_unlock(&p_sys->lock);        return NULL;    }    p_pic = p_BarGraph->p_pic;    /* Allocate the subpicture internal data. */    p_spu = filter_NewSubpicture(p_filter);    if (!p_spu)        goto exit;    p_spu->b_absolute = p_sys->b_absolute;    p_spu->i_start = date;    p_spu->i_stop = 0;    p_spu->b_ephemer = true;    /* Send an empty subpicture to clear the display when needed */    if (!p_pic || !p_BarGraph->i_alpha)        goto exit;    /* Create new SPU region */    memset(&fmt, 0, sizeof(video_format_t));    fmt.i_chroma = VLC_CODEC_YUVA;    fmt.i_sar_num = fmt.i_sar_den = 1;    fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;    fmt.i_height = fmt.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;    fmt.i_x_offset = fmt.i_y_offset = 0;    p_region = subpicture_region_New(&fmt);    if (!p_region) {        msg_Err(p_filter, "cannot allocate SPU region");        subpicture_Delete(p_spu);        p_spu = NULL;        goto exit;    }    /* */    picture_Copy(p_region->p_picture, p_pic);    /*  where to locate the bar graph: */    if (p_sys->i_pos < 0) {   /*  set to an absolute xy */        p_region->i_align = SUBPICTURE_ALIGN_RIGHT | SUBPICTURE_ALIGN_TOP;        p_spu->b_absolute = true;    } else {   /* set to one of the 9 relative locations */        p_region->i_align = p_sys->i_pos;        p_spu->b_absolute = false;    }    p_region->i_x = p_sys->i_pos_x;    p_region->i_y = p_sys->i_pos_y;    p_spu->p_region = p_region;    p_spu->i_alpha = p_BarGraph->i_alpha ;exit:    vlc_mutex_unlock(&p_sys->lock);    return p_spu;}
开发者ID:0xheart0,项目名称:vlc,代码行数:75,


示例20: filter_NewPicture

/** * Filter a picture */picture_t *Filter( filter_t *p_filter, picture_t *p_pic_in ) {    if( !p_pic_in || !p_filter) return NULL;    const video_format_t  *p_fmt_in = &p_filter->fmt_in.video;    filter_sys_t *p_sys = p_filter->p_sys;    picture_t *p_pic_out = filter_NewPicture( p_filter );    if( !p_pic_out ) {        picture_Release( p_pic_in );        return NULL;    }    int i_ret = 0;    p_sys->b_bake_request = false;    if ((p_sys->pi_order == NULL) || (p_sys->ps_desk_planes == NULL) || (p_sys->ps_pict_planes == NULL)  || (p_sys->ps_puzzle_array == NULL) || (p_sys->ps_pieces == NULL))        p_sys->b_init = false;    if ((p_sys->ps_pieces_shapes == NULL) && p_sys->s_current_param.b_advanced && (p_sys->s_current_param.i_shape_size != 0))        p_sys->b_init = false;    /* assert initialized & allocated data match with current frame characteristics */    if ( p_sys->s_allocated.i_planes != p_pic_out->i_planes)        p_sys->b_init = false;    p_sys->s_current_param.i_planes = p_pic_out->i_planes;    if (p_sys->ps_pict_planes != NULL) {        for (uint8_t i_plane = 0; i_plane < p_sys->s_allocated.i_planes; i_plane++) {            if ( (p_sys->ps_pict_planes[i_plane].i_lines != p_pic_in->p[i_plane].i_visible_lines)                    || (p_sys->ps_pict_planes[i_plane].i_width != p_pic_in->p[i_plane].i_visible_pitch / p_pic_in->p[i_plane].i_pixel_pitch)                    || (p_sys->ps_desk_planes[i_plane].i_lines != p_pic_out->p[i_plane].i_visible_lines)                    || (p_sys->ps_desk_planes[i_plane].i_width != p_pic_out->p[i_plane].i_visible_pitch / p_pic_out->p[i_plane].i_pixel_pitch) )                p_sys->b_init = false;        }    }    p_sys->s_current_param.i_pict_width  = (int) p_pic_in->p[0].i_visible_pitch / p_pic_in->p[0].i_pixel_pitch;    p_sys->s_current_param.i_pict_height = (int) p_pic_in->p[0].i_visible_lines;    p_sys->s_current_param.i_desk_width  = (int) p_pic_out->p[0].i_visible_pitch / p_pic_out->p[0].i_pixel_pitch;    p_sys->s_current_param.i_desk_height = (int) p_pic_out->p[0].i_visible_lines;    /* assert no mismatch between sizes */    if (    p_sys->s_current_param.i_pict_width  != p_sys->s_current_param.i_desk_width         || p_sys->s_current_param.i_pict_height != p_sys->s_current_param.i_desk_height         || p_sys->s_current_param.i_pict_width  != (int) p_fmt_in->i_visible_width         || p_sys->s_current_param.i_pict_height != (int) p_fmt_in->i_visible_height ) {        picture_Release(p_pic_in);        picture_Release(p_pic_out);        return NULL;    }    vlc_mutex_lock( &p_sys->lock );    /* check if we have to compute initial data */    if ( p_sys->b_change_param || p_sys->b_bake_request || !p_sys->b_init ) {        if ( p_sys->s_allocated.i_rows != p_sys->s_new_param.i_rows                || p_sys->s_allocated.i_cols != p_sys->s_new_param.i_cols                || p_sys->s_allocated.i_rotate != p_sys->s_new_param.i_rotate                || p_sys->s_allocated.i_mode != p_sys->s_new_param.i_mode                || p_sys->b_bake_request  || !p_sys->b_init )        {            p_sys->b_bake_request = true;            p_sys->b_init = false;            p_sys->b_shuffle_rqst = true;            p_sys->b_shape_init = false;        }        if ( p_sys->s_current_param.i_border != p_sys->s_new_param.i_border                || p_sys->s_current_param.i_shape_size != p_sys->s_new_param.i_shape_size )        {            p_sys->b_bake_request = true;            p_sys->b_shape_init = false;        }        /* depending on the game selected, set associated internal flags */        switch ( p_sys->s_new_param.i_mode )        {          case 0:  /* jigsaw puzzle */            p_sys->s_new_param.b_advanced    = true;            p_sys->s_new_param.b_blackslot   = false;            p_sys->s_new_param.b_near        = false;            break;          case 1:  /* sliding puzzle */            p_sys->s_new_param.b_advanced    = false;            p_sys->s_new_param.b_blackslot   = true;            p_sys->s_new_param.b_near        = true;            break;          case 2:  /* swap puzzle */            p_sys->s_new_param.b_advanced    = false;            p_sys->s_new_param.b_blackslot   = false;            p_sys->s_new_param.b_near        = true;            break;          case 3:  /* exchange puzzle */            p_sys->s_new_param.b_advanced    = false;            p_sys->s_new_param.b_blackslot   = false;            p_sys->s_new_param.b_near        = false;            break;        }//.........这里部分代码省略.........
开发者ID:etix,项目名称:vlc,代码行数:101,


示例21: puzzle_mouse

//.........这里部分代码省略.........                            p_sys->ps_pieces[i].i_actual_mirror = +1;                            p_sys->ps_pieces[i].b_overlap      = false;                            p_sys->ps_pieces[i].b_finished     = false;                            p_sys->ps_pieces[i].i_group_ID     = i;                            for (uint8_t i_plane = 0; i_plane < p_sys->s_allocated.i_planes; i_plane++) {                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_width     = p_sys->ps_puzzle_array[row][col][i_plane].i_width;                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_lines     = p_sys->ps_puzzle_array[row][col][i_plane].i_lines;                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_original_x = p_sys->ps_puzzle_array[orow][ocol][i_plane].i_x;                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_original_y = p_sys->ps_puzzle_array[orow][ocol][i_plane].i_y;                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_actual_x   = p_sys->ps_puzzle_array[row][col][i_plane].i_x;                                p_sys->ps_pieces[i].ps_piece_in_plane[i_plane].i_actual_y   = p_sys->ps_puzzle_array[row][col][i_plane].i_y;                            }                            i++;                        }                    }                }                p_sys->i_selected = p_sys->s_current_param.b_blackslot ? i_pos : NO_PCE;                p_sys->b_finished = puzzle_is_finished( p_sys, p_sys->pi_order );            }        }    }    else /* jigsaw puzzle mode */    {        if ((p_sys->ps_desk_planes == NULL)  || (p_sys->ps_pict_planes == NULL)  || (p_sys->ps_puzzle_array == NULL) || (p_sys->ps_pieces == NULL)) {            *p_mouse = *p_new;            return VLC_SUCCESS;        }        if( vlc_mouse_HasPressed( p_old, p_new, MOUSE_BUTTON_LEFT ) )        {            vlc_mutex_lock( &p_sys->pce_lock );            if (p_sys->i_mouse_drag_pce != NO_PCE) {                int i_ret = puzzle_piece_foreground( p_filter, p_sys->i_mouse_drag_pce);                if (i_ret != VLC_SUCCESS)                {                    vlc_mutex_unlock( &p_sys->pce_lock );                    return i_ret;                }                p_sys->i_mouse_drag_pce = 0;                uint32_t i_group_ID = p_sys->ps_pieces[0].i_group_ID;                for (uint32_t i = 0; i < p_sys->s_allocated.i_pieces_nbr; i++) {                    if ( i_group_ID == p_sys->ps_pieces[i].i_group_ID ) {                        p_sys->ps_pieces[i].b_finished = false;                    }                    else {                        break;                    }                }                p_sys->b_mouse_drag = true;                p_sys->b_mouse_mvt = false;            }            else {            /* player click an empty area then search a piece which is overlapping another one and place it here */                p_sys->b_mouse_drag = false;                for (uint32_t i = 0; i < p_sys->s_allocated.i_pieces_nbr; i++)                    if ( p_sys->ps_pieces[i].b_overlap ) {                        puzzle_move_group( p_filter, i, p_new->i_x - p_sys->ps_pieces[i].i_center_x,  p_new->i_y - p_sys->ps_pieces[i].i_center_y );                        p_sys->ps_pieces[i].b_overlap = false;                        break;                    }
开发者ID:etix,项目名称:vlc,代码行数:67,


示例22: libvlc_media_list_lock

/************************************************************************** *       libvlc_media_list_lock (Public) * * The lock must be held in access operations. It is never used in the * Public method. **************************************************************************/void libvlc_media_list_lock( libvlc_media_list_t * p_mlist ){    vlc_mutex_lock( &p_mlist->object_lock );}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:10,


示例23: GetInputMeta

int GetInputMeta( playlist_item_t *item, DBusMessageIter *args ){    input_item_t *p_input = item->p_input;    DBusMessageIter dict, dict_entry, variant, list;    /** The duration of the track can be expressed in second, milli-seconds and        
C++ vlc_object_create函数代码示例
C++ vlc_mutex_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。