Exemple #1
0
int
conn_parse_kvp(struct connection *c, struct kvp *kvp)
{
	struct kvp *k;
	struct session *s = c->session;
	const char *err;
	int errors = 0;


	for (k = kvp; k->key; k++) {
		/* XXX handle NotUnderstood|Irrelevant|Reject */
		SET_NUM(k, s, MaxBurstLength, 512, 16777215);
		SET_NUM(k, s, FirstBurstLength, 512, 16777215);
		SET_NUM(k, s, DefaultTime2Wait, 0, 3600);
		SET_NUM(k, s, DefaultTime2Retain, 0, 3600);
		SET_NUM(k, s, MaxOutstandingR2T, 1, 65535);
		SET_NUM(k, s, TargetPortalGroupTag, 1, 65535);
		SET_NUM(k, s, MaxConnections, 1, 65535);
		SET_BOOL(k, s, InitialR2T);
		SET_BOOL(k, s, ImmediateData);
		SET_BOOL(k, s, DataPDUInOrder);
		SET_BOOL(k, s, DataSequenceInOrder);
		SET_NUM(k, s, ErrorRecoveryLevel, 0, 2);
		SET_NUM(k, c, MaxRecvDataSegmentLength, 512, 16777215);
	}

	if (errors) {
		log_warnx("conn_parse_kvp: errors found");
		return -1;
	}
	return 0;
}
Exemple #2
0
void VlcProc::init_variables()
{
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;

    SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
    SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
    SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );

    audio_volume_t volume = aout_VolumeGet( pPlaylist );
    SET_VOLUME( m_cVarVolume, volume, false );
    SET_BOOL( m_cVarMute, volume == 0 );

    update_equalizer();
}
Exemple #3
0
void VlcProc::init_variables()
{
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;

    SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
    SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
    SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );

    SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
    bool b_is_muted = aout_MuteGet( pPlaylist ) > 0;
    SET_BOOL( m_cVarMute, b_is_muted );

    update_equalizer();
}
Exemple #4
0
void VlcProc::init_variables()
{
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;

    SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
    SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
    SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );

    SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
    SET_BOOL( m_cVarMute, var_GetBool( pPlaylist, "mute" ) );

    SET_BOOL( m_cVarStopped, true );

    init_equalizer();
}
Exemple #5
0
void VlcProc::on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)newVal;
    playlist_t* pPlaylist = (playlist_t*) p_obj;

    SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
}
Exemple #6
0
void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)p_obj;
    char *pFilters = newVal.psz_string;
    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    SET_BOOL( m_cVarEqualizer, b_equalizer );
}
Exemple #7
0
void VlcProc::on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)newVal;
    playlist_t* pPlaylist = (playlist_t*) p_obj;

    SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
}
Exemple #8
0
/* Set map style variables */
void
set_map_vars(void)
{
    SET_BOOL(show_page_border);
    SET_BOOL(show_page_title);

    SET_BOOL(show_map_border);
    SET_BOOL(show_map_title);

    SET_BOOL(show_tags);

    SET_COLOUR(map_background_colour);
    SET_COLOUR(map_border_colour);
    SET_COLOUR(map_title_colour);

    SET_COLOUR(page_background_colour);
    SET_COLOUR(page_border_colour);
    SET_COLOUR(page_title_colour);

    SET_FONT(map_title_font);
    SET_FONT(page_title_font);

    SET_REAL(font_scale);
    font_scale = V_MAX(font_scale, 0.1);

    SET_REAL(page_margin);

    SET_FONTSIZE(map_title_fontsize);
    SET_FONTSIZE(page_title_fontsize);

    SET_STRING(page_size);
    if (!get_papersize(page_size, &page_width, &page_height))
        fatal("invalid paper size: %s", page_size);

    if (VAR_DEF("page_width"))
        SET_REAL(page_width);

    if (VAR_DEF("page_height"))
        SET_REAL(page_height);

    SET_REAL(room_size);
    room_size = V_MAX(room_size, 0.1);

    SET_REAL(room_width);
    SET_REAL(room_height);
}
Exemple #9
0
void VlcProc::on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    input_thread_t* pInput = (input_thread_t*) p_obj;

    assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );

    SET_BOOL( m_cVarRecordable, var_GetBool(  pInput, "can-record" ) );
}
Exemple #10
0
void VlcProc::on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)p_obj; (void)newVal;
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;

    audio_volume_t volume = aout_VolumeGet( pPlaylist );
    SET_VOLUME( m_cVarVolume, volume, false );
    SET_BOOL( m_cVarMute, volume == 0 );
}
Exemple #11
0
void VlcProc::on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)p_obj; (void)newVal;
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;

    SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
    bool b_is_muted = aout_MuteGet( pPlaylist ) > 0;
    SET_BOOL( m_cVarMute, b_is_muted );
}
Exemple #12
0
/* Set link style variables */
void
set_link_vars(void)
{
    SET_BOOL(link_dashed);
    SET_BOOL(link_spline);

    SET_COLOUR(link_colour);
    SET_COLOUR(link_text_colour);

    SET_FONT(link_text_font);

    SET_FONTSIZE(link_text_fontsize);

    SET_REAL(link_arrow_size);
    SET_REAL(link_line_width);

    SET_STRING(link_inout_string);
    SET_STRING(link_updown_string);
}
Exemple #13
0
void VlcProc::reset_input()
{
    SET_BOOL( m_cVarSeekable, false );
    SET_BOOL( m_cVarRecordable, false );
    SET_BOOL( m_cVarRecording, false );
    SET_BOOL( m_cVarDvdActive, false );
    SET_BOOL( m_cVarFullscreen, false );
    SET_BOOL( m_cVarHasAudio, false );
    SET_BOOL( m_cVarHasVout, false );
    SET_BOOL( m_cVarStopped, true );
    SET_BOOL( m_cVarPlaying, false );
    SET_BOOL( m_cVarPaused, false );

    SET_STREAMTIME( m_cVarTime, 0, false );
    SET_TEXT( m_cVarStreamName, UString( getIntf(), "") );
    SET_TEXT( m_cVarStreamURI, UString( getIntf(), "") );
    SET_TEXT( m_cVarStreamBitRate, UString( getIntf(), "") );
    SET_TEXT( m_cVarStreamSampleRate, UString( getIntf(), "") );

    getPlaytreeVar().onUpdateCurrent( false );
}
Exemple #14
0
void VlcProc::init_equalizer()
{
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
    audio_output_t* pAout = playlist_GetAout( pPlaylist );
    if( pAout )
    {
        if( !var_Type( pAout, "equalizer-bands" ) )
            var_Create( pAout, "equalizer-bands",
                        VLC_VAR_STRING | VLC_VAR_DOINHERIT);
        if( !var_Type( pAout, "equalizer-preamp" ) )
            var_Create( pAout, "equalizer-preamp",
                        VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);

        // New Aout (addCallbacks)
        var_AddCallback( pAout, "audio-filter",
                         onGenericCallback, this );
        var_AddCallback( pAout, "equalizer-bands",
                         onEqBandsChange, this );
        var_AddCallback( pAout, "equalizer-preamp",
                         onEqPreampChange, this );
    }

    // is equalizer enabled ?
    char *pFilters = pAout ?
                   var_GetNonEmptyString( pAout, "audio-filter" ) :
                   var_InheritString( getIntf(), "audio-filter" );
    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    free( pFilters );
    SET_BOOL( m_cVarEqualizer, b_equalizer );

    // retrieve initial bands
    char* bands = pAout ?
                  var_GetString( pAout, "equalizer-bands" ) :
                  var_InheritString( getIntf(), "equalizer-bands" );
    if( bands )
    {
        m_varEqBands.set( bands );
        free( bands );
    }

    // retrieve initial preamp
    float preamp = pAout ?
                   var_GetFloat( pAout, "equalizer-preamp" ) :
                   var_InheritFloat( getIntf(), "equalizer-preamp" );
    EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)m_cVarEqPreamp.get();
    pVarPreamp->set( (preamp + 20.0) / 40.0 );

    if( pAout )
        vlc_object_release( pAout);
}
Exemple #15
0
void VlcProc::update_equalizer()
{

    char *pFilters;
    if( m_pAout )
        pFilters = var_GetNonEmptyString( m_pAout, "audio-filter" );
    else
        pFilters = var_InheritString( getIntf(), "audio-filter" );

    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    free( pFilters );

    SET_BOOL( m_cVarEqualizer, b_equalizer );
}
Exemple #16
0
void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    aout_instance_t* pAout = (aout_instance_t*) p_obj;

    char *pFilters = newVal.psz_string;

    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    SET_BOOL( m_cVarEqualizer, b_equalizer );
    if( b_equalizer && !m_bEqualizer_started )
    {
        var_AddCallback( pAout, "equalizer-bands", onEqBandsChange, this );
        var_AddCallback( pAout, "equalizer-preamp", onEqPreampChange, this );
        m_bEqualizer_started = true;
    }
}
Exemple #17
0
/* Set room style variables */
void
set_room_vars(void)
{
    SET_BOOL(room_border_dashed);
    SET_BOOL(show_items);

    SET_COLOUR(item_text_colour);
    SET_COLOUR(room_border_colour);
    SET_COLOUR(room_colour);
    SET_COLOUR(room_exit_colour);
    SET_COLOUR(room_shadow_colour);
    SET_COLOUR(room_text_colour);

    SET_FONT(item_text_font);
    SET_FONT(room_text_font);

    SET_FONTSIZE(item_text_fontsize);
    SET_FONTSIZE(room_text_fontsize);

    SET_REAL(room_border_width);
    SET_REAL(room_exit_width);
    SET_REAL(room_shadow_xoff);
    SET_REAL(room_shadow_yoff);
}
Exemple #18
0
static void
cfg_main_section_save (const char *section)
{
    char *filters;

    SET_STRING(theme);
    SET_STRING(engine);
    SET_STRING(verbosity);
    SET_STRING(log_file);

    SET_INT(idle_timeout);
    SET_INT(fullscreen);
    SET_INT(slideshow_delay);

    SET_BOOL(display_mouse);

    SET_TUPLE(music_filters, "music_ext");
    SET_TUPLE(video_filters, "video_ext");
    SET_TUPLE(photo_filters, "photo_ext");
}
Exemple #19
0
** Default:		The default value of the option.
*/

struct global_pref global_pref[] = {
	{	"ACTIVITY_TYPES",
		OPT_INT,
		0,
		opt_set_int,
		NULL,
		SET_INT(DEFAULT_ACTIVITY_TYPES)
	},{	"AUTO_RECONNECT",
		OPT_BOOL,
		0,
		opt_set_bool,
		NULL,
		SET_BOOL(DEFAULT_AUTO_RECONNECT)
	},{	"AUTO_REJOIN",
		OPT_BOOL,
		0,
		opt_set_bool,
		NULL,
		SET_BOOL(DEFAULT_AUTO_REJOIN)
	},{	"AUTOSEND_AWAY",
		OPT_BOOL,
		0,
		opt_set_bool,
		NULL,
		SET_BOOL(DEFAULT_AUTOSEND_AWAY)
	},{	"BANNER",
		OPT_STR,
		0,
Exemple #20
0
void VlcProc::on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    playlist_t* pPlaylist = (playlist_t*) p_obj;

    SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
}
Exemple #21
0
JNIEXPORT void JNICALL Java_com_turbovnc_vncviewer_Viewport_setupExtInput
  (JNIEnv *env, jobject obj)
{
  jclass cls, eidcls;
  jfieldID fid;
  jmethodID mid;
  Display *dpy = NULL;
  Window win = 0;
  XDeviceInfo *devInfo = NULL;
  XDevice *device = NULL;
  int nDevices = 0, i, ci, ai, nEvents = 0;
  int buttonPressType = -1, buttonReleaseType = -1, motionType = -1;
  XEventClass events[100] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
  jobject extInputDevice;

  if ((dpy = XOpenDisplay(NULL)) == NULL)
    _throw("Could not open X display");

  bailif0(cls = (*env)->GetObjectClass(env, obj));
  bailif0(fid = (*env)->GetFieldID(env, cls, "x11win", "J"));
  if ((win = (Window)(*env)->GetLongField(env, obj, fid)) == 0)
    _throw("X window handle has not been initialized");

  if ((devInfo = XListInputDevices(dpy, &nDevices)) == NULL)
    _throw("Could not list XI devices");

  for (i = 0; i < nDevices; i++) {
    char *type;
    XAnyClassPtr classInfo = devInfo[i].inputclassinfo;
    CARD32 canGenerate = 0, productID = 0;

    if (devInfo[i].use != IsXExtensionPointer)
      continue;
    if (devInfo[i].type == None)
      continue;
    type = XGetAtomName(dpy, devInfo[i].type);
    if (!strcmp(type, "MOUSE"))  {
      XFree(type);
      continue;
    }
    /* TurboVNC-specific:  we use productID to represent the device type, so
       we can recreate it on the server */
    if (!strcmp(type, "CURSOR"))
      productID = rfbGIIDevTypeCursor;
    else if (!strcmp(type, "STYLUS"))
      productID = rfbGIIDevTypeStylus;
    else if (!strcmp(type, "ERASER"))
      productID = rfbGIIDevTypeEraser;
    else if (!strcmp(type, "TOUCH"))
      productID = rfbGIIDevTypeTouch;
    else if (!strcmp(type, "PAD"))
      productID = rfbGIIDevTypePad;
    XFree(type);

    bailif0(eidcls =
            (*env)->FindClass(env, "com/turbovnc/rfb/ExtInputDevice"));
    bailif0(extInputDevice = (*env)->AllocObject(env, eidcls));

    SET_STRING(eidcls, extInputDevice, name, devInfo[i].name);
    SET_LONG(eidcls, extInputDevice, vendorID, 4242);
    SET_LONG(eidcls, extInputDevice, productID, productID);
    SET_LONG(eidcls, extInputDevice, id, devInfo[i].id);

    for (ci = 0; ci < devInfo[i].num_classes; ci++) {

      switch (classInfo->class) {

        case ButtonClass:
        {
          XButtonInfoPtr b = (XButtonInfoPtr)classInfo;
          SET_INT(eidcls, extInputDevice, numButtons, b->num_buttons);
          canGenerate |= rfbGIIButtonPressMask | rfbGIIButtonReleaseMask;
          break;
        }

        case ValuatorClass:
        {
          XValuatorInfoPtr v = (XValuatorInfoPtr)classInfo;
          jclass valcls;

          bailif0(valcls = (*env)->FindClass(env,
                  "com/turbovnc/rfb/ExtInputDevice$Valuator"));

          if (v->mode == Absolute)
            canGenerate |= rfbGIIValuatorAbsoluteMask;
          else if (v->mode == Relative)
            canGenerate |= rfbGIIValuatorRelativeMask;

          for (ai = 0; ai < v->num_axes; ai++) {
            jobject valuator;
            XAxisInfoPtr a = &v->axes[ai];
            char longName[75], shortName[5];

            bailif0(valuator = (*env)->AllocObject(env, valcls));
            SET_INT(valcls, valuator, index, ai);
            snprintf(longName, 75, "Valuator %d", ai);
            SET_STRING(valcls, valuator, longName, longName);
            snprintf(shortName, 5, "%d", ai);
            SET_STRING(valcls, valuator, shortName, shortName);
            SET_INT(valcls, valuator, rangeMin, a->min_value);
            SET_INT(valcls, valuator, rangeCenter,
                    (a->min_value + a->max_value) / 2);
            SET_INT(valcls, valuator, rangeMax, a->max_value);
            SET_INT(valcls, valuator, siUnit, rfbGIIUnitLength);
            SET_INT(valcls, valuator, siDiv, a->resolution);

            bailif0(mid = (*env)->GetMethodID(env, eidcls, "addValuator",
                    "(Lcom/turbovnc/rfb/ExtInputDevice$Valuator;)V"));
            (*env)->CallVoidMethod(env, extInputDevice, mid, valuator);
          }
          break;
        }
      }
      classInfo = (XAnyClassPtr)((char *)classInfo + classInfo->length);
    }

    SET_LONG(eidcls, extInputDevice, canGenerate, canGenerate);
    if (canGenerate & rfbGIIValuatorAbsoluteMask)
      SET_BOOL(eidcls, extInputDevice, absolute, 1);

    if ((device = XOpenDevice(dpy, devInfo[i].id)) == NULL)
      _throw("Could not open XI device");

    for (ci = 0; ci < device->num_classes; ci++) {
      if (device->classes[ci].input_class == ButtonClass) {
        DeviceButtonPress(device, buttonPressType, events[nEvents]);
        nEvents++;
        DeviceButtonRelease(device, buttonReleaseType, events[nEvents]);
        nEvents++;
      } else if (device->classes[ci].input_class == ValuatorClass) {
        DeviceMotionNotify(device, motionType, events[nEvents]);
        nEvents++;
      }
    }
    XCloseDevice(dpy, device);  device=NULL;

    bailif0(mid = (*env)->GetMethodID(env, cls, "addInputDevice",
            "(Lcom/turbovnc/rfb/ExtInputDevice;)V"));
    (*env)->CallVoidMethod(env, obj, mid, extInputDevice);
  }

  XFreeDeviceList(devInfo);  devInfo = NULL;
  if (nEvents == 0) {
    printf("No extended input devices.\n");
    goto bailout;
  }

  if (XSelectExtensionEvent(dpy, win, events, nEvents))
    _throw("Could not select XI events");

  SET_INT(cls, obj, buttonPressType, buttonPressType);
  SET_INT(cls, obj, buttonReleaseType, buttonReleaseType);
  SET_INT(cls, obj, motionType, motionType);
  SET_LONG(cls, obj, x11dpy, (jlong)dpy);

  printf("TurboVNC Helper: Listening for XInput events on %s (window 0x%.8x)\n",
         DisplayString(dpy), (unsigned int)win);

  bailout:
  if (dpy && device) XCloseDevice(dpy, device);
  if (devInfo) XFreeDeviceList(devInfo);
}
Exemple #22
0
void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    input_thread_t* pInput = (input_thread_t*) p_obj;

    assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );

    if( !getIntf()->p_sys->p_input )
    {
        msg_Dbg( getIntf(), "new input %p detected", pInput );

        getIntf()->p_sys->p_input = pInput;
        vlc_object_hold( pInput );

        // update global variables pertaining to this input
        update_current_input();

        // ensure the playtree is also updated
        // (highlights the new item to be played back)
        getPlaytreeVar().onUpdateCurrent( true );
    }

    switch( newVal.i_int )
    {
        case INPUT_EVENT_STATE:
        {
            int state = var_GetInteger( pInput, "state" );
            SET_BOOL( m_cVarStopped, false );
            SET_BOOL( m_cVarPlaying, state != PAUSE_S );
            SET_BOOL( m_cVarPaused, state == PAUSE_S );
            break;
        }

        case INPUT_EVENT_POSITION:
        {
            float pos = var_GetFloat( pInput, "position" );
            SET_STREAMTIME( m_cVarTime, pos, false );
            SET_BOOL( m_cVarSeekable, pos != 0.0 );
            break;
        }

        case INPUT_EVENT_RATE:
        {
            float rate = var_GetFloat( pInput, "rate" );
            char* buffer;
            if( asprintf( &buffer, "%.3g", rate ) != -1 )
            {
                SET_TEXT( m_cVarSpeed, UString( getIntf(), buffer ) );
                free( buffer );
            }
            break;
        }

        case INPUT_EVENT_ES:
        {
            // Do we have audio
            vlc_value_t audio_es;
            var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
                            &audio_es, NULL );
            SET_BOOL( m_cVarHasAudio, audio_es.i_int > 0 );
            break;
        }

        case INPUT_EVENT_VOUT:
        {
            vout_thread_t* pVout = input_GetVout( pInput );
            SET_BOOL( m_cVarHasVout, pVout != NULL );
            if( !pVout || pVout == m_pVout )
            {
                // end of input or vout reuse (nothing to do)
                if( pVout )
                    vlc_object_release( pVout );
                break;
            }
            if( m_pVout )
            {
                // remove previous Vout callbacks
                var_DelCallback( m_pVout, "mouse-moved",
                                 onGenericCallback, this );
                vlc_object_release( m_pVout );
                m_pVout = NULL;
            }

            // add new Vout callbackx
            var_AddCallback( pVout, "mouse-moved",
                             onGenericCallback, this );
            m_pVout = pVout;
            break;
        }

        case INPUT_EVENT_CHAPTER:
        {
            vlc_value_t chapters_count;
            var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
                        &chapters_count, NULL );
            SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 );
            break;
        }

        case INPUT_EVENT_RECORD:
            SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) );
            break;

        case INPUT_EVENT_DEAD:
            msg_Dbg( getIntf(), "end of input detected for %p", pInput );

            var_DelCallback( pInput, "intf-event", onGenericCallback2, this );
            var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
            var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
            var_DelCallback( pInput, "can-record" , onGenericCallback, this );
            vlc_object_release( pInput );
            getIntf()->p_sys->p_input = NULL;
            reset_input();
            break;

        default:
            break;
    }
}
Exemple #23
0
void VlcProc::setFullscreenVar( bool b_fullscreen )
{
    SET_BOOL( m_cVarFullscreen, b_fullscreen );
}
Exemple #24
0
void VlcProc::on_mute_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    (void)p_obj;
    SET_BOOL( m_cVarMute, newVal.b_bool );
}
Exemple #25
0
void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
    input_thread_t* pInput = (input_thread_t*) p_obj;

    assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );

    if( !getIntf()->p_sys->p_input )
    {
        msg_Dbg( getIntf(), "new input %p detected", pInput );

        getIntf()->p_sys->p_input = pInput;
        vlc_object_hold( pInput );
    }

    switch( newVal.i_int )
    {
        case INPUT_EVENT_STATE:
        {
            int state = var_GetInteger( pInput, "state" );
            SET_BOOL( m_cVarStopped, false );
            SET_BOOL( m_cVarPlaying, state != PAUSE_S );
            SET_BOOL( m_cVarPaused, state == PAUSE_S );
            break;
        }

        case INPUT_EVENT_POSITION:
        {
            float pos = var_GetFloat( pInput, "position" );
            SET_STREAMTIME( m_cVarTime, pos, false );
            SET_BOOL( m_cVarSeekable, pos != 0.0 );
            break;
        }

        case INPUT_EVENT_RATE:
        {
            float rate = var_GetFloat( pInput, "rate" );
            char* buffer;
            if( asprintf( &buffer, "%.3g", rate ) != -1 )
            {
                SET_TEXT( m_cVarSpeed, UString( getIntf(), buffer ) );
                free( buffer );
            }
            break;
        }

        case INPUT_EVENT_ES:
        {
            // Do we have audio
            vlc_value_t audio_es;
            var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
                            &audio_es, NULL );
            SET_BOOL( m_cVarHasAudio, audio_es.i_int > 0 );
            break;
        }

        case INPUT_EVENT_VOUT:
        {
            vout_thread_t* pVout = input_GetVout( pInput );
            SET_BOOL( m_cVarHasVout, pVout != NULL );
            if( !pVout || pVout == m_pVout )
            {
                // end of input or vout reuse (nothing to do)
                if( pVout )
                    vlc_object_release( pVout );
                break;
            }
            if( m_pVout )
            {
                // remove previous Vout callbacks
                var_DelCallback( m_pVout, "mouse-moved",
                                 onGenericCallback, this );
                vlc_object_release( m_pVout );
                m_pVout = NULL;
            }

            // add new Vout callbackx
            var_AddCallback( pVout, "mouse-moved",
                             onGenericCallback, this );
            m_pVout = pVout;
            break;
        }

        case INPUT_EVENT_AOUT:
        {
            audio_output_t* pAout = input_GetAout( pInput );

            // end of input or aout reuse (nothing to do)
            if( !pAout || pAout == m_pAout )
            {
                if( pAout )
                    vlc_object_release( pAout );
                break;
            }

            // remove previous Aout if any
            if( m_pAout )
            {
                var_DelCallback( m_pAout, "audio-filter",
                                 onGenericCallback, this );
                if( m_bEqualizer_started )
                {
                    var_DelCallback( m_pAout, "equalizer-bands",
                                     onEqBandsChange, this );
                    var_DelCallback( m_pAout, "equalizer-preamp",
                                     onEqPreampChange, this );
                }
                vlc_object_release( m_pAout );
                m_pAout = NULL;
                m_bEqualizer_started = false;
            }

            // New Aout (addCallbacks)
            var_AddCallback( pAout, "audio-filter", onGenericCallback, this );

            char *pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
            bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
            free( pFilters );
            SET_BOOL( m_cVarEqualizer, b_equalizer );
            if( b_equalizer )
            {
                var_AddCallback( pAout, "equalizer-bands",
                              onEqBandsChange, this );
                var_AddCallback( pAout, "equalizer-preamp",
                              onEqPreampChange, this );
                m_bEqualizer_started = true;
            }
            m_pAout = pAout;
            break;
        }

        case INPUT_EVENT_CHAPTER:
        {
            vlc_value_t chapters_count;
            var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
                        &chapters_count, NULL );
            SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 );
            break;
        }

        case INPUT_EVENT_RECORD:
            SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) );
            break;

        case INPUT_EVENT_DEAD:
            msg_Dbg( getIntf(), "end of input detected for %p", pInput );

            var_DelCallback( pInput, "intf-event", onGenericCallback2, this );
            var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
            var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
            var_DelCallback( pInput, "can-record" , onGenericCallback, this );
            vlc_object_release( pInput );
            getIntf()->p_sys->p_input = NULL;
            reset_input();
            break;

        default:
            break;
    }
}