components/preferences.cpp \
components/open.cpp \
components/playlist/standardpanel.cpp \
+ components/video_widget.cpp \
util/input_slider.cpp
$(NULL)
components/preferences.hpp \
components/open.hpp \
components/playlist/panels.hpp \
+ components/video_widget.hpp \
util/input_slider.hpp \
ui/input_stats.ui \
pixmaps/advanced.xpm \
--- /dev/null
+/*****************************************************************************
+ * video_widget.cpp : Embedded video output
+ ****************************************************************************
+ * Copyright (C) 2000-2005 the VideoLAN team
+ * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc/vout.h>
+#include "qt4.hpp"
+#include "components/video_widget.hpp"
+#include "main_interface.hpp"
+
+static void *DoRequest( intf_thread_t *, vout_thread_t *, int*,int*,
+ unsigned int *, unsigned int * );
+static void DoRelease( intf_thread_t *, void * );
+static int DoControl( intf_thread_t *, void *, int, va_list );
+
+
+VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QWidget( NULL ),
+ p_intf( _p_i )
+{
+ vlc_mutex_init( p_intf, &lock );
+
+ p_intf->pf_request_window = ::DoRequest;
+ p_intf->pf_release_window = ::DoRelease;
+ p_intf->pf_control_window = ::DoControl;
+ p_intf->p_sys->p_video = this;
+ p_vout = NULL;
+
+ i_video_width = i_video_height = 1;
+ setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
+}
+
+VideoWidget::~VideoWidget()
+{
+ vlc_mutex_lock( &lock );
+ if( p_vout )
+ {
+ if( !p_intf->psz_switch_intf )
+ {
+ if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
+ vout_Control( p_vout, VOUT_REPARENT );
+ }
+ else
+ {
+ if( vout_Control( p_vout, VOUT_REPARENT ) != VLC_SUCCESS )
+ vout_Control( p_vout, VOUT_CLOSE );
+ }
+ }
+ p_intf->pf_request_window = NULL;
+ p_intf->pf_release_window = NULL;
+ p_intf->pf_control_window = NULL;
+ vlc_mutex_unlock( &lock );
+ vlc_mutex_destroy( &lock );
+}
+
+QSize VideoWidget::sizeHint() const
+{
+ return QSize( i_video_width, i_video_height );
+}
+
+static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
+ int *pi1, int *pi2, unsigned int*pi3,unsigned int*pi4)
+{
+ return p_intf->p_sys->p_video->Request( p_vout, pi1, pi2, pi3, pi4 );
+}
+
+void *VideoWidget::Request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
+ unsigned int *pi_width, unsigned int *pi_height )
+{
+ if( p_vout )
+ {
+ msg_Dbg( p_intf, "embedded video already in use" );
+ return NULL;
+ }
+ p_vout = p_nvout;
+
+ fprintf( stderr, "[Before update] MI constraints %ix%i -> %ix%i\n",
+ p_intf->p_sys->p_mi->minimumSize().width(),
+ p_intf->p_sys->p_mi->minimumSize().height(),
+ p_intf->p_sys->p_mi->maximumSize().width(),
+ p_intf->p_sys->p_mi->maximumSize().height() );
+
+ i_video_width = *pi_width;
+ i_video_height = *pi_height;
+ updateGeometry();
+ p_intf->p_sys->p_mi->setMinimumSize(
+ p_intf->p_sys->p_mi->i_saved_width,
+ p_intf->p_sys->p_mi->i_saved_height );
+ p_intf->p_sys->p_mi->resize( p_intf->p_sys->p_mi->sizeHint() );
+
+ fprintf( stderr, "[After update] MI constraints %ix%i -> %ix%i\n",
+ p_intf->p_sys->p_mi->minimumSize().width(),
+ p_intf->p_sys->p_mi->minimumSize().height(),
+ p_intf->p_sys->p_mi->maximumSize().width(),
+ p_intf->p_sys->p_mi->maximumSize().height() );
+
+ return (void*)winId();
+}
+
+static void DoRelease( intf_thread_t *p_intf, void *p_win )
+{
+ return p_intf->p_sys->p_video->Release( p_win );
+}
+
+void VideoWidget::Release( void *p_win )
+{
+ i_video_height = i_video_width = 1;
+ fprintf( stderr, "[Before R update] MI constraints %ix%i -> %ix%i\n",
+ p_intf->p_sys->p_mi->minimumSize().width(),
+ p_intf->p_sys->p_mi->minimumSize().height(),
+ p_intf->p_sys->p_mi->maximumSize().width(),
+ p_intf->p_sys->p_mi->maximumSize().height() );
+
+ updateGeometry();
+ p_intf->p_sys->p_mi->setMinimumSize( p_intf->p_sys->p_mi->sizeHint() );
+ p_intf->p_sys->p_mi->resize( p_intf->p_sys->p_mi->sizeHint() );
+
+ fprintf( stderr, "[After R update] MI constraints %ix%i -> %ix%i\n",
+ p_intf->p_sys->p_mi->minimumSize().width(),
+ p_intf->p_sys->p_mi->minimumSize().height(),
+ p_intf->p_sys->p_mi->maximumSize().width(),
+ p_intf->p_sys->p_mi->maximumSize().height() );
+
+ p_vout = NULL;
+}
+
+
+static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a )
+{
+ return p_intf->p_sys->p_video->Control( p_win, i_q, a );
+}
+
+int VideoWidget::Control( void *p_window, int i_query, va_list args )
+{
+ int i_ret = VLC_EGENERIC;
+ vlc_mutex_lock( &lock );
+ switch( i_query )
+ {
+ case VOUT_GET_SIZE:
+ {
+ unsigned int *pi_width = va_arg( args, unsigned int * );
+ unsigned int *pi_height = va_arg( args, unsigned int * );
+ *pi_width = frame->width();
+ *pi_height = frame->height();
+ i_ret = VLC_SUCCESS;
+ break;
+ }
+ case VOUT_SET_SIZE:
+ {
+ unsigned int i_width = va_arg( args, unsigned int );
+ unsigned int i_height = va_arg( args, unsigned int );
+
+ if( !i_width && p_vout ) i_width = p_vout->i_window_width;
+ if( !i_height && p_vout ) i_height = p_vout->i_window_height;
+
+ frame->resize( i_width, i_height );
+ i_ret = VLC_SUCCESS;
+ break;
+ }
+ case VOUT_SET_STAY_ON_TOP:
+ {
+ /// \todo
+ break;
+ }
+ default:
+ msg_Warn( p_intf, "unsupported control query" );
+ break;
+ }
+ vlc_mutex_unlock( &lock );
+ return i_ret;
+}
--- /dev/null
+/*****************************************************************************
+ * video_widget.hpp : Embedded video
+ ****************************************************************************
+ * Copyright (C) 2000-2005 the VideoLAN team
+ * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef _VIDEO_H_
+#define _VIDEO_H_
+
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
+#include <QWidget>
+
+class VideoWidget : public QWidget
+{
+public:
+ VideoWidget( intf_thread_t *);
+ virtual ~VideoWidget();
+
+ virtual QSize sizeHint() const;
+
+ void *Request( vout_thread_t *, int *, int *,
+ unsigned int *, unsigned int * );
+ void Release( void * );
+ int Control( void *, int, va_list );
+ int i_video_height, i_video_width;
+private:
+ QWidget *frame;
+ intf_thread_t *p_intf;
+ vout_thread_t *p_vout;
+ vlc_mutex_t lock;
+
+};
+
+#endif
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+#include "qt4.hpp"
#include "main_interface.hpp"
#include "input_manager.hpp"
#include "util/input_slider.hpp"
#include "util/qvlcframe.hpp"
#include "dialogs_provider.hpp"
+#include "components/video_widget.hpp"
#include <QCloseEvent>
#include <assert.h>
#include <QPushButton>
-MainInterface::MainInterface( intf_thread_t *_p_intf ) : QMainWindow(), p_intf( _p_intf )
+MainInterface::MainInterface( intf_thread_t *_p_intf ) : QMainWindow(),
+ p_intf( _p_intf )
{
/* All UI stuff */
QVLCFrame::fixStyle( this );
ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
ui.volHighLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
- resize( QSize( 450, 80 ) );
+
+// if( config_GetInt( p_intf, "embedded" ) )
+ {
+ videoWidget = new VideoWidget( p_intf );
+ videoWidget->resize( 1,1 );
+ ui.vboxLayout->insertWidget( 0, videoWidget );
+ }
+ resize( QSize( 500, 121 ) );
+ i_saved_width = width();
+ i_saved_height = height();
//QVLCMenu::createMenuBar();
{
}
+QSize MainInterface::sizeHint() const
+{
+ int i_width = __MAX( i_saved_width, p_intf->p_sys->p_video->i_video_width );
+ return QSize( i_width, i_saved_height +
+ p_intf->p_sys->p_video->i_video_height );
+}
+
void MainInterface::stop()
{
- /// \todo store playlist globally
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist ) return;
- playlist_Stop( p_playlist );
- vlc_object_release( p_playlist );
+ playlist_Stop( THEPL );
}
void MainInterface::play()
{
- /// \todo store playlist globally
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist ) return;
- playlist_Play( p_playlist );
- vlc_object_release( p_playlist );
+ playlist_Play( THEPL );
}
void MainInterface::prev()
{
- /// \todo store playlist globally
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist ) return;
- playlist_Prev( p_playlist );
- vlc_object_release( p_playlist );
+ playlist_Prev( THEPL );
}
void MainInterface::next()
{
- /// \todo store playlist globally
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist ) return;
- playlist_Next( p_playlist );
- vlc_object_release( p_playlist );
+ playlist_Next( THEPL );
}
-
-
-
-
-
void MainInterface::setDisplay( float pos, int time, int length )
{
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
class InputManager;
class QCloseEvent;
class InputSlider;
+class VideoWidget;
class MainInterface : public QMainWindow
{
public:
MainInterface( intf_thread_t *);
virtual ~MainInterface();
+
+ virtual QSize sizeHint() const;
+
+ int i_saved_width, i_saved_height;
+
protected:
void closeEvent( QCloseEvent *);
private:
+ VideoWidget *videoWidget;
InputManager *main_input_manager;
InputSlider *slider;
/// Main input associated to the playlist
input_thread_t *p_input;
intf_thread_t *p_intf;
-
Ui::MainInterfaceUI ui;
private slots:
void setDisplay( float, int, int );
{
if( ( !b_input && i_cached_id == i_id) ||
( b_input && i_cached_input_id ==i_id ) )
+ {
return b_input ? p_cached_item_bi : p_cached_item;
+ }
if( !b_input && root->i_id == i_id )
{
else if( b_input && (*it)->i_input_id == i_id )
{
ICACHE( i_id, (*it) );
+ return p_cached_item_bi;
}
if( (*it)->children.size() )
{
}
it++;
}
+ fprintf( stderr, "Never found" );
return NULL;
}
#undef CACHE
p_intf->p_sys = (intf_sys_t *)malloc(sizeof( intf_sys_t ) );
memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
+ p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
+ VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if( !p_intf->p_sys->p_playlist )
+ return VLC_EGENERIC;
+
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
return VLC_SUCCESS;
p_intf->b_dead = VLC_TRUE;
vlc_mutex_unlock( &p_intf->object_lock );
+ vlc_object_release( p_intf->p_sys->p_playlist );
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
free( p_intf->p_sys );
}
p_mi->show();
}
-
if( p_intf->pf_show_dialog )
vlc_thread_ready( p_intf );
class QApplication;
class MainInterface;
class DialogsProvider;
-
+class VideoWidget;
struct intf_sys_t
{
QApplication *p_app;
MainInterface *p_mi;
-
+ playlist_t *p_playlist;
msg_subscription_t *p_sub; ///< Subscription to the message bank
+
+ VideoWidget *p_video;
+ int i_saved_height, i_saved_width;
};
+#define THEPL p_intf->p_sys->p_playlist
+
static int DialogEvent_Type = QEvent::User + 1;
class DialogEvent : public QEvent
<rect>
<x>0</x>
<y>0</y>
- <width>428</width>
- <height>79</height>
+ <width>444</width>
+ <height>80</height>
</rect>
</property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle" >
<string>VLC media player</string>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
- <vsizetype>5</vsizetype>
+ <vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
- <vsizetype>5</vsizetype>
+ <vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>