Qt4 (and a bunch of other GUIs, I suspect) needs to reference the audio
output properly, but they don't. As such, we need to keep the loosy,
slow and broken vlc_object_get() usage.
This reverts commit
7f120f79a85567bcd5ff484c03a15d15a9b11cdb.
* Definitions of variables for the dynamic menus
*****************************************************************************/
#define PUSH_VAR( var ) varnames.push_back( var ); \
* Definitions of variables for the dynamic menus
*****************************************************************************/
#define PUSH_VAR( var ) varnames.push_back( var ); \
- objects.push_back( p_object )
+ objects.push_back( p_object->i_object_id )
#define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
#define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
- objects.push_back( NULL ); varnames.push_back( "" ); \
+ objects.push_back( 0 ); varnames.push_back( "" ); \
i_last_separator = objects.size(); }
static int InputAutoMenuBuilder( vlc_object_t *p_object,
i_last_separator = objects.size(); }
static int InputAutoMenuBuilder( vlc_object_t *p_object,
- vector<vlc_object_t *> &objects,
vector<const char *> &varnames )
{
PUSH_VAR( "bookmark" );
vector<const char *> &varnames )
{
PUSH_VAR( "bookmark" );
}
static int VideoAutoMenuBuilder( vlc_object_t *p_object,
}
static int VideoAutoMenuBuilder( vlc_object_t *p_object,
- vector<vlc_object_t *> &objects,
vector<const char *> &varnames )
{
PUSH_VAR( "fullscreen" );
vector<const char *> &varnames )
{
PUSH_VAR( "fullscreen" );
}
static int AudioAutoMenuBuilder( vlc_object_t *p_object,
}
static int AudioAutoMenuBuilder( vlc_object_t *p_object,
- vector<vlc_object_t *> &objects,
vector<const char *> &varnames )
{
PUSH_VAR( "audio-device" );
vector<const char *> &varnames )
{
PUSH_VAR( "audio-device" );
**/
QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
{
**/
QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
{
- vector<vlc_object_t *> objects;
vector<const char *> varnames;
/** \todo add "switch to XXX" */
varnames.push_back( "intf-add" );
vector<const char *> varnames;
/** \todo add "switch to XXX" */
varnames.push_back( "intf-add" );
- objects.push_back( VLC_OBJECT(p_intf) );
+ objects.push_back( p_intf->i_object_id );
QMenu *submenu = new QMenu( current );
QMenu *menu = Populate( p_intf, submenu, varnames, objects );
QMenu *submenu = new QMenu( current );
QMenu *menu = Populate( p_intf, submenu, varnames, objects );
*/
QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
{
*/
QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
{
- vector<vlc_object_t *> objects;
vector<const char *> varnames;
vlc_object_t *p_object = ( vlc_object_t * )vlc_object_find( p_intf,
vector<const char *> varnames;
vlc_object_t *p_object = ( vlc_object_t * )vlc_object_find( p_intf,
QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
{
vlc_object_t *p_object;
QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
{
vlc_object_t *p_object;
- vector<vlc_object_t *> objects;
vector<const char *> varnames;
p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_INPUT,
vector<const char *> varnames;
p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_INPUT,
QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
{
vlc_object_t *p_object;
QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
{
vlc_object_t *p_object;
- vector<vlc_object_t *> objects;
vector<const char *> varnames;
p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_INPUT,
vector<const char *> varnames;
p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_INPUT,
*****************************************************************************/
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
*****************************************************************************/
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
- vector<vlc_object_t *> objects; \
vector<const char *> varnames; \
input_thread_t *p_input = THEMIM->getInput();
vector<const char *> varnames; \
input_thread_t *p_input = THEMIM->getInput();
{
vlc_object_yield( p_input );
varnames.push_back( "video-es" );
{
vlc_object_yield( p_input );
varnames.push_back( "video-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
varnames.push_back( "spu-es" );
varnames.push_back( "spu-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
vlc_object_yield( p_input );
varnames.push_back( "audio-es" );
{
vlc_object_yield( p_input );
varnames.push_back( "audio-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
/* Audio menu */
PUSH_SEPARATOR;
varnames.push_back( "audio-es" );
/* Audio menu */
PUSH_SEPARATOR;
varnames.push_back( "audio-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = ( vlc_object_t * )
vlc_object_find( p_input, VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
vlc_object_t *p_aout = ( vlc_object_t * )
vlc_object_find( p_input, VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
/* Video menu */
PUSH_SEPARATOR;
varnames.push_back( "video-es" );
/* Video menu */
PUSH_SEPARATOR;
varnames.push_back( "video-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
varnames.push_back( "spu-es" );
varnames.push_back( "spu-es" );
- objects.push_back( VLC_OBJECT(p_input) );
+ objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = ( vlc_object_t * )
vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
vlc_object_t *p_vout = ( vlc_object_t * )
vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
QMenu *current,
vector< const char *> & varnames,
QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
QMenu *current,
vector< const char *> & varnames,
- vector<vlc_object_t *> & objects,
bool append )
{
QMenu *menu = current;
bool append )
{
QMenu *menu = current;
+ if( objects[i] == 0 )
+ {
+ /// \bug What is this ?
+ // Append( menu, varnames[i], NULL );
+ b_section_empty = false;
+ continue;
+ }
+
+ p_object = ( vlc_object_t * )vlc_object_get( objects[i] );
if( p_object == NULL ) continue;
b_section_empty = false;
if( p_object == NULL ) continue;
b_section_empty = false;
CreateItem( menu, varnames[i], p_object, false );
else
CreateItem( menu, varnames[i], p_object, true );
CreateItem( menu, varnames[i], p_object, false );
else
CreateItem( menu, varnames[i], p_object, true );
+ vlc_object_release( p_object );
}
/* Special case for empty menus */
}
/* Special case for empty menus */
case VLC_VAR_VOID:
var_Get( p_object, psz_var, &val );
CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
case VLC_VAR_VOID:
var_Get( p_object, psz_var, &val );
CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
- p_object, val, i_type );
+ p_object->i_object_id, val, i_type );
break;
case VLC_VAR_BOOL:
var_Get( p_object, psz_var, &val );
val.b_bool = !val.b_bool;
CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
break;
case VLC_VAR_BOOL:
var_Get( p_object, psz_var, &val );
val.b_bool = !val.b_bool;
CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
- p_object, val, i_type, !val.b_bool );
+ p_object->i_object_id, val, i_type, !val.b_bool );
break;
}
FREENULL( text.psz_string );
break;
}
FREENULL( text.psz_string );
another_val.psz_string = strdup( CURVAL.psz_string );
menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
another_val.psz_string = strdup( CURVAL.psz_string );
menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
- p_object, another_val, i_type,
+ p_object->i_object_id, another_val, i_type,
NOTCOMMAND && val.psz_string &&
!strcmp( val.psz_string, CURVAL.psz_string ) );
NOTCOMMAND && val.psz_string &&
!strcmp( val.psz_string, CURVAL.psz_string ) );
if( CURTEXT ) menutext = qfu( CURTEXT );
else menutext.sprintf( "%d", CURVAL.i_int );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
if( CURTEXT ) menutext = qfu( CURTEXT );
else menutext.sprintf( "%d", CURVAL.i_int );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
- p_object, CURVAL, i_type,
+ p_object->i_object_id, CURVAL, i_type,
NOTCOMMAND && CURVAL.i_int == val.i_int );
break;
NOTCOMMAND && CURVAL.i_int == val.i_int );
break;
if( CURTEXT ) menutext = qfu( CURTEXT );
else menutext.sprintf( "%.2f", CURVAL.f_float );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
if( CURTEXT ) menutext = qfu( CURTEXT );
else menutext.sprintf( "%.2f", CURVAL.f_float );
CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
- p_object, CURVAL, i_type,
+ p_object->i_object_id, CURVAL, i_type,
NOTCOMMAND && CURVAL.f_float == val.f_float );
break;
NOTCOMMAND && CURVAL.f_float == val.f_float );
break;
void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
QString text, QString help,
void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
QString text, QString help,
- int i_item_type, vlc_object_t *object,
+ int i_item_type, int i_object_id,
vlc_value_t val, int i_val_type,
bool checked )
{
vlc_value_t val, int i_val_type,
bool checked )
{
{
action->setChecked( true );
}
{
action->setChecked( true );
}
- MenuItemData *itemData = new MenuItemData( object, i_val_type,
+ MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type,
val, psz_var );
CONNECT( action, triggered(), THEDP->menusMapper, map() );
THEDP->menusMapper->setMapping( action, itemData );
val, psz_var );
CONNECT( action, triggered(), THEDP->menusMapper, map() );
THEDP->menusMapper->setMapping( action, itemData );
void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
{
MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
{
MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
- var_Set( itemData->obj, itemData->psz_var, itemData->val );
+ vlc_object_t *p_object = ( vlc_object_t * )vlc_object_get( itemData->i_object_id );
+ if( p_object == NULL ) return;
+
+ var_Set( p_object, itemData->psz_var, itemData->val );
+ vlc_object_release( p_object );
- MenuItemData( vlc_object_t *_obj, int _i_type, vlc_value_t _val,
- const char *_var )
+ MenuItemData( int i_id, int _i_type, vlc_value_t _val, const char *_var )
i_val_type = _i_type;
val = _val;
psz_var = strdup( _var );
i_val_type = _i_type;
val = _val;
psz_var = strdup( _var );
if( ( i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING )
free( val.psz_string );
}
if( ( i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING )
free( val.psz_string );
}
int i_val_type;
vlc_value_t val;
char *psz_var;
int i_val_type;
vlc_value_t val;
char *psz_var;
private:
/* Generic automenu methods */
static QMenu * Populate( intf_thread_t *, QMenu *current,
private:
/* Generic automenu methods */
static QMenu * Populate( intf_thread_t *, QMenu *current,
- vector<const char*>&, vector<vlc_object_t *>&,
+ vector<const char*>&, vector<int>&,
bool append = false );
static void CreateAndConnect( QMenu *, const char *, QString, QString,
bool append = false );
static void CreateAndConnect( QMenu *, const char *, QString, QString,
- int, vlc_object_t *, vlc_value_t, int,
- bool c = false );
+ int, int, vlc_value_t, int, bool c = false );
static void CreateItem( QMenu *, const char *, vlc_object_t *, bool );
static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool );
};
static void CreateItem( QMenu *, const char *, vlc_object_t *, bool );
static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool );
};