Exemplo n.º 1
0
/**************************************************************************
 * input_item_preparse_ended (Private) (vlc event Callback)
 **************************************************************************/
static void input_item_preparse_ended( const vlc_event_t * p_event,
                                       void * user_data )
{
    VLC_UNUSED( p_event );
    libvlc_media_t * p_md = user_data;
    libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );

    if( p_subitems != NULL )
    {
        /* notify the media list */
        libvlc_media_list_lock( p_subitems );
        libvlc_media_list_internal_end_reached( p_subitems );
        libvlc_media_list_unlock( p_subitems );
    }
}
Exemplo n.º 2
0
/**************************************************************************
 *       stop (Public)
 **************************************************************************/
LIBVLC_API void
libvlc_media_discoverer_stop( libvlc_media_discoverer_t * p_mdis )
{
    libvlc_media_list_t * p_mlist = p_mdis->p_mlist;
    libvlc_media_list_lock( p_mlist );
    libvlc_media_list_internal_end_reached( p_mlist );
    libvlc_media_list_unlock( p_mlist );

    libvlc_event_t event;
    event.type = libvlc_MediaDiscovererEnded;
    libvlc_event_send( &p_mdis->event_manager, &event );

    vlc_sd_Destroy( p_mdis->p_sd );
    p_mdis->p_sd = NULL;
}
Exemplo n.º 3
0
static void services_discovery_ended( const vlc_event_t * p_event,
                                      void * user_data )
{
    VLC_UNUSED(p_event);
    libvlc_media_discoverer_t * p_mdis = user_data;
    libvlc_media_list_t * p_mlist = p_mdis->p_mlist;
    libvlc_event_t event;

    p_mdis->running = false;

    libvlc_media_list_lock( p_mlist );
    libvlc_media_list_internal_end_reached( p_mlist );
    libvlc_media_list_unlock( p_mlist );

    event.type = libvlc_MediaDiscovererEnded;
    libvlc_event_send( p_mdis->p_event_manager, &event );
}
Exemplo n.º 4
0
static void send_parsed_changed( libvlc_media_t *p_md,
                                 libvlc_media_parsed_status_t new_status )
{
    libvlc_event_t event;

    vlc_mutex_lock( &p_md->parsed_lock );
    if( p_md->parsed_status == new_status )
    {
        vlc_mutex_unlock( &p_md->parsed_lock );
        return;
    }

    /* Legacy: notify libvlc_media_parse */
    if( !p_md->is_parsed )
    {
        p_md->is_parsed = true;
        vlc_cond_broadcast( &p_md->parsed_cond );
    }

    p_md->parsed_status = new_status;
    if( p_md->parsed_status == libvlc_media_parsed_status_skipped )
        p_md->has_asked_preparse = false;

    vlc_mutex_unlock( &p_md->parsed_lock );

    if( new_status == libvlc_media_parsed_status_done )
    {
        libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );
        if( p_subitems != NULL )
        {
            /* notify the media list */
            libvlc_media_list_lock( p_subitems );
            libvlc_media_list_internal_end_reached( p_subitems );
            libvlc_media_list_unlock( p_subitems );
        }
    }

    /* Construct the event */
    event.type = libvlc_MediaParsedChanged;
    event.u.media_parsed_changed.new_status = new_status;

    /* Send the event */
    libvlc_event_send( p_md->p_event_manager, &event );
}
Exemplo n.º 5
0
/**************************************************************************
 * input_item_preparse_ended (Private) (vlc event Callback)
 **************************************************************************/
static void input_item_preparse_ended( const vlc_event_t * p_event,
                                       void * user_data )
{
    VLC_UNUSED( p_event );
    libvlc_media_t * p_md = user_data;
    libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );
    libvlc_event_t event;

    event.type = libvlc_MediaParsedStatus;

    vlc_mutex_lock(&p_md->parsed_lock);
    switch (p_event->u.input_item_preparse_ended.new_status)
    {
        case ITEM_PREPARSE_SKIPPED:
            p_md->parsed_status = libvlc_media_parse_skipped;
            p_md->has_asked_preparse = false;
            break;
        case ITEM_PREPARSE_FAILED:
            p_md->parsed_status = libvlc_media_parse_failed;
            break;
        case ITEM_PREPARSE_DONE:
            p_md->parsed_status = libvlc_media_parse_done;
            break;
    }
    event.u.media_parsed_status.new_status = p_md->parsed_status;
    vlc_mutex_unlock(&p_md->parsed_lock);

    if( p_subitems != NULL )
    {
        /* notify the media list */
        libvlc_media_list_lock( p_subitems );
        libvlc_media_list_internal_end_reached( p_subitems );
        libvlc_media_list_unlock( p_subitems );
    }

    /* XXX: libVLC 2.2.0 compat: even if case of preparse failure,
     * libvlc_MediaParsedChanged was sent with a true status. Therefore, send
     * this event if it was not previously sent */
    send_preparsed_event(p_md);

    libvlc_event_send(p_md->p_event_manager, &event);
}