Пример #1
0
int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer )
{
    char bands[EQZ_BANDS_MAX * EQZ_BAND_VALUE_SIZE + 1];

    if( p_equalizer != NULL )
    {
        for( unsigned i = 0, c = 0; i < EQZ_BANDS_MAX; i++ )
        {
            c += snprintf( bands + c, sizeof(bands) - c, " %.07f",
                          p_equalizer->f_amp[i] );
            if( unlikely(c >= sizeof(bands)) )
                return -1;
        }

        var_SetFloat( p_mi, "equalizer-preamp", p_equalizer->f_preamp );
        var_SetString( p_mi, "equalizer-bands", bands );
    }
    var_SetString( p_mi, "audio-filter", p_equalizer ? "equalizer" : "" );

    audio_output_t *p_aout = input_resource_HoldAout( p_mi->input.p_resource );
    if( p_aout != NULL )
    {
        if( p_equalizer != NULL )
        {
            var_SetFloat( p_aout, "equalizer-preamp", p_equalizer->f_preamp );
            var_SetString( p_aout, "equalizer-bands", bands );
        }

        var_SetString( p_aout, "audio-filter", p_equalizer ? "equalizer" : "" );
        vlc_object_release( p_aout );
    }

    return 0;
}
Пример #2
0
int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
{
    var_SetFloat (p_mi, "rate", rate);

    input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
    if( !p_input_thread )
        return 0;
    var_SetFloat( p_input_thread, "rate", rate );
    vlc_object_release( p_input_thread );
    return 0;
}
Пример #3
0
void ExtraPanel::OnEqRestore( wxCommandEvent &event )
{
    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
    if( p_aout == NULL )
    {
        vlc_value_t val;
        vlc_bool_t b_previous = eq_chkbox->IsChecked();
        val.f_float = 12.0;
        IntfPreampCallback( NULL, NULL, val,val, this );
        config_PutFloat( p_intf, "equalizer-preamp", 12.0 );
        val.psz_string = strdup( "0 0 0 0 0 0 0 0 0 0" );
        IntfBandsCallback( NULL, NULL, val,val, this );
        config_PutPsz( p_intf, "equalizer-bands",
                                "0 0 0 0 0 0 0 0 0 0");
        config_PutPsz( p_intf, "equalizer-preset","flat" );
        eq_chkbox->SetValue( b_previous );
    }
    else
    {
        var_SetFloat( p_aout, "equalizer-preamp", 12.0 );
        config_PutFloat( p_intf, "equalizer-preamp", 12.0 );
        var_SetString( p_aout, "equalizer-bands",
                                "0 0 0 0 0 0 0 0 0 0");
        config_PutPsz( p_intf, "equalizer-bands",
                                "0 0 0 0 0 0 0 0 0 0");
        var_SetString( p_aout , "equalizer-preset" , "flat" );
        config_PutPsz( p_intf, "equalizer-preset","flat" );
        vlc_object_release( p_aout );
    }
}
Пример #4
0
void CmdPlay::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist == NULL )
        return;

    // if already playing an input, reset rate to normal speed
    input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
    if( pInput )
    {
        var_SetFloat( pPlaylist, "rate", 1.0 );
        vlc_object_release( pInput );
    }

    playlist_Lock( pPlaylist );
    const bool b_empty = playlist_IsEmpty( pPlaylist );
    playlist_Unlock( pPlaylist );

    if( !b_empty )
    {
        playlist_Play( pPlaylist );
    }
    else
    {
        // If the playlist is empty, open a file requester instead
        CmdDlgFile( getIntf() ).execute();
    }
}
Пример #5
0
/*****************************************************************************
 * Object variables callbacks
 *****************************************************************************/
static int ZoomCallback( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    (void)psz_cmd; (void)oldval; (void)p_data;

    return var_SetFloat( p_this, "scale", newval.f_float );
}
Пример #6
0
Файл: var.c Проект: 0xheart0/vlc
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
                             vlc_value_t oldval, vlc_value_t newval,
                             void *p_data )
{
    input_thread_t *p_input = (input_thread_t*)p_this;
    VLC_UNUSED(oldval); VLC_UNUSED(p_data);

    if( !strcmp( psz_cmd, "position-offset" ) )
    {
        float f_position = var_GetFloat( p_input, "position" ) + newval.f_float;
        if( f_position < 0.f )
            f_position = 0.f;
        else if( f_position > 1.f )
            f_position = 1.f;
        var_SetFloat( p_this, "position", f_position );
    }
    else
    {
        /* Update "length" for better intf behaviour */
        const int64_t i_length = var_GetInteger( p_input, "length" );
        if( i_length > 0 && newval.f_float >= 0.f && newval.f_float <= 1.f )
        {
            vlc_value_t val;

            val.i_int = i_length * newval.f_float;
            var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
        }

        /* */
        input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval );
    }
    return VLC_SUCCESS;
}
Пример #7
0
bool VLCVarChoiceModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
    if (!m_object->get())
        return false;

    int row = index.row();
    if (role == Qt::CheckStateRole && row >= 0 && row < m_values.count())
    {
        //only update the variable when we select an entry
        if (!value.toBool())
            return false;

        int ret = VLC_EGENERIC;
        switch (m_type & VLC_VAR_CLASS) {
        case VLC_VAR_STRING:
            ret = var_SetString(m_object->get(), qtu(m_varname), qtu(m_values[row].toString()) );
            break;
        case VLC_VAR_INTEGER:
            ret = var_SetInteger(m_object->get(), qtu(m_varname), m_values[row].toInt() );
            break;
        case VLC_VAR_FLOAT:
            ret = var_SetFloat(m_object->get(), qtu(m_varname), m_values[row].toFloat() );
            break;
        case VLC_VAR_BOOL:
            ret = var_SetBool(m_object->get(), qtu(m_varname), m_values[row].toBool() );
            break;
        default:
            break;
        }
        return ret == VLC_SUCCESS;
    }
    return false;
}
Пример #8
0
void InputManager::reverse()
{
    if( hasInput() )
    {
        float f_rate_ = var_GetFloat( p_input, "rate" );
        var_SetFloat( p_input, "rate", -f_rate_ );
    }
}
Пример #9
0
void StreamTime::set( float percentage, bool updateVLC )
{
    VarPercent::set( percentage );

    // Avoid looping forever...
    if( updateVLC && getIntf()->p_sys->p_input )
        var_SetFloat( getIntf()->p_sys->p_input, "position", percentage );
}
Пример #10
0
int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
{
    if (rate < 0.)
    {
        libvlc_printerr ("Playing backward not supported");
        return -1;
    }

    var_SetFloat (p_mi, "rate", rate);

    input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
    if( !p_input_thread )
        return 0;
    var_SetFloat( p_input_thread, "rate", rate );
    vlc_object_release( p_input_thread );
    return 0;
}
Пример #11
0
static void VariablesInit( playlist_t *p_playlist )
{
    /* These variables control updates */
    var_Create( p_playlist, "intf-change", VLC_VAR_BOOL );
    var_SetBool( p_playlist, "intf-change", true );

    var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS );
    var_Create( p_playlist, "leaf-to-parent", VLC_VAR_INTEGER );

    var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER );
    var_SetInteger( p_playlist, "playlist-item-deleted", -1 );

    var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS );

    var_Create( p_playlist, "input-current", VLC_VAR_ADDRESS );

    /* Variables to control playback */
    var_Create( p_playlist, "playlist-autostart", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "random", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_AddCallback( p_playlist, "random", RandomCallback, NULL );
    var_Create( p_playlist, "repeat", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "loop", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "corks", VLC_VAR_INTEGER );
    var_AddCallback( p_playlist, "corks", CorksCallback, NULL );

    var_Create( p_playlist, "rate", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
    var_AddCallback( p_playlist, "rate", RateCallback, NULL );
    var_Create( p_playlist, "rate-slower", VLC_VAR_VOID );
    var_AddCallback( p_playlist, "rate-slower", RateOffsetCallback, NULL );
    var_Create( p_playlist, "rate-faster", VLC_VAR_VOID );
    var_AddCallback( p_playlist, "rate-faster", RateOffsetCallback, NULL );

    var_Create( p_playlist, "video-splitter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
    var_AddCallback( p_playlist, "video-splitter", VideoSplitterCallback, NULL );

    /* sout variables */
    var_Create( p_playlist, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "demux-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );

    /* */
    var_Create( p_playlist, "album-art", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "metadata-network-access", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );

    /* Variables to preserve video output parameters */
    var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    var_Create( p_playlist, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );

    /* Audio output parameters */
    var_Create( p_playlist, "audio-device", VLC_VAR_STRING );
    var_Create( p_playlist, "mute", VLC_VAR_BOOL );
    var_Create( p_playlist, "volume", VLC_VAR_FLOAT );
    var_SetFloat( p_playlist, "volume", -1.f );
}
Пример #12
0
/**********************************************************************
 * Execute a var command on an object identified by its name
 **********************************************************************/
int var_Command( vlc_object_t *p_this, const char *psz_name,
                 const char *psz_cmd, const char *psz_arg, char **psz_msg )
{
    vlc_object_t *p_obj = vlc_object_find_name( p_this->p_libvlc,
                                                psz_name );
    int i_type, i_ret;

    if( !p_obj )
    {
        if( psz_msg )
            *psz_msg = strdup( "Unknown destination object." );
        return VLC_ENOOBJ;
    }

    i_type = var_Type( p_obj, psz_cmd );
    if( !( i_type&VLC_VAR_ISCOMMAND ) )
    {
        vlc_object_release( p_obj );
        if( psz_msg )
            *psz_msg = strdup( "Variable doesn't exist or isn't a command." );
        return VLC_EGENERIC;
    }

    i_type &= VLC_VAR_CLASS;
    switch( i_type )
    {
        case VLC_VAR_INTEGER:
            i_ret = var_SetInteger( p_obj, psz_cmd, atoi( psz_arg ) );
            break;
        case VLC_VAR_FLOAT:
            i_ret = var_SetFloat( p_obj, psz_cmd, us_atof( psz_arg ) );
            break;
        case VLC_VAR_STRING:
            i_ret = var_SetString( p_obj, psz_cmd, psz_arg );
            break;
        case VLC_VAR_BOOL:
            i_ret = var_SetBool( p_obj, psz_cmd, atoi( psz_arg ) );
            break;
        default:
            i_ret = VLC_EGENERIC;
            break;
    }

    vlc_object_release( p_obj );

    if( psz_msg )
    {
        if( asprintf( psz_msg, "%s on object %s returned %i (%s)",
                  psz_cmd, psz_name, i_ret, vlc_error( i_ret ) ) == -1)
            *psz_msg = NULL;
    }

    return i_ret;
}
Пример #13
0
static void Run(intf_thread_t *intf)
{
  intf_sys_t *sys = intf->p_sys;
  int fd;

  int canc = vlc_savecancel();

  RegisterCallbacks(intf);

  while(1) {
    msg_Info(intf, "Creating IRC connection...");

    fd = net_ConnectTCP(VLC_OBJECT(intf), sys->server, 6667);

    if(fd == -1) {
      msg_Err(intf, "Error connecting to server");
      return;
    }

    msg_Info(intf, "Connected to server");

    /* initialize context */
    sys->fd = fd;
    sys->line_loc = 0;

    SendBufferInit(intf);

    SendBufferAppend(intf, "NICK ");
    SendBufferAppend(intf, sys->nick);
    SendBufferAppend(intf, "\r\n");

    SendBufferAppend(intf, "USER ");
    SendBufferAppend(intf, sys->nick);
    SendBufferAppend(intf, " 8 * vlc\r\n");

    sys->playlist = pl_Get(intf);

    #ifdef STOP_HACK
    playlist_Pause(sys->playlist);
    input_thread_t * input = playlist_CurrentInput(sys->playlist);
    var_SetFloat(input, "position", 0.0);
    #endif

    EventLoop(fd, intf);

    free(sys->send_buffer->buffer);

    sleep(30);
  }

  free(sys);

  vlc_restorecancel(canc);
}
Пример #14
0
void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
                                       float position )
{
    input_thread_t *p_input_thread;

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

    var_SetFloat( p_input_thread, "position", position );
    vlc_object_release( p_input_thread );
}
Пример #15
0
static int PresetCallback( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    aout_filter_sys_t *p_sys = (aout_filter_sys_t *)p_data;
    aout_instance_t *p_aout = (aout_instance_t *)p_this;

    char *psz_preset = newval.psz_string;
    char psz_newbands[120];

    memset( psz_newbands, 0, 120 );

    if( *psz_preset && p_sys->i_band == 10 )
    {
        int i;
        /* */
        for( i = 0; eqz_preset_10b[i] != NULL; i++ )
        {
            if( !strcasecmp( eqz_preset_10b[i]->psz_name, psz_preset ) )
            {
                int j;
                p_sys->f_gamp *= pow( 10, eqz_preset_10b[i]->f_preamp / 20.0 );
                for( j = 0; j < p_sys->i_band; j++ )
                {
                    p_sys->f_amp[j] = EqzConvertdB(
                                        eqz_preset_10b[i]->f_amp[j] );
                    sprintf( psz_newbands, "%s %f", psz_newbands,
                                         eqz_preset_10b[i]->f_amp[j] );
                }
                if( p_sys->b_first == VLC_FALSE )
                {
                    var_SetString( p_aout, "equalizer-bands", psz_newbands );
                    var_SetFloat( p_aout, "equalizer-preamp",
                                    eqz_preset_10b[i]->f_preamp );
                }
                else
                {
                    p_sys->psz_newbands = strdup( psz_newbands );
                    p_sys->f_newpreamp = eqz_preset_10b[i]->f_preamp;
                }
                break;
            }
        }
        if( eqz_preset_10b[i] == NULL )
        {
            msg_Err( p_aout, "equalizer preset '%s' not found", psz_preset );
            msg_Dbg( p_aout, "full list:" );
            for( i = 0; eqz_preset_10b[i] != NULL; i++ )
                msg_Dbg( p_aout, "  - '%s'", eqz_preset_10b[i]->psz_name );
        }
    }
    return VLC_SUCCESS;
}
Пример #16
0
void ExtraPanel::OnNormvolSlider( wxScrollEvent &event )
{
    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
    if( p_aout != NULL )
    {
        var_SetFloat( p_aout, "norm-max-level", (float)event.GetPosition()/10 );
        vlc_object_release( p_aout );
    }
    else
    {
        config_PutFloat( p_intf, "norm-max-level",
                        (float)event.GetPosition()/10 );
    }
}
Пример #17
0
/**
 * Deinitializes an audio output module and destroys an audio output object.
 */
void aout_Destroy (audio_output_t *aout)
{
    aout_owner_t *owner = aout_owner (aout);

    aout_OutputLock (aout);
    module_unneed (aout, owner->module);
    /* Protect against late call from intf.c */
    aout->volume_set = NULL;
    aout->mute_set = NULL;
    aout_OutputUnlock (aout);

    var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
    var_SetFloat (aout, "volume", -1.f);
    var_DelCallback (aout, "volume", var_Copy, aout->p_parent);
    vlc_object_release (aout);
}
Пример #18
0
/*****************************************************************************
* Set the preamp level
*****************************************************************************/
static int vlclua_preamp_set( lua_State *L )
{
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( p_input )
    {
        aout_instance_t *p_aout = input_GetAout( p_input );
        float preamp = luaL_checknumber( L, 1 );
        var_SetFloat( p_aout, "equalizer-preamp",preamp);
        lua_pushnumber( L, preamp );

        vlc_object_release( p_aout );
        vlc_object_release( p_input );
        return 1;
    }
    return 0;
}
Пример #19
0
static int RateOffsetCallback( vlc_object_t *obj, char const *psz_cmd,
                               vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    playlist_t *p_playlist = (playlist_t *)obj;
    VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(newval);

    static const float pf_rate[] = {
        1.0/64, 1.0/32, 1.0/16, 1.0/8, 1.0/4, 1.0/3, 1.0/2, 2.0/3,
        1.0/1,
        3.0/2, 2.0/1, 3.0/1, 4.0/1, 8.0/1, 16.0/1, 32.0/1, 64.0/1,
    };
    const size_t i_rate_count = sizeof(pf_rate)/sizeof(*pf_rate);

    float f_rate;
    struct input_thread_t *input;

    PL_LOCK;
    input = pl_priv( p_playlist )->p_input;
    f_rate = var_GetFloat( input ? (vlc_object_t *)input : obj, "rate" );
    PL_UNLOCK;

    if( !strcmp( psz_cmd, "rate-faster" ) )
    {
        /* compensate for input rounding errors */
        float r = f_rate * 1.1;
        for( size_t i = 0; i < i_rate_count; i++ )
            if( r < pf_rate[i] )
            {
                f_rate = pf_rate[i];
                break;
            }
    }
    else
    {
        /* compensate for input rounding errors */
        float r = f_rate * .9;
        for( size_t i = 1; i < i_rate_count; i++ )
            if( r <= pf_rate[i] )
            {
                f_rate = pf_rate[i - 1];
                break;
            }
    }

    var_SetFloat( p_playlist, "rate", f_rate );
    return VLC_SUCCESS;
}
Пример #20
0
static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p )
{
    (void)psz_cmd; (void)oldval;(void)p;
    playlist_t *p_playlist = (playlist_t*)p_this;

    PL_LOCK;

    if( pl_priv(p_playlist)->p_input == NULL )
    {
        PL_UNLOCK;
        return VLC_SUCCESS;
    }

    var_SetFloat( pl_priv( p_playlist )->p_input, "rate", newval.f_float );
    PL_UNLOCK;
    return VLC_SUCCESS;
}
Пример #21
0
static void test_floats( libvlc_int_t *p_libvlc )
{
    int i;
    for( i = 0; i < i_var_count; i++ )
         var_Create( p_libvlc, psz_var_name[i], VLC_VAR_FLOAT );

    for( i = 0; i < i_var_count; i++ )
    {
        var_value[i].f_float = rand();
        var_SetFloat( p_libvlc, psz_var_name[i], var_value[i].f_float );
    }

    for( i = 0; i < i_var_count; i++ )
        assert( var_GetFloat( p_libvlc, psz_var_name[i] ) == var_value[i].f_float );

    for( i = 0; i < i_var_count; i++ )
        var_Destroy( p_libvlc, psz_var_name[i] );
}
Пример #22
0
Файл: var.c Проект: paa/vlc
static int RateOffsetCallback( vlc_object_t *p_this, char const *psz_cmd,
                               vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    input_thread_t *p_input = (input_thread_t*)p_this;
    VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(newval);

    static const float pf_rate[] = {
        1.0/64, 1.0/32, 1.0/16, 1.0/8, 1.0/4, 1.0/3, 1.0/2, 2.0/3,
        1.0/1,
        3.0/2, 2.0/1, 3.0/1, 4.0/1, 8.0/1, 16.0/1, 32.0/1, 64.0/1,
    };
    const unsigned i_rate_count = sizeof(pf_rate)/sizeof(*pf_rate);

    const float f_rate = var_GetFloat( p_input, "rate" );

    /* Determine the factor closest to the current rate */
    float f_error;
    int i_idx;
    for( unsigned i = 0; i < i_rate_count; i++ )
    {
        const float f_test_e = fabs( fabs( f_rate ) - pf_rate[i] );
        if( i == 0 || f_test_e < f_error )
        {
            i_idx = i;
            f_error = f_test_e;
        }
    }
    assert( i_idx < (int)i_rate_count );

    /* */
    i_idx += strcmp( psz_cmd, "rate-faster" ) == 0 ? 1 : -1;
    if( i_idx >= 0 && i_idx < (int)i_rate_count )
    {
        const float f_rate_min = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MAX;
        const float f_rate_max = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MIN;
        const float f_sign = f_rate >= 0 ? +1. : -1.;

        var_SetFloat( p_input, "rate",
                      f_sign * __MAX( __MIN( pf_rate[i_idx],
                                             f_rate_max ),
                                      f_rate_min ) );
    }
    return VLC_SUCCESS;
}
Пример #23
0
static int VideoSplitterCallback( vlc_object_t *p_this, char const *psz_cmd,
                                  vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    playlist_t *p_playlist = (playlist_t*)p_this;
    VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(newval);

    PL_LOCK;

    /* Force the input to restart the video ES to force a vout recreation */
    input_thread_t *p_input = pl_priv( p_playlist )->p_input;
    if( p_input )
    {
        const double f_position = var_GetFloat( p_input, "position" );
        input_Control( p_input, INPUT_RESTART_ES, -VIDEO_ES );
        var_SetFloat( p_input, "position", f_position );
    }

    PL_UNLOCK;
    return VLC_SUCCESS;
}
Пример #24
0
void EqualizerPreamp::set( float percentage, bool updateVLC )
{
    VarPercent::set( percentage );

    // Avoid infinite loop
    if( updateVLC )
    {
        float val = 40 * percentage - 20;

        aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
                                VLC_OBJECT_AOUT, FIND_ANYWHERE );
        config_PutFloat( getIntf(), "equalizer-preamp", val );
        if( pAout )
        {
            // Update the audio output
            var_SetFloat( pAout, "equalizer-preamp", val );
            vlc_object_release( pAout );
        }
    }
}
Пример #25
0
/*****************************************************************************
* Set the preset specified by preset id
*****************************************************************************/
static int vlclua_equalizer_setpreset( lua_State *L )
{
    int presetid = luaL_checknumber( L, 1 );
    if( presetid >= NB_PRESETS || presetid < 0 )
        return 0;
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( p_input )
    {
        audio_output_t *p_aout = input_GetAout( p_input );
        vlc_object_release( p_input );
        if( !p_aout )
        {
            return 0;
        }
        char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
        if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
        {
            free( psz_af );
            vlc_object_release( p_aout );
            return 0;
        }
        free( psz_af );
        char *newstr;
        if( asprintf( &newstr , "%6.1f" , eqz_preset_10b[presetid].f_amp[0] ) == -1 )
            return 0;
        for ( int i = 1 ; i < 10 ; i++ )
        {
            if( asprintf( &newstr, "%s%6.1f",newstr ,eqz_preset_10b[presetid].f_amp[i]) == -1 )
                return 0;
        }
        var_SetString( p_aout, "equalizer-bands",newstr );
        var_SetFloat( p_aout, "equalizer-preamp", eqz_preset_10b[presetid].f_preamp );
        var_SetString( p_aout , "equalizer-preset" , preset_list[presetid] );
        vlc_object_release( p_aout );
        free( newstr );
        return 1;
    }
    return 0;
}
Пример #26
0
void EqualizerPreamp::set( float percentage, bool updateVLC )
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    audio_output_t *pAout = playlist_GetAout( pPlaylist );

    VarPercent::set( percentage );

    // Avoid infinite loop
    if( updateVLC )
    {
        float val = 40 * percentage - 20;

        config_PutFloat( getIntf(), "equalizer-preamp", val );
        if( pAout )
        {
            // Update the audio output
            var_SetFloat( pAout, "equalizer-preamp", val );
        }
    }

    if( pAout )
        vlc_object_release( pAout );
}
Пример #27
0
/*****************************************************************************
* Set the preamp level
*****************************************************************************/
static int vlclua_preamp_set( lua_State *L )
{
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( !p_input )
        return 0;

    audio_output_t *p_aout = input_GetAout( p_input );
    vlc_object_release( p_input );
    if( !p_aout )
        return 0;

    char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
    if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
    {
        free( psz_af );
        vlc_object_release( p_aout );
        return 0;
    }
    free( psz_af );

    var_SetFloat( p_aout, "equalizer-preamp", luaL_checknumber( L, 1 ) );
    vlc_object_release( p_aout );
    return 1;
}
Пример #28
0
void ExtraPanel::OnPreamp( wxScrollEvent &event )
{
    float f= (float)( 400 - event.GetPosition() ) / 10 - 20 ;
    char psz_val[5];

    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);

    sprintf( psz_val, "%.1f", f );
    const wxString preamp = wxT("Preamp\n");
    preamp_text->SetLabel( preamp + wxU( psz_val ) + wxT( "dB" ) );

    if( p_aout == NULL )
    {
        config_PutFloat( p_intf, "equalizer-preamp", f );
    }
    else
    {
        var_SetFloat( p_aout, "equalizer-preamp", f );
        config_PutFloat( p_intf, "equalizer-preamp", f );
        b_my_update = VLC_TRUE;
        vlc_object_release( p_aout );
    }
}
Пример #29
0
void InputManager::setRate( int new_rate )
{
    var_SetFloat( THEPL, "rate",
                 (float)INPUT_RATE_DEFAULT / (float)new_rate );
}
Пример #30
0
void InputManager::normalRate()
{
    var_SetFloat( THEPL, "rate", 1. );
}