Commit 0c6e14df authored by Jean-Paul Saman's avatar Jean-Paul Saman

PDA Interface:

- Fixed last segmentation fault.
- Slider and time progress updating.

This makes the new PDA interface almost complete. It misses the following items still:
- preference panel
- changing postion in stream with slider widget.

The missing items above will move to the next release of VLC. Now testing and package building for iPAQ will begin. I expect to have a package at the end of the week.
parent 8c4be749
......@@ -2,7 +2,7 @@
* pda.c : PDA Gtk2 plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: pda.c,v 1.16 2003/12/04 10:25:47 gbazin Exp $
* $Id: pda.c,v 1.17 2003/12/06 22:41:40 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* Marc Ariberti <marcari@videolan.org>
......@@ -49,7 +49,7 @@ static void Run ( intf_thread_t * );
void GtkAutoPlayFile ( vlc_object_t * );
static int Manage ( intf_thread_t *p_intf );
void E_(GtkDisplayDate) ( GtkAdjustment *p_adj );
void E_(GtkDisplayDate) ( GtkAdjustment *p_adj, gpointer userdata );
gint E_(GtkModeManage) ( intf_thread_t * p_intf );
/*****************************************************************************
......@@ -190,31 +190,21 @@ static void Run( intf_thread_t *p_intf )
GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
/* Get the slider object */
p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "timeSlider" ) );
p_intf->p_sys->p_slider_label = GTK_LABEL( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "timeLabel" ) );
p_intf->p_sys->p_slider = (GtkHScale*) lookup_widget( p_intf->p_sys->p_window, "timeSlider" );
p_intf->p_sys->p_slider_label = (GtkLabel*) lookup_widget( p_intf->p_sys->p_window, "timeLabel" );
if (p_intf->p_sys->p_slider == NULL)
msg_Err( p_intf, "Time slider widget not found." );
if (p_intf->p_sys->p_slider_label == NULL)
msg_Err( p_intf, "Time label widget not found." );
#if 0
/* Connect the date display to the slider */
msg_Dbg( p_intf, "setting slider adjustment ... " );
#define P_SLIDER GTK_RANGE( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), "timeSlider" ) )
p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );
p_intf->p_sys->p_adj = gtk_range_get_adjustment( GTK_RANGE(p_intf->p_sys->p_slider) );
if (p_intf->p_sys->p_adj == NULL)
msg_Err( p_intf, "Adjustment range not found." );
gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL );
g_signal_connect( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
G_CALLBACK( E_(GtkDisplayDate) ), p_intf );
p_intf->p_sys->f_adj_oldvalue = 0;
p_intf->p_sys->i_adj_oldvalue = 0;
#undef P_SLIDER
msg_Dbg( p_intf, "setting slider adjustment ... done" );
#endif
/* BEGIN OF FILEVIEW GTK_TREE_VIEW */
p_intf->p_sys->p_tvfile = NULL;
......@@ -449,6 +439,7 @@ static int Manage( intf_thread_t *p_intf )
}
/* Manage the slider */
#define p_area p_input->stream.p_selected_area
if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
{
/* Manage the slider for CPU_CAPABILITY_FPU hardware */
......@@ -456,7 +447,6 @@ static int Manage( intf_thread_t *p_intf )
{
float newvalue = p_intf->p_sys->p_adj->value;
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
......@@ -465,7 +455,7 @@ static int Manage( intf_thread_t *p_intf )
p_intf->p_sys->p_adj->value =
p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
......@@ -482,7 +472,6 @@ static int Manage( intf_thread_t *p_intf )
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
}
#undef p_area
}
}
else
......@@ -492,7 +481,6 @@ static int Manage( intf_thread_t *p_intf )
{
off_t newvalue = p_intf->p_sys->p_adj->value;
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->i_adj_oldvalue )
......@@ -501,7 +489,7 @@ static int Manage( intf_thread_t *p_intf )
p_intf->p_sys->p_adj->value =
p_intf->p_sys->i_adj_oldvalue =
( 100 * p_area->i_tell ) / p_area->i_size;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
......@@ -518,9 +506,9 @@ static int Manage( intf_thread_t *p_intf )
/* Update the old value */
p_intf->p_sys->i_adj_oldvalue = newvalue;
}
#undef p_area
}
}
#undef p_area
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
......@@ -554,13 +542,14 @@ static int Manage( intf_thread_t *p_intf )
* the stream. It is called whenever the slider changes its value.
* The lock has to be taken before you call the function.
*****************************************************************************/
void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
void E_(GtkDisplayDate)( GtkAdjustment *p_adj, gpointer userdata )
{
intf_thread_t *p_intf;
p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
p_intf = (intf_thread_t*) userdata;
if (p_intf == NULL)
return;
#ifdef WIN32
if( p_intf->p_sys->p_input )
{
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
......@@ -571,7 +560,6 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
( p_area->i_size * p_adj->value ) / 100 ) );
#undef p_area
}
#endif
}
/*****************************************************************************
......@@ -582,15 +570,15 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
*****************************************************************************/
gint E_(GtkModeManage)( intf_thread_t * p_intf )
{
GtkWidget * p_slider;
GtkWidget * p_slider = NULL;
vlc_bool_t b_control;
#define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
p_intf->p_sys->ptr ) , ( name ) ) )
/* hide slider */
p_slider = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "slider" ) );
gtk_widget_hide( GTK_WIDGET( p_slider ) );
if ( p_intf->p_sys->p_window == NULL )
msg_Err( p_intf, "Main widget not found" );
p_slider = lookup_widget( p_intf->p_sys->p_window, "timeSlider");
if (p_slider == NULL)
msg_Err( p_intf, "Slider widget not found" );
/* controls unavailable */
b_control = 0;
......@@ -601,15 +589,13 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
/* initialize and show slider for seekable streams */
if( p_intf->p_sys->p_input->stream.b_seekable )
{
msg_Dbg( p_intf, "Updating slider widget" );
if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
else
p_intf->p_sys->p_adj->value = p_intf->p_sys->i_adj_oldvalue = 0;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
gtk_widget_show( GTK_WIDGET( p_slider ) );
}
else
{
/* hide slider */
gtk_widget_hide( GTK_WIDGET( p_slider ) );
}
/* control buttons for free pace streams */
b_control = p_intf->p_sys->p_input->stream.b_pace_control;
......@@ -619,11 +605,9 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
}
/* set control items */
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbRewind"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbPause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbForward"), b_control );
#undef GETWIDGET
gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbRewind"), b_control );
gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbPause"), b_control );
gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbForward"), b_control );
return TRUE;
}
......@@ -151,11 +151,12 @@
<property name="draw_value">False</property>
<property name="value_pos">GTK_POS_RIGHT</property>
<property name="digits">3</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
<property name="inverted">False</property>
<property name="adjustment">3 0 100 1 6.25 0</property>
<property name="adjustment">0 0 100 1 6.25 0</property>
<signal name="button_release_event" handler="SliderRelease" last_modification_time="Fri, 26 Sep 2003 12:28:09 GMT"/>
<signal name="button_press_event" handler="SliderPress" last_modification_time="Fri, 26 Sep 2003 12:28:14 GMT"/>
<signal name="move_slider" handler="SliderMove" last_modification_time="Sat, 06 Dec 2003 22:37:00 GMT"/>
</widget>
<packing>
<property name="padding">4</property>
......@@ -1809,7 +1810,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">huffyuv</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
......@@ -2150,7 +2151,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">127.0.0.1</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
......@@ -2221,7 +2222,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">ps</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
......@@ -2346,7 +2347,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">alaw</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
......@@ -2543,7 +2544,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">udp</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
......
......@@ -2,7 +2,7 @@
* pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: pda_callbacks.c,v 1.21 2003/11/30 23:19:13 jpsaman Exp $
* $Id: pda_callbacks.c,v 1.22 2003/12/06 22:41:40 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -431,6 +431,7 @@ gboolean SliderRelease(GtkWidget *widget, GdkEventButton *event, gpointer user_d
{
intf_thread_t *p_intf = GtkGetIntf( widget );
msg_Dbg( p_intf, "SliderButton Release" );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 1;
vlc_mutex_unlock( &p_intf->change_lock );
......@@ -443,6 +444,7 @@ gboolean SliderPress(GtkWidget *widget, GdkEventButton *event, gpointer user_dat
{
intf_thread_t *p_intf = GtkGetIntf( widget );
msg_Dbg( p_intf, "SliderButton Press" );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 0;
vlc_mutex_unlock( &p_intf->change_lock );
......@@ -450,6 +452,13 @@ gboolean SliderPress(GtkWidget *widget, GdkEventButton *event, gpointer user_dat
return TRUE;
}
void SliderMove(GtkRange *range, GtkScrollType scroll, gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( range );
msg_Dbg( p_intf, "SliderButton Move" );
}
void addSelectedToPlaylist(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer *userdata)
{
......@@ -1081,7 +1090,7 @@ void onEntryStdAccessChanged(GtkEditable *editable, gpointer user_data)
GtkCheckButton *p_checkSAP = NULL;
GtkCheckButton *p_checkSLP = NULL;
GtkEntry *p_entryStdAccess = NULL;
const gchar *p_std_access;
const gchar *p_std_access = NULL;
gboolean b_announce = FALSE;
p_entryStdAccess = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryStdAccess" );
......
......@@ -2,7 +2,7 @@
* callbacks.h : pda plugin for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: pda_callbacks.h,v 1.10 2003/11/30 23:19:13 jpsaman Exp $
* $Id: pda_callbacks.h,v 1.11 2003/12/06 22:41:40 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -148,3 +148,9 @@ onAddTranscodeToPlaylist (GtkButton *button,
void
onEntryStdAccessChanged (GtkEditable *editable,
gpointer user_data);
void
SliderMove (GtkRange *range,
GtkScrollType scroll,
gpointer user_data);
......@@ -309,13 +309,14 @@ create_pda (void)
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), timeLabel, NULL, NULL);
timeSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (3, 0, 100, 1, 6.25, 0)));
timeSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 6.25, 0)));
gtk_widget_set_name (timeSlider, "timeSlider");
gtk_widget_show (timeSlider);
gtk_box_pack_start (GTK_BOX (vbox), timeSlider, FALSE, TRUE, 4);
gtk_scale_set_draw_value (GTK_SCALE (timeSlider), FALSE);
gtk_scale_set_value_pos (GTK_SCALE (timeSlider), GTK_POS_RIGHT);
gtk_scale_set_digits (GTK_SCALE (timeSlider), 3);
gtk_range_set_update_policy (GTK_RANGE (timeSlider), GTK_UPDATE_DISCONTINUOUS);
notebook = gtk_notebook_new ();
gtk_widget_set_name (notebook, "notebook");
......@@ -893,7 +894,6 @@ create_pda (void)
entryVideoCodec = GTK_COMBO (comboVideoCodec)->entry;
gtk_widget_set_name (entryVideoCodec, "entryVideoCodec");
gtk_widget_show (entryVideoCodec);
gtk_entry_set_text (GTK_ENTRY (entryVideoCodec), _("huffyuv"));
gtk_entry_set_activates_default (GTK_ENTRY (entryVideoCodec), TRUE);
labelVideoBitrate = gtk_label_new (_("Video Bitrate:"));
......@@ -1003,7 +1003,6 @@ create_pda (void)
entryStdURL = GTK_COMBO (comboStdURL)->entry;
gtk_widget_set_name (entryStdURL, "entryStdURL");
gtk_widget_show (entryStdURL);
gtk_entry_set_text (GTK_ENTRY (entryStdURL), _("127.0.0.1"));
gtk_entry_set_activates_default (GTK_ENTRY (entryStdURL), TRUE);
comboStdMuxer = gtk_combo_new ();
......@@ -1028,7 +1027,6 @@ create_pda (void)
entryStdMuxer = GTK_COMBO (comboStdMuxer)->entry;
gtk_widget_set_name (entryStdMuxer, "entryStdMuxer");
gtk_widget_show (entryStdMuxer);
gtk_entry_set_text (GTK_ENTRY (entryStdMuxer), _("ps"));
gtk_entry_set_activates_default (GTK_ENTRY (entryStdMuxer), TRUE);
entryAudioBitrate_adj = gtk_adjustment_new (256, 0, 65535, 1, 10, 10);
......@@ -1061,7 +1059,6 @@ create_pda (void)
entryAudioCodec = GTK_COMBO (comboAudioCodec)->entry;
gtk_widget_set_name (entryAudioCodec, "entryAudioCodec");
gtk_widget_show (entryAudioCodec);
gtk_entry_set_text (GTK_ENTRY (entryAudioCodec), _("alaw"));
gtk_entry_set_activates_default (GTK_ENTRY (entryAudioCodec), TRUE);
checkVideoDeinterlace = gtk_check_button_new_with_mnemonic (_("enable"));
......@@ -1131,7 +1128,6 @@ create_pda (void)
entryStdAccess = GTK_COMBO (comboStdAccess)->entry;
gtk_widget_set_name (entryStdAccess, "entryStdAccess");
gtk_widget_show (entryStdAccess);
gtk_entry_set_text (GTK_ENTRY (entryStdAccess), _("udp"));
gtk_entry_set_activates_default (GTK_ENTRY (entryStdAccess), TRUE);
labelSAP = gtk_label_new (_("SAP Announce:"));
......@@ -1371,6 +1367,9 @@ create_pda (void)
g_signal_connect ((gpointer) timeSlider, "button_press_event",
G_CALLBACK (SliderPress),
NULL);
g_signal_connect ((gpointer) timeSlider, "move_slider",
G_CALLBACK (SliderMove),
NULL);
g_signal_connect ((gpointer) tvFileList, "row_activated",
G_CALLBACK (onFileListRow),
NULL);
......
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