Commit 374571ac authored by Antoine Lejeune's avatar Antoine Lejeune Committed by Rémi Denis-Courmont

A new GUI for Maemo based on Hildon framework

Signed-off-by: default avatarRémi Denis-Courmont <rdenis@simphalempin.com>
parent 4b07d84d
......@@ -358,7 +358,7 @@ endif
# Building aliases
###############################################################################
ALL_ALIASES = cvlc rvlc svlc wxvlc qvlc nvlc
ALL_ALIASES = cvlc rvlc svlc wxvlc qvlc nvlc mvlc
bin_SCRIPTS = $(ALIASES)
CLEANFILES += $(ALIASES) $(noinst_SCRIPTS)
EXTRA_SCRIPTS = $(ALL_ALIASES)
......@@ -385,6 +385,9 @@ qvlc: make-alias
nvlc: make-alias
$(MKALIAS) ncurses
mvlc: make-alias
$(MKALIAS) maemo
if BUILD_VLC
noinst_SCRIPTS += vlc$(EXEEXT)
endif
......
......@@ -4848,6 +4848,28 @@ then
fi
AM_CONDITIONAL(BUILD_PDA, [test "${enable_pda}" = "yes"])
dnl
dnl Maemo
dnl
AC_ARG_ENABLE(maemo,
[ --enable-maemo Internet tablets based on Maemo SDK (default disabled)])
if test "${enable_maemo}" != "no"
then
PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
VLC_ADD_CFLAGS([maemo],[${HILDON_CFLAGS}])
VLC_ADD_LIBS([maemo],[${HILDON_LIBS}])
VLC_ADD_PLUGIN([maemo])
AC_DEFINE([BUILD_MAEMO], 1, [Define if you're using Maemo interfaces])
ALIASES="${ALIASES} mvlc"
], [
AS_IF([test "${enable_maemo}" = "yes"],[
AC_MSG_ERROR([Hildon libraries not found])
])
enable_maemo="no"
])
fi
AM_CONDITIONAL(BUILD_MAEMO, [test "${enable_maemo}" = "yes"])
dnl
dnl QT 4
dnl
......@@ -5796,6 +5818,7 @@ AC_CONFIG_FILES([
modules/gui/beos/Makefile
modules/gui/pda/Makefile
modules/gui/macosx/Makefile
modules/gui/maemo/Makefile
modules/gui/minimal_macosx/Makefile
modules/gui/qnx/Makefile
modules/gui/qt4/Makefile
......
DIST_SUBDIRS = beos macosx minimal_macosx pda qnx qt4 skins2 wince
DIST_SUBDIRS = beos macosx maemo minimal_macosx pda qnx qt4 skins2 wince
SUBDIRS =
if HAVE_BEOS
......@@ -7,6 +7,9 @@ endif
if HAVE_DARWIN
SUBDIRS += macosx minimal_macosx
endif
if BUILD_MAEMO
SUBDIRS += maemo
endif
if BUILD_PDA
SUBDIRS += pda
endif
......
SOURCES_maemo = maemo.c \
maemo.h \
maemo_callbacks.c \
maemo_callbacks.h \
maemo_input.c \
maemo_input.h \
maemo_interface.c \
maemo_interface.h
This diff is collapsed.
/*****************************************************************************
* maemo.h: private Maemo Interface Description
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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 <hildon/hildon-program.h>
#include <hildon/hildon-seekbar.h>
#include <hildon/hildon-file-chooser-dialog.h>
#include <hildon/hildon-banner.h>
#include <vlc_playlist.h>
#include <vlc_input.h>
#include <vlc_vout.h>
struct intf_sys_t
{
playlist_t *p_playlist;
input_thread_t *p_input;
HildonWindow *p_main_window;
HildonSeekbar *p_seekbar;
GtkWidget *p_tabs;
GtkWidget *p_play_button;
GtkWidget *p_playlist_store;
int i_event;
vlc_spinlock_t event_lock;
GtkWidget *p_video_window;
vout_thread_t *p_vout;
vlc_cond_t p_video_cond;
vlc_mutex_t p_video_mutex;
};
/*****************************************************************************
* maemo_callbacks.c : Callbacks for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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_common.h>
#include "maemo.h"
#include "maemo_callbacks.h"
/*
* Function used to retrieve an intf_thread_t object from a GtkWidget
*/
static intf_thread_t *get_intf_from_widget( GtkWidget *widget )
{
if( GTK_IS_MENU_ITEM( widget ) )
{
/* Look for a GTK_MENU */
while( widget->parent && !GTK_IS_MENU( widget ) )
{
widget = widget->parent;
}
widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
}
widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) );
return (intf_thread_t *)gtk_object_get_data( GTK_OBJECT( widget ),
"p_intf" );
}
gboolean delete_event_cb( GtkWidget *widget,
GdkEvent *event,
gpointer user_data )
{
(void)event; (void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( widget );
vlc_mutex_lock( &p_intf->change_lock );
vlc_object_kill( p_intf->p_libvlc );
vlc_mutex_unlock( &p_intf->change_lock );
gtk_main_quit();
return TRUE;
}
void play_cb( GtkButton *button, gpointer user_data )
{
(void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) );
// If there is no input, we ask the playlist to play
if( p_intf->p_sys->p_input == NULL )
{
playlist_Play( p_intf->p_sys->p_playlist );
return;
}
// If there is an input, we toggle its state
vlc_value_t state;
var_Get( p_intf->p_sys->p_input, "state", &state );
state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
var_Set( p_intf->p_sys->p_input, "state", state );
}
void stop_cb( GtkButton *button, gpointer user_data )
{
(void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) );
playlist_Stop( p_intf->p_sys->p_playlist );
}
void prev_cb( GtkButton *button, gpointer user_data )
{
(void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) );
playlist_Prev( p_intf->p_sys->p_playlist );
}
void next_cb( GtkButton *button, gpointer user_data )
{
(void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) );
playlist_Next( p_intf->p_sys->p_playlist );
}
void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll,
gdouble value, gpointer data )
{
(void)scroll; (void)data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( range ) );
if( p_intf->p_sys->p_input )
{
int i_length = hildon_seekbar_get_total_time( p_intf->p_sys->p_seekbar );
var_SetFloat( p_intf->p_sys->p_input, "position", (float)(value/i_length) );
}
}
void pl_row_activated_cb( GtkTreeView *tree_view , GtkTreePath *path,
GtkTreeViewColumn *column, gpointer user_data )
{
(void)column; (void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( tree_view ) );
input_item_t *p_input;
GtkTreeModel *model = gtk_tree_view_get_model( tree_view );
GtkTreeIter iter;
gchar *filename = NULL;
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_model_get( model, &iter, 0, &filename, -1 );
gtk_notebook_set_current_page( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), 0 );
p_input = input_item_New( p_intf, filename, NULL );
playlist_AddInput( p_intf->p_sys->p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, false );
vlc_gc_decref( p_input );
}
void open_cb( GtkMenuItem *menuitem, gpointer user_data )
{
(void)menuitem;
intf_thread_t *p_intf = (intf_thread_t *)user_data;
input_item_t *p_input;
GtkWidget *dialog;
char *psz_filename = NULL;
dialog = hildon_file_chooser_dialog_new( GTK_WINDOW( p_intf->p_sys->p_main_window ),
GTK_FILE_CHOOSER_ACTION_OPEN );
gtk_widget_show_all( GTK_WIDGET( dialog ) );
if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_OK )
{
psz_filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) );
}
else
{
gtk_widget_destroy( dialog );
return;
}
gtk_widget_destroy( dialog );
p_input = input_item_New( p_intf, psz_filename, NULL );
playlist_AddInput( p_intf->p_sys->p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END, true, false );
vlc_gc_decref( p_input );
}
void open_address_cb( GtkMenuItem *menuitem, gpointer user_data )
{
(void)menuitem;
intf_thread_t *p_intf = (intf_thread_t *)user_data;
input_item_t *p_input;
GtkWidget *dialog, *hbox, *label, *entry;
dialog = gtk_dialog_new_with_buttons( "Open Address",
GTK_WINDOW( p_intf->p_sys->p_main_window ),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL );
label = gtk_label_new( "Address :" );
entry = gtk_entry_new();
gtk_entry_set_width_chars( GTK_ENTRY( entry ), 30 );
hbox = gtk_hbox_new( FALSE, 0 );
gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 );
gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), hbox );
gtk_widget_show_all( dialog );
if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_CANCEL )
{
gtk_widget_destroy( dialog );
return;
}
p_input = input_item_New( p_intf,
gtk_entry_get_text( GTK_ENTRY( entry ) ),
NULL );
playlist_AddInput( p_intf->p_sys->p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END, true, false );
vlc_gc_decref( p_input );
gtk_widget_destroy( dialog );
}
void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data )
{
(void)menuitem;
intf_thread_t *p_intf = (intf_thread_t *)user_data;
input_item_t *p_input;
p_input = input_item_New( p_intf, "v4l2://", NULL );
playlist_AddInput( p_intf->p_sys->p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END, true, false );
vlc_gc_decref( p_input );
}
void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data )
{
(void)menuitem;
intf_thread_t *p_intf = (intf_thread_t *)user_data;
if( !p_intf->p_sys->p_vout )
{
hildon_banner_show_information(
GTK_WIDGET( p_intf->p_sys->p_main_window ),
"gtk-dialog-error",
"There is no video" );
return;
}
vout_Control( p_intf->p_sys->p_vout, VOUT_SNAPSHOT );
hildon_banner_show_information( GTK_WIDGET( p_intf->p_sys->p_main_window ),
NULL,
"Snapshot taken" );
}
void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data )
{
intf_thread_t *p_intf = (intf_thread_t *)user_data;
if( gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM( menuitem ) ) )
config_PutInt( p_intf, "ffmpeg-skip-frame", 1 );
else
config_PutInt( p_intf, "ffmpeg-skip-frame", 0 );
}
/*****************************************************************************
* maemo_callbacks.h : Callbacks header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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 <gtk/gtk.h>
#include <vlc_common.h>
#include <vlc_interface.h>
gboolean delete_event_cb( GtkWidget *widget,
GdkEvent *event,
gpointer user_data );
void play_cb( GtkButton *button, gpointer user_data );
void stop_cb( GtkButton *button, gpointer user_data );
void prev_cb( GtkButton *button, gpointer user_data );
void next_cb( GtkButton *button, gpointer user_data );
void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll,
gdouble value, gpointer data );
void pl_row_activated_cb( GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *,
gpointer );
void open_cb( GtkMenuItem *menuitem, gpointer user_data );
void open_address_cb( GtkMenuItem *menuitem, gpointer user_data );
void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data );
void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data );
void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data );
/*****************************************************************************
* maemo_input.c : Input handling for the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include "maemo.h"
#include "maemo_input.h"
gboolean process_events( gpointer data )
{
intf_thread_t *p_intf = (intf_thread_t *)data;
vlc_spin_lock( &p_intf->p_sys->event_lock );
int i_event = p_intf->p_sys->i_event;
p_intf->p_sys->i_event = 0;
vlc_spin_unlock( &p_intf->p_sys->event_lock );
if( i_event )
{
if( i_event & EVENT_PLAYLIST_CURRENT )
item_changed_pl( p_intf );
if( i_event & EVENT_ACTIVITY )
item_changed_pl( p_intf );
if( i_event & EVENT_ITEM_CHANGED )
item_changed( p_intf );
if( i_event & EVENT_INTF_CHANGED )
update_position( p_intf );
}
return TRUE;
}
void set_input( intf_thread_t *p_intf, input_thread_t *p_input )
{
if( p_input && !( p_input->b_die || p_input->b_dead ) )
{
p_intf->p_sys->p_input = p_input;
vlc_object_hold( p_input );
var_AddCallback( p_input, "intf-change", interface_changed_cb, p_intf );
var_AddCallback( p_input, "state", item_changed_cb, p_intf );
// "Activate" the seekbar
gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), TRUE );
}
else
p_intf->p_sys->p_input = NULL;
}
void delete_input( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_input )
{
var_DelCallback( p_intf->p_sys->p_input, "intf-change",
interface_changed_cb, p_intf );
var_DelCallback( p_intf->p_sys->p_input, "state",
item_changed_cb, p_intf );
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
// Reset the seekbar
hildon_seekbar_set_position( p_intf->p_sys->p_seekbar, 0 );
gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), FALSE );
}
}
void item_changed_pl( intf_thread_t *p_intf )
{
vlc_mutex_lock( &p_intf->change_lock );
if( p_intf->p_sys->p_input &&
( p_intf->p_sys->p_input->b_dead || p_intf->p_sys->p_input->b_die ) )
{
delete_input( p_intf );
vlc_mutex_unlock( &p_intf->change_lock );
return;
}
if( !p_intf->p_sys->p_input )
{
set_input( p_intf, playlist_CurrentInput( p_intf->p_sys->p_playlist ) );
}
vlc_mutex_unlock( &p_intf->change_lock );
return;
}
int playlist_current_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
(void)p_this; (void)psz_var; (void)oldval; (void)newval;
intf_thread_t *p_intf = (intf_thread_t *)param;
vlc_spin_lock( &p_intf->p_sys->event_lock );
p_intf->p_sys->i_event |= EVENT_PLAYLIST_CURRENT;
vlc_spin_unlock( &p_intf->p_sys->event_lock );
return VLC_SUCCESS;
}
int activity_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
(void)p_this; (void)psz_var; (void)oldval; (void)newval;
intf_thread_t *p_intf = (intf_thread_t *)param;
vlc_spin_lock( &p_intf->p_sys->event_lock );
p_intf->p_sys->i_event |= EVENT_ACTIVITY;
vlc_spin_unlock( &p_intf->p_sys->event_lock );
return VLC_SUCCESS;
}
void item_changed( intf_thread_t *p_intf )
{
GtkButton *p_button = GTK_BUTTON( p_intf->p_sys->p_play_button );
vlc_value_t state;
if( !p_intf->p_sys->p_input )
return;
var_Get( p_intf->p_sys->p_input, "state", &state );
// We change the "play" button
if( state.i_int == PLAYING_S )
gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-pause",
GTK_ICON_SIZE_BUTTON ) );
else
gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-play",
GTK_ICON_SIZE_BUTTON ) );
}
int item_changed_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
(void)p_this; (void)psz_var; (void)oldval; (void)newval;
intf_thread_t *p_intf = (intf_thread_t *)param;
vlc_spin_lock( &p_intf->p_sys->event_lock );
p_intf->p_sys->i_event |= EVENT_ITEM_CHANGED;
vlc_spin_unlock( &p_intf->p_sys->event_lock );
return VLC_SUCCESS;
}
void update_position( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_input )
{
hildon_seekbar_set_total_time( p_intf->p_sys->p_seekbar,
var_GetTime( p_intf->p_sys->p_input, "length" )/1000000 );
hildon_seekbar_set_position( p_intf->p_sys->p_seekbar,
var_GetTime( p_intf->p_sys->p_input, "time" )/1000000 );
}
}
int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
(void)p_this; (void)psz_var; (void)oldval; (void)newval;
intf_thread_t *p_intf = (intf_thread_t *)param;
vlc_spin_lock( &p_intf->p_sys->event_lock );
p_intf->p_sys->i_event |= EVENT_INTF_CHANGED;
vlc_spin_unlock( &p_intf->p_sys->event_lock );
return VLC_SUCCESS;
}
/*****************************************************************************
* maemo_input.h : Input handling header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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 <gtk/gtk.h>
#include <vlc_common.h>
#include <vlc_interface.h>
#define EVENT_ITEM_STATE_CHANGE (1<<0)
#define EVENT_PLAYLIST_CURRENT (1<<1)
#define EVENT_ACTIVITY (1<<2)
#define EVENT_ITEM_CHANGED (1<<3)
#define EVENT_INTF_CHANGED (1<<4)
gboolean process_events( gpointer data );
void set_input( intf_thread_t *p_intf, input_thread_t *p_input );
void delete_input( intf_thread_t *p_intf );
int playlist_current_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param );
int activity_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param );
void item_changed_pl( intf_thread_t *p_intf );
int item_changed_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param );
void item_changed( intf_thread_t *p_intf );
int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param );
void update_position( intf_thread_t *p_intf );
/*****************************************************************************
* maemo_interface.c : Interface creation of the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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_common.h>
#include <gtk/gtk.h>
#include "maemo.h"
#include "maemo_callbacks.h"
#include "maemo_interface.h"
static void scan_maemo_for_media ( intf_thread_t *p_intf );
static void find_media_in_dir ( const char *psz_dir, GList **pp_list );
static const char *ppsz_extensions[] =
{ "aac", "flac", "m4a", "m4p", "mka", "mp1", "mp2", "mp3",
"ogg", "wav", "wma", "asf", "avi", "divx", "flv", "m1v",
"m2v", "m4v", "mkv", "mov", "mpeg", "mpeg1", "mpeg2", "mpeg4",
"mpg", "ogm", "wmv", NULL };
static const char *ppsz_media_dirs[] =
{ "/media/mmc1", "/media/mmc2", "/home/user/MyDocs/.videos", NULL };
#define ADD_MENU_ITEM( label, callback ) \
item = gtk_menu_item_new_with_label( label ); \
gtk_menu_append( main_menu, item ); \
g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( callback ), \
p_intf );
#define ADD_CHECK_MENU_ITEM( label, callback ) \
item = gtk_check_menu_item_new_with_label( label ); \
gtk_menu_append( main_menu, item ); \
g_signal_connect( GTK_OBJECT( item ), "toggled", G_CALLBACK( callback ), \
p_intf );
#define ADD_SEPARATOR \
item = gtk_separator_menu_item_new(); \
gtk_menu_append( main_menu, item );
void create_menu( intf_thread_t *p_intf )
{
/* Needed variables */
GtkWidget *main_menu;
GtkWidget *item;
int i_skip;
/* Creating the main menu */
main_menu = gtk_menu_new();
/* Getting ffmpeg-skip-frame value */
i_skip = config_GetInt( p_intf, "ffmpeg-skip-frame" );
/* Filling the menu */
ADD_MENU_ITEM( "Open", open_cb );
ADD_MENU_ITEM( "Open Address", open_address_cb );
ADD_MENU_ITEM( "Open Webcam", open_webcam_cb );
ADD_SEPARATOR;
ADD_MENU_ITEM( "Take a snapshot", snapshot_cb );
ADD_CHECK_MENU_ITEM( "Drop frames", dropframe_cb );
if( i_skip )
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), true );
ADD_SEPARATOR;
ADD_MENU_ITEM( "Close", delete_event_cb );
hildon_window_set_menu( HILDON_WINDOW( p_intf->p_sys->p_main_window ),
GTK_MENU( main_menu ) );
gtk_widget_show_all( main_menu );
}
#undef ADD_MENU
#undef ADD_CHECK_MENU_ITEM
#undef ADD_SEPARATOR
void create_playlist( intf_thread_t *p_intf )
{
GtkWidget *playlist;
GtkWidget *scroll;
GtkListStore *playlist_store;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
playlist = gtk_tree_view_new();
playlist_store = gtk_list_store_new( 1, G_TYPE_STRING );
p_intf->p_sys->p_playlist_store = GTK_WIDGET( playlist_store );
gtk_tree_view_set_model( GTK_TREE_VIEW( playlist ),
GTK_TREE_MODEL( playlist_store ) );
renderer = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new_with_attributes( "File", renderer,
"text", 0, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( playlist ), col );
g_object_set( playlist, "headers-visible", TRUE, NULL );
scan_maemo_for_media( p_intf );
scroll = gtk_scrolled_window_new( NULL, NULL );
gtk_container_add( GTK_CONTAINER( scroll ), playlist );
gtk_notebook_append_page( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), scroll,
gtk_image_new_from_stock( "vlc-playlist",
GTK_ICON_SIZE_DIALOG ) );
gtk_notebook_set_tab_label_packing( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), scroll,
FALSE, FALSE, GTK_PACK_START );
g_signal_connect( playlist, "row-activated",
G_CALLBACK( pl_row_activated_cb ), NULL );
}
static void scan_maemo_for_media( intf_thread_t *p_intf )
{
GtkListStore *playlist_store = GTK_LIST_STORE( p_intf->p_sys->p_playlist_store );
GList *list = NULL;
GtkTreeIter iter;
for( int i = 0; ppsz_media_dirs[i]; i++ )
{
find_media_in_dir( ppsz_media_dirs[i], &list );
msg_Dbg( p_intf, "Looking for media in %s", ppsz_media_dirs[i] );
}
list = g_list_first( list );
while( list )
{
msg_Dbg( p_intf, "Adding : %s", (char *)list->data );
gtk_list_store_append( playlist_store, &iter );
gtk_list_store_set( playlist_store, &iter,
0, list->data, -1 );
list = g_list_next( list );
}
}
static void find_media_in_dir( const char *psz_dir, GList **pp_list )
{
GDir *dir = NULL;
const gchar *psz_name;
char *psz_path;
dir = g_dir_open( psz_dir, 0, NULL );
if( !dir )
return;
while( ( psz_name = g_dir_read_name( dir ) ) != NULL )
{
psz_path = g_build_path( "/", psz_dir, psz_name, NULL );
if( g_file_test( psz_path, G_FILE_TEST_IS_DIR ) &&
!g_file_test( psz_path, G_FILE_TEST_IS_SYMLINK ) )
find_media_in_dir( psz_path, pp_list );
else
{
char *psz_ext = strrchr( psz_name, '.' );
if( psz_ext )
{
psz_ext++;
for( int i = 0; ppsz_extensions[i]; i++ )
{
if( strcmp( psz_ext, ppsz_extensions[i] ) == 0 )
{
*pp_list = g_list_append( *pp_list, g_strdup( psz_path ) );
break;
}
}
}
}
g_free( psz_path );
}
g_dir_close( dir );
return;
}
/*****************************************************************************
* maemo_interface.h : Interface creation header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@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 <gtk/gtk.h>
#include <vlc_common.h>
void create_menu( intf_thread_t *p_intf );
void create_playlist( intf_thread_t *p_intf );
......@@ -28,7 +28,8 @@ EXTRA_DIST = \
$(DIST_osdmenu_default) \
$(DIST_osdmenu_dvd) \
$(DIST_osdmenu_minimal) \
$(DIST_mozilla)
$(DIST_mozilla) \
$(DIST_maemo)
if BUILD_SKINS
nobase_pkgdata_DATA = skins2/default.vlt
......@@ -56,6 +57,9 @@ if BUILD_MOZILLA
# TODO: move to the mozilla directory
nobase_dist_pkgdata_DATA += $(DIST_mozilla)
endif
if BUILD_MAEMO
nobase_dist_pkgdata_DATA += $(DIST_maemo)
endif
DIST_rsrc = \
newres.h \
......@@ -385,3 +389,27 @@ DIST_mozilla = \
mozilla/volume_max.xpm \
mozilla/volume_mute.xpm \
mozilla/volume_slider_bar.xpm
DIST_maemo = \
maemo/vlc_intf.rc \
maemo/vlc_left_tab_active.png \
maemo/vlc_left_tab_passive.png \
maemo/playlist.png \
maemo/play.png \
maemo/pause.png \
maemo/stop.png \
maemo/previous.png \
maemo/next.png \
maemo/vlc32x32.png
maemo_FILES = \
../modules/gui/qt4/pixmaps/play.png \
../modules/gui/qt4/pixmaps/pause.png \
../modules/gui/qt4/pixmaps/stop.png \
../modules/gui/qt4/pixmaps/previous.png \
../modules/gui/qt4/pixmaps/next.png \
vlc32x32.png
$(DIST_maemo): $(maemo_FILES)
mkdir -p maemo
cp -r $+ maemo
style "videolan-notebook"
{
GtkNotebook::inner_left_border = 0
GtkNotebook::inner_right_border = 0
GtkNotebook::tab-overlap = 0
GtkNotebook::arrow-spacing = 6
GtkNotebook::label-padding = 12
GtkWidget::scroll-arrow-hlength = 20
GtkWidget::scroll-arrow-vlength = 30
engine "sapwood"
{
image
{
function = EXTENSION
state = ACTIVE
file = "vlc_left_tab_passive.png"
border = { 12, 12, 12, 12 }
gap_side = RIGHT
}
image
{
function = EXTENSION
file = "vlc_left_tab_active.png"
border = { 12, 12, 12, 12 }
gap_side = RIGHT
}
}
}
class "GtkNotebook" style "videolan-notebook"
style "videolan"
{
stock["vlc-next"] = {{ "next.png" }}
stock["vlc-previous"] = {{ "previous.png" }}
stock["vlc-stop"] = {{ "stop.png" }}
stock["vlc-play"] = {{ "play.png" }}
stock["vlc-pause"] = {{ "pause.png" }}
stock["vlc-playlist"] = {{ "playlist.png" }}
stock["vlc"] = {{ "vlc32x32.png" }}
}
widget "*" style "videolan"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment