Ejemplo n.º 1
0
static vlm_media_instance_t *libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
                                                            char *psz_name, int i_minstance_idx,
                                                            libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
    vlm_t *p_vlm;
    vlm_media_instance_t **pp_minstance;
    vlm_media_instance_t *p_minstance;
    int i_minstance;
    int64_t id;

    VLM_RET(p_vlm, NULL);

    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
        vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, &i_minstance ) )
    {
        libvlc_exception_raise( p_exception, "Unable to get %s instances", psz_name );
        return NULL;
    }
    p_minstance = NULL;
    if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
    {
        p_minstance = pp_minstance[i_minstance_idx];
        TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
    }
    while( i_minstance > 0 )
        vlm_media_instance_Delete( pp_minstance[--i_minstance] );
    TAB_CLEAN( i_minstance, pp_minstance );
    return p_minstance;
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 2
0
/*****************************************************************************
 * libvlc_audio_set_track : Set the current audio track
 *****************************************************************************/
void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track,
                             libvlc_exception_t *p_e )
{
    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
    vlc_value_t val_list;
    vlc_value_t newval;
    int i_ret = -1;

    if( !p_input_thread )
        return;

    var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
    if( (i_track < 0) || (i_track > val_list.p_list->i_count) )
    {
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Audio track out of range" );
        goto end;
    }

    newval = val_list.p_list->p_values[i_track];
    i_ret = var_Set( p_input_thread, "audio-es", newval );
    if( i_ret < 0 )
    {
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Audio track out of range" ); /* Race... */
    }

end:
    var_FreeList( &val_list, NULL );
    vlc_object_release( p_input_thread );
}
Ejemplo n.º 3
0
char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, char *psz_name,
                             libvlc_exception_t *p_exception )
{
    char *psz_message;
    vlm_message_t *answer;
    char *psz_response;

    CHECK_VLM;
#ifdef ENABLE_VLM
    asprintf( &psz_message, "show %s", psz_name );
    asprintf( &psz_response, "", psz_name );
    vlm_ExecuteCommand( p_instance->p_vlm, psz_message, &answer );
    if( answer->psz_value )
    {
        libvlc_exception_raise( p_exception, "Unable to call show %s: %s",
                                psz_name, answer->psz_value );
    }
    else
    {
        if ( answer->child )
        {
            psz_response = recurse_answer( "", answer );
        }
    }
    free( psz_message );
    return(psz_response );
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return NULL;
#endif
}
Ejemplo n.º 4
0
void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
                             libvlc_exception_t *p_e )
{
    input_thread_t *p_input_thread;
    vlc_object_t *p_vbi;
    int i_ret;

    p_input_thread = libvlc_get_input_thread(p_mi, p_e);
    if( !p_input_thread ) return;

    p_vbi = (vlc_object_t *) vlc_object_find_name( p_input_thread, "zvbi",
                                                   FIND_ANYWHERE );
    if( p_vbi )
    {
        const int i_teletext_es = var_GetInteger( p_input_thread, "teletext-es" );
        const int i_spu_es = var_GetInteger( p_input_thread, "spu-es" );

        if( (i_teletext_es >= 0) && (i_teletext_es == i_spu_es) )
        {
            int i_page = 100;

            i_page = var_GetInteger( p_vbi, "vbi-page" );
            i_page = (i_teletext_es >= 0) ? i_page : 0;

            i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
            if( i_ret )
                libvlc_exception_raise( p_e,
                                "Unexpected error while setting teletext page" );
        }
        else if( i_teletext_es >= 0 )
        {
            bool opaque = true;

            opaque = var_GetBool( p_vbi, "vbi-opaque" );
            i_ret = var_SetBool( p_vbi, "vbi-opaque", !opaque );
            if( i_ret )
                libvlc_exception_raise( p_e,
                                "Unexpected error while setting teletext transparency" );
        }
        vlc_object_release( p_vbi );
    }
    else
    {
        /* Teletext is not enabled yet, so enable it.
         * Only after it is enable it is possible to view teletext pages
         */
        const int i_teletext_es = var_GetInteger( p_input_thread, "teletext-es" );

        if( i_teletext_es >= 0 )
        {
            const int i_spu_es = var_GetInteger( p_input_thread, "spu-es" );

            if( i_teletext_es == i_spu_es )
                var_SetInteger( p_input_thread, "spu-es", -1 );
            else
                var_SetInteger( p_input_thread, "spu-es", i_teletext_es );
        }
    }
    vlc_object_release( p_input_thread );
}
Ejemplo n.º 5
0
void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
                           libvlc_exception_t *p_e )
{
    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
    vlc_value_t val_list;
    vlc_value_t newval;
    int i_ret = -1;

    if( !p_input_thread ) return;

    var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
    if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
    {
        libvlc_exception_raise( p_e, "Subtitle value out of range" );
        vlc_object_release( p_input_thread );
        return;
    }

    newval = val_list.p_list->p_values[i_spu];
    i_ret = var_Set( p_input_thread, "spu-es", newval );
    if( i_ret < 0 )
    {
        libvlc_exception_raise( p_e, "Setting subtitle value failed" );
    }
    vlc_object_release( p_input_thread );
}
Ejemplo n.º 6
0
void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, char *psz_name,
                         char *psz_input, int i_options,
                         char **ppsz_options, int b_enabled,
                         char *psz_mux, libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
    vlm_t *p_vlm;
    vlm_media_t m;
    int n;

    VLM(p_vlm);

    vlm_media_Init( &m );
    m.psz_name = strdup( psz_name );
    m.b_enabled = b_enabled;
    m.b_vod = true;
    m.vod.psz_mux = psz_mux ? strdup( psz_mux ) : NULL;
    if( psz_input )
        TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) );
    for( n = 0; n < i_options; n++ )
        TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) );

    n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL );
    vlm_media_Clean( &m );
    if( n )
        libvlc_exception_raise( p_exception, "Media %s creation failed", psz_name );
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 7
0
void
libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, char *psz_filepath,
        unsigned int i_width, unsigned int i_height, libvlc_exception_t *p_e )
{
    vout_thread_t *p_vout = GetVout( p_mi, p_e );
    input_thread_t *p_input_thread;

    /* GetVout will raise the exception for us */
    if( !p_vout ) return;

    if( !psz_filepath )
    {
        libvlc_exception_raise( p_e, "filepath is null" );
        return;
    }

    var_SetInteger( p_vout, "snapshot-width", i_width );
    var_SetInteger( p_vout, "snapshot-height", i_height );

    p_input_thread = p_mi->p_input_thread;
    if( !p_mi->p_input_thread )
    {
        libvlc_exception_raise( p_e, "Input does not exist" );
        return;
    }

    var_SetString( p_vout, "snapshot-path", psz_filepath );
    var_SetString( p_vout, "snapshot-format", "png" );

    vout_Control( p_vout, VOUT_SNAPSHOT );
    vlc_object_release( p_vout );
}
Ejemplo n.º 8
0
Archivo: vlm.c Proyecto: FLYKingdom/vlc
const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
                                   const char *psz_name,
                                   libvlc_exception_t *p_exception )
{
    char *psz_message = NULL;
    vlm_message_t *answer = NULL;
    char *psz_response = NULL;
    const char *psz_fmt = NULL;
    const char *psz_delimiter = NULL;
    int i_list;
    vlm_t *p_vlm = NULL;

    VLM_RET(p_vlm, NULL);

    assert( psz_name );

    if( asprintf( &psz_message, "show %s", psz_name ) == -1 )
    {
        libvlc_exception_raise( p_exception );
        libvlc_printerr( "Not enough memory" );
        return NULL;
    }

    vlm_ExecuteCommand( p_vlm, psz_message, &answer );
    if( answer->psz_value )
    {
        libvlc_exception_raise( p_exception );
        libvlc_printerr( "Unable to call show %s: %s",
                         psz_name, answer->psz_value );
    }
    else if ( answer->child )
    {   /* in case everything was requested  */
        if ( strcmp( psz_name, "" ) == 0 )
        {
            psz_fmt = "{\n\t%s\n}\n";
            psz_delimiter = "\n\t";
            i_list = 0;
        }
        else
        {
            psz_fmt = "%s\n";
            psz_delimiter = "\n";
            i_list = 1;
        }
        if( asprintf( &psz_response, psz_fmt,
                      recurse_answer( answer, psz_delimiter, i_list ) ) == -1 )
        {
            libvlc_exception_raise( p_exception );
            libvlc_printerr( "Out of memory" );
        }
    }
    free( psz_message );
    return( psz_response );
}
Ejemplo n.º 9
0
/*****************************************************************************
 * libvlc_audio_get_track : Get the current audio track
 *****************************************************************************/
int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
                            libvlc_exception_t *p_e )
{
    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
    vlc_value_t val_list;
    vlc_value_t val;
    int i_track = -1;
    int i_ret = -1;
    int i;

    if( !p_input_thread )
        return -1;

    i_ret = var_Get( p_input_thread, "audio-es", &val );
    if( i_ret < 0 )
    {
        vlc_object_release( p_input_thread );
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Audio track information not found" );
        return i_ret;
    }

    var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
    for( i = 0; i < val_list.p_list->i_count; i++ )
    {
        if( val_list.p_list->p_values[i].i_int == val.i_int )
        {
            i_track = i;
            break;
        }
    }
    var_FreeList( &val_list, NULL );
    vlc_object_release( p_input_thread );
    return i_track;
}
Ejemplo n.º 10
0
void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name,
                              char *psz_input, char *psz_output, int i_options,
                              char **ppsz_options, int b_enabled, int b_loop,
                              libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
#define VLM_CHANGE_CODE { int n;        \
    p_media->b_enabled = b_enabled;     \
    p_media->broadcast.b_loop = b_loop; \
    while( p_media->i_input > 0 )       \
        free( p_media->ppsz_input[--p_media->i_input] );    \
    if( psz_input )                     \
        TAB_APPEND( p_media->i_input, p_media->ppsz_input, strdup(psz_input) ); \
    free( p_media->psz_output );        \
    p_media->psz_output = psz_output ? strdup( psz_output ) : NULL; \
    while( p_media->i_option > 0 )     \
        free( p_media->ppsz_option[--p_media->i_option] );        \
    for( n = 0; n < i_options; n++ )    \
        TAB_APPEND( p_media->i_option, p_media->ppsz_option, strdup(ppsz_options[n]) );   \
  }
    VLM_CHANGE( "Unable to change %s properties", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 11
0
Archivo: vlm.c Proyecto: FLYKingdom/vlc
static vlm_media_instance_t *
libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
                               const char *psz_name, int i_minstance_idx,
                               libvlc_exception_t *p_exception )
{
    vlm_t *p_vlm;
    vlm_media_instance_t **pp_minstance;
    vlm_media_instance_t *p_minstance;
    int i_minstance;
    int64_t id;

    VLM_RET(p_vlm, NULL);

    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
        vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance,
                     &i_minstance ) )
    {
        libvlc_exception_raise( p_exception );
        libvlc_printerr( "%s: media instances not found", psz_name );
        return NULL;
    }
    p_minstance = NULL;
    if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
    {
        p_minstance = pp_minstance[i_minstance_idx];
        TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
    }
    while( i_minstance > 0 )
        vlm_media_instance_Delete( pp_minstance[--i_minstance] );
    TAB_CLEAN( i_minstance, pp_minstance );
    return p_minstance;
}
Ejemplo n.º 12
0
Archivo: vlm.c Proyecto: FLYKingdom/vlc
static int libvlc_vlm_init( libvlc_instance_t *p_instance,
                            libvlc_exception_t *p_exception )
{
    if( !p_instance->libvlc_vlm.p_event_manager )
    {
        p_instance->libvlc_vlm.p_event_manager =
            libvlc_event_manager_new( p_instance->libvlc_vlm.p_vlm,
                                      p_instance, p_exception );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaAdded, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaRemoved, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaChanged, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStarted, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStopped, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusInit, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusOpening, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusPlaying, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusPause, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusEnd, NULL );
        libvlc_event_manager_register_event_type(
            p_instance->libvlc_vlm.p_event_manager,
            libvlc_VlmMediaInstanceStatusError, NULL );
    }

    if( !p_instance->libvlc_vlm.p_vlm )
    {
        p_instance->libvlc_vlm.p_vlm = vlm_New( p_instance->p_libvlc_int );
        if( !p_instance->libvlc_vlm.p_vlm )
        {
            libvlc_exception_raise( p_exception );
            libvlc_printerr( "VLM not supported or out of memory" );
            return VLC_EGENERIC;
        }
        var_AddCallback( (vlc_object_t *)p_instance->libvlc_vlm.p_vlm,
                         "intf-event", VlmEvent,
                         p_instance->libvlc_vlm.p_event_manager );
        p_instance->libvlc_vlm.pf_release = libvlc_vlm_release_internal;
    }

    return VLC_SUCCESS;
}
/**************************************************************************
 *       flat_media_list_view_item_at_index  (private)
 * (called by flat_media_list_view_item_at_index)
 **************************************************************************/
static libvlc_media_t *
hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
                                        int index,
                                        libvlc_exception_t * p_e )
{
    /* FIXME: we may want to cache that */
    libvlc_media_t * p_md;
    libvlc_media_list_t * p_submlist;
    trace("%d\n", index);
    int i, current_index, count = libvlc_media_list_count( p_mlv->p_mlist, p_e );
    current_index = -1;
    for( i = 0; i < count; i++ )
    {
        p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, p_e );
        if( !p_md ) continue;
        p_submlist = libvlc_media_subitems( p_md );
        if( !p_submlist ) continue;
        libvlc_media_list_release( p_submlist );
        current_index++;
        if( current_index == index )
            return p_md;
        libvlc_media_release( p_md );
    }

    libvlc_exception_raise( p_e );
    libvlc_printerr( "Index out of bound in Media List View" );
    return NULL;
}
Ejemplo n.º 14
0
Archivo: vlm.c Proyecto: FLYKingdom/vlc
void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name,
                         const char *psz_input, int i_options,
                         const char * const *ppsz_options, int b_enabled,
                         const char *psz_mux, libvlc_exception_t *p_exception )
{
    vlm_t *p_vlm;
    vlm_media_t m;
    int n;

    VLM(p_vlm);

    vlm_media_Init( &m );
    m.psz_name = strdup( psz_name );
    m.b_enabled = b_enabled;
    m.b_vod = true;
    m.vod.psz_mux = psz_mux ? strdup( psz_mux ) : NULL;
    if( psz_input )
        TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) );
    for( n = 0; n < i_options; n++ )
        TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) );

    n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL );
    vlm_media_Clean( &m );
    if( n )
    {
        libvlc_exception_raise( p_exception );
        libvlc_printerr( "Media %s creation failed", psz_name );
    }
}
Ejemplo n.º 15
0
int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
                          libvlc_exception_t *p_e )
{
    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
    vlc_value_t val_list;
    vlc_value_t val;
    int i_spu = -1;
    int i_ret = -1;
    int i;

    if( !p_input_thread ) return -1;

    i_ret = var_Get( p_input_thread, "spu-es", &val );
    if( i_ret < 0 )
    {
        libvlc_exception_raise( p_e, "Getting subtitle information failed" );
        vlc_object_release( p_input_thread );
        return i_ret;
    }

    var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
    for( i = 0; i < val_list.p_list->i_count; i++ )
    {
        vlc_value_t spu_val = val_list.p_list->p_values[i];
        if( val.i_int == spu_val.i_int )
        {
            i_spu = i;
            break;
        }
    }
    vlc_object_release( p_input_thread );
    return i_spu;
}
Ejemplo n.º 16
0
void libvlc_vlm_pause_media( libvlc_instance_t *p_instance, char *psz_name,
                            libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
    vlm_t *p_vlm;
    int64_t id;

    VLM(p_vlm);

    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
        vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) )
    {
        libvlc_exception_raise( p_exception, "Unable to pause %s", psz_name );
    }
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 17
0
void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, char *psz_name,
                            float f_percentage, libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
    vlm_t *p_vlm;
    int64_t id;

    VLM(p_vlm);

    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
        vlm_Control( p_vlm, VLM_SET_MEDIA_INSTANCE_POSITION, id, NULL, f_percentage ) )
    {
        libvlc_exception_raise( p_exception, "Unable to seek %s to %f", psz_name, f_percentage );
    }
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 18
0
static int libvlc_vlm_init( libvlc_instance_t *p_instance,
                            libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
    if( !p_instance->p_vlm )
        p_instance->p_vlm = vlm_New( p_instance->p_libvlc_int );
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif

    if( !p_instance->p_vlm )
    {
        libvlc_exception_raise( p_exception,
                                "Unable to create VLM." );
        return VLC_EGENERIC;
    }
    return VLC_SUCCESS;
}
Ejemplo n.º 19
0
int libvlc_add_intf( libvlc_instance_t *p_i, const char *name,
                      libvlc_exception_t *p_e )
{
    if( libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) )
    {
        libvlc_printerr("Interface initialization failed");
        libvlc_exception_raise( p_e );
        return -1;
    }
    return 0;
}
Ejemplo n.º 20
0
/**************************************************************************
 *       static mlist_is_writable (private)
 *
 * Raise exception and return 0 when the media_list instance is read-only,
 * or else return 1.
 **************************************************************************/
static inline
int mlist_is_writable( libvlc_media_list_t *p_mlist, libvlc_exception_t *p_e )
{
    if( !p_mlist||p_mlist->b_read_only )
    {
        /* We are read-only from user side */
        libvlc_exception_raise( p_e, "Cannot write to read-only media list." );
        return 0;
    }
    return 1;
}
Ejemplo n.º 21
0
void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name,
                          int b_loop, libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
#define VLM_CHANGE_CODE { p_media->broadcast.b_loop = b_loop; }
    VLM_CHANGE( "Unable to change %s loop property", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 22
0
/**************************************************************************
 *       static mlist_is_writable (private)
 *
 * Raise exception and return 0 when the media_list instance is read-only,
 * or else return 1.
 **************************************************************************/
static inline
int mlist_is_writable( libvlc_media_list_t *p_mlist, libvlc_exception_t *p_e )
{
    if( !p_mlist||p_mlist->b_read_only )
    {
        /* We are read-only from user side */
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Attempt to write a read-only media list" );
        return 0;
    }
    return 1;
}
Ejemplo n.º 23
0
void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name,
                             int b_enabled, libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
#define VLM_CHANGE_CODE { p_media->b_enabled = b_enabled; }
    VLM_CHANGE( "Unable to delete %s", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 24
0
void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name,
                           char *psz_input,  libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
#define VLM_CHANGE_CODE { TAB_APPEND( p_media->i_input, p_media->ppsz_input, strdup(psz_input) ); }
    VLM_CHANGE( "Unable to change %s input property", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 25
0
void libvlc_vlm_release( libvlc_instance_t *p_instance, libvlc_exception_t *p_exception)
{
#ifdef ENABLE_VLM
    vlm_t *p_vlm;

    VLM(p_vlm);

    vlm_Delete( p_vlm );
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 26
0
int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id,
                                 libvlc_exception_t *p_e )
{
    assert( PL );

    if( playlist_DeleteFromInput( PL, i_id,
                                  playlist_was_locked( p_instance ) ) )
    {
        libvlc_exception_raise( p_e, "deletion failed" );
        return VLC_ENOITEM;
    }
    return VLC_SUCCESS;
}
Ejemplo n.º 27
0
void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name,
                            char *psz_output,  libvlc_exception_t *p_exception )
{
#ifdef ENABLE_VLM
#define VLM_CHANGE_CODE { free( p_media->psz_output ); \
                          p_media->psz_output = strdup( psz_output ); }
    VLM_CHANGE( "Unable to change %s output property", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
#else
    libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
    return VLC_EGENERIC;
#endif
}
Ejemplo n.º 28
0
/*****************************************************************************
 * libvlc_audio_output_set_device_type : Set the audio device type
 *****************************************************************************/
void libvlc_audio_output_set_device_type( libvlc_instance_t *p_instance,
                                          int device_type,
                                          libvlc_exception_t *p_e )
{
    aout_instance_t *p_aout = GetAOut( p_instance, p_e );
    if( !p_aout )
        return;
    if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 )
    {
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Error setting audio device" );
    }
    vlc_object_release( p_aout );
}
Ejemplo n.º 29
0
/*****************************************************************************
 * libvlc_audio_set_channel : Set the current audio channel
 *****************************************************************************/
void libvlc_audio_set_channel( libvlc_instance_t *p_instance,
                               int channel,
                               libvlc_exception_t *p_e )
{
    aout_instance_t *p_aout = GetAOut( p_instance, p_e );
    if( !p_aout )
        return;

    if( var_SetInteger( p_aout, "audio-channels", channel ) < 0 )
    {
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Audio channel out of range" );
    }
    vlc_object_release( p_aout );
}
Ejemplo n.º 30
0
/*****************************************************************************
 * libvlc_audio_set_volume : Set the current volume
 *****************************************************************************/
void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
                              libvlc_exception_t *p_e )
{
    if( i_volume >= 0 && i_volume <= 200 )
    {
        i_volume = (i_volume * AOUT_VOLUME_MAX + 100) / 200;

        aout_VolumeSet( p_instance->p_libvlc_int, i_volume );
    }
    else
    {
        libvlc_exception_raise( p_e );
        libvlc_printerr( "Volume out of range" );
    }
}