this patch works like a charm. it should officially be added to the merge branch. my only suggestion would probably be to make the seek variable (like in mplayer, where you add the amount of seek (with +/- sign to state the direction))
On Wed, 2005-04-13 at 19:46 -0500, James Cotton wrote: > I saw a patch for lirc a few weeks ago on the list, and i modified it > so it applies to the rhythmbox-playbin-merge tree. It is attached. I > also created a image of this tree for the less patching-inclined > people: > http://www.limeybrit.com/files/rhythmbox-playbin-merge-lirc-2005-04-13.tar.bz2 > > It works on my computer, let me know if there are any problems. I > also attached my file .lirc file for it. > > I have two questions. I would like to make it so the up and down > buttons could toggle through playlists. Any RB hackers want to > suggest to me where to start to look for that? > > Also as far as I can tell there is a bug somewhere in the aclocal > configurations for RB. Whenever I run configure I get this error: > > config.status: creating rhythmbox.spec > config.status: creating config.h > config.status: executing intltool commands > sed: -e expression #5, char 24: unknown option to `s' > sed: -e expression #5, char 24: unknown option to `s' > sed: -e expression #5, char 24: unknown option to `s' > config.status: executing depfiles commands > config.status: executing default-1 commands > configure: Rhythmbox was configured with the followin > > which I have tracked down to this code in the configure script: > intltool_edit="-e 's:@INTLTOOL_EXTRACT@:`pwd`/intltool-extract:g' \ > -e 's:@INTLTOOL_ICONV@:${ICONV}:g' \ > -e 's:@INTLTOOL_MSGFMT@:${MSGFMT}:g' \ > -e 's:@INTLTOOL_MSGMERGE@:${MSGMERGE}:g' \ > -e 's:@INTLTOOL_XGETTEXT@:${XGETTEXT}:g' \ > -e 's:@INTLTOOL_PERL@:${INTLTOOL_PERL}:g'" > > The XGETTEXT variable gets set to : and then the sed command is not > correct. Manually deleting this variable so the string doesn't have > the extra ':' fixes the problem, but I don't know how to fix it so > autogen doesn't always mess it up (and I figure sometimes it's meant > to have a value). This line comes from aclocal.m4 but I don't know > how that stuff works to know where that comes from. I have two > computers, one on gnome 2.10 and one on gnome 2.8 (both gentoo) so I > don't think it's outdated software on my part. Any suggestions? > > James > > --- rhythmbox-playbin-merge-2005-03-31/configure.ac 2005-03-25 > 18:34:08.000000000 -0600 > +++ rhythmbox-playbin-merge-lirc-2005-04-13/configure.ac > 2005-04-13 19:09:55.000000000 -0500 > @@ -149,12 +149,24 @@ > fi > > > -dnl AC_CHECK_LIB(lirc_client, lirc_init, > -dnl [ AC_CHECK_HEADER(lirc/lirc_client.h, > -dnl [ RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS -llirc_client" > -dnl AC_DEFINE(HAVE_REMOTE)] > -dnl ,,) ] ,) > > +dnl Check for lirc > + > +AC_ARG_ENABLE(lirc, AC_HELP_STRING([--enable-lirc], > + [build with lirc support])) > +if test x"$enable_lirc" = xyes; then > + AC_CHECK_HEADER(lirc/lirc_client.h,[enable_lirc=yes],[enable_lirc=no]) > + if test x"$enable_lirc" = xyes; then > + > AC_CHECK_LIB(lirc_client,lirc_init,[enable_lirc=yes],[enable_lirc=no]) > + fi > + if test x"$enable_lirc" = xyes; then > + RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS -llirc_client" > + AC_DEFINE(HAVE_REMOTE,1,[Define if you have lirc support]) > + else > + AC_MSG_ERROR([Cannot find lirc on your system]) > + fi > +fi > +AM_CONDITIONAL(HAVE_REMOTE, test x"$enable_lirc" = xyes) > > dnl Check for Musicbrainz > dnl DISABLED > @@ -452,6 +464,11 @@ > else > AC_MSG_NOTICE([ D-BUS control/activation disabled]) > fi > +if test x"$enable_lirc" = xyes; then > + AC_MSG_NOTICE([** lirc remote support enabled]) > +else > + AC_MSG_NOTICE([ lirc remote support disabled]) > +fi > > dnl if test "x$enable_audiocd" != "xyes"; then > dnl AC_MSG_NOTICE([ Audio CD support is disabled]) > --- rhythmbox-playbin-merge-2005-03-31/shell/rb-remote.c > 2005-03-25 12:51:37.000000000 -0600 > +++ rhythmbox-playbin-merge-lirc-2005-04-13/shell/rb-remote.c > 2005-04-13 19:09:54.000000000 -0500 > @@ -26,7 +26,7 @@ > > #include "rb-remote.h" > > -#ifdef HAVE_REMOTE > +// #ifdef HAVE_REMOTE > > #include <stdio.h> > #include <lirc/lirc_client.h> > @@ -34,6 +34,7 @@ > /* strings that we recognize as commands from lirc */ > #define RB_IR_COMMAND_PLAY "play" > #define RB_IR_COMMAND_PAUSE "pause" > +#define RB_IR_COMMAND_STOP "stop" > #define RB_IR_COMMAND_SHUFFLE "shuffle" > #define RB_IR_COMMAND_REPEAT "repeat" > #define RB_IR_COMMAND_NEXT "next" > @@ -43,7 +44,6 @@ > #define RB_IR_COMMAND_VOLUME_UP "volume_up" > #define RB_IR_COMMAND_VOLUME_DOWN "volume_down" > #define RB_IR_COMMAND_MUTE "mute" > -#define RB_IR_COMMAND_QUIT "quit" > > struct _RBRemote { > GObject parent; > @@ -67,6 +67,8 @@ > return RB_REMOTE_COMMAND_PLAY; > else if (strcmp (str, RB_IR_COMMAND_PAUSE) == 0) > return RB_REMOTE_COMMAND_PAUSE; > + else if (strcmp (str, RB_IR_COMMAND_STOP) == 0) > + return RB_REMOTE_COMMAND_STOP; > else if (strcmp (str, RB_IR_COMMAND_SHUFFLE) == 0) > return RB_REMOTE_COMMAND_SHUFFLE; > else if (strcmp (str, RB_IR_COMMAND_REPEAT) == 0) > @@ -85,8 +87,6 @@ > return RB_REMOTE_COMMAND_VOLUME_DOWN; > else if (strcmp (str, RB_IR_COMMAND_MUTE) == 0) > return RB_REMOTE_COMMAND_MUTE; > - else if (strcmp (str, RB_IR_COMMAND_QUIT) == 0) > - return RB_REMOTE_COMMAND_QUIT; > else > return RB_REMOTE_COMMAND_UNKNOWN; > } > @@ -254,4 +254,4 @@ > return g_object_new (RB_TYPE_REMOTE, NULL); > } > > -#endif /* HAVE_REMOTE */ > +// #endif /* HAVE_REMOTE */ > --- rhythmbox-playbin-merge-2005-03-31/shell/rb-remote.h > 2005-03-25 12:51:37.000000000 -0600 > +++ rhythmbox-playbin-merge-lirc-2005-04-13/shell/rb-remote.h > 2005-04-13 19:09:54.000000000 -0500 > @@ -40,6 +40,7 @@ > RB_REMOTE_COMMAND_UNKNOWN, > RB_REMOTE_COMMAND_PLAY, > RB_REMOTE_COMMAND_PAUSE, > + RB_REMOTE_COMMAND_STOP, > RB_REMOTE_COMMAND_SHUFFLE, > RB_REMOTE_COMMAND_REPEAT, > RB_REMOTE_COMMAND_NEXT, > @@ -49,7 +50,6 @@ > RB_REMOTE_COMMAND_VOLUME_UP, > RB_REMOTE_COMMAND_VOLUME_DOWN, > RB_REMOTE_COMMAND_MUTE, > - RB_REMOTE_COMMAND_QUIT > } RBRemoteCommand; > > typedef struct > --- rhythmbox-playbin-merge-2005-03-31/shell/rb-shell-player.c > 2005-03-30 07:48:09.000000000 -0600 > +++ rhythmbox-playbin-merge-lirc-2005-04-13/shell/rb-shell-player.c > 2005-04-13 19:09:54.000000000 -0500 > @@ -152,6 +152,10 @@ > > static gboolean rb_shell_player_jump_to_current_idle (RBShellPlayer *player); > > +#ifdef HAVE_REMOTE > +static void button_pressed_cb (RBRemote *remote, RBRemoteCommand cmd, > gpointer data); > +#endif /* HAVE_REMOTE */ > + > #ifdef HAVE_MMKEYS > static void grab_mmkey (int key_code, GdkWindow *root); > static GdkFilterReturn filter_mmkeys (GdkXEvent *xevent, > @@ -225,6 +229,7 @@ > GtkWidget *magic_button; > > RBRemote *remote; > + float muted_volume; > > guint gconf_play_order_id; > guint gconf_state_id; > @@ -652,6 +657,17 @@ > (GConfClientNotifyFunc) > rb_shell_player_volume_changed_cb, > player); > > +#ifdef HAVE_REMOTE > + /* Enable lirc remote support */ > + player->priv->remote = rb_remote_new (); > + player->priv->muted_volume = -1; > + > + g_signal_connect_object (G_OBJECT (player->priv->remote), > + "button_pressed", > + G_CALLBACK (button_pressed_cb), > + player, 0); > +#endif /* HAVE_REMOTE */ > + > #ifdef HAVE_MMKEYS > /* Enable Multimedia Keys */ > rb_shell_player_init_mmkeys (player); > @@ -2214,6 +2230,98 @@ > return shell_player->priv->url; > } > > +#ifdef HAVE_REMOTE > +static void > +button_pressed_cb (RBRemote *remote, RBRemoteCommand cmd, gpointer data) > +{ > + long time; > + float volume; > + RBPlayer *mmplayer; > + RBShellPlayer *player = RB_SHELL_PLAYER (data); > + > + switch (cmd) > + { > + case RB_REMOTE_COMMAND_PLAY: > + rb_shell_player_cmd_play (NULL, player); > + break; > + case RB_REMOTE_COMMAND_PAUSE: > + rb_shell_player_cmd_pause (NULL, player); > + break; > + case RB_REMOTE_COMMAND_STOP: > + rb_shell_player_cmd_stop (NULL, player); > + break; > + case RB_REMOTE_COMMAND_SHUFFLE: > + rb_shell_player_shuffle_changed_cb (NULL, player); > + break; > + case RB_REMOTE_COMMAND_REPEAT: > + rb_shell_player_repeat_changed_cb (NULL, player); > + break; > + case RB_REMOTE_COMMAND_NEXT: > + rb_shell_player_cmd_next (NULL, player); > + break; > + case RB_REMOTE_COMMAND_PREVIOUS: > + rb_shell_player_cmd_previous (NULL, player); > + break; > + case RB_REMOTE_COMMAND_SEEK_FORWARD: > + time = rb_shell_player_get_playing_time (player) + 10; > + rb_shell_player_set_playing_time (player, time); > + break; > + case RB_REMOTE_COMMAND_SEEK_BACKWARD: > + time = rb_shell_player_get_playing_time (player) - 10; > + > + if (time < 0) > + time = 0; > + > + rb_shell_player_set_playing_time (player, time); > + break; > + case RB_REMOTE_COMMAND_VOLUME_UP: > + mmplayer = rb_shell_player_get_mm_player (player); > + volume = rb_player_get_volume (mmplayer) + .1; > + > + if (volume > 1.0) > + volume = 1.0; > + > + if (player->priv->muted_volume == -1) { > + rb_player_set_volume (mmplayer, volume); > + } else { > + rb_player_set_volume (mmplayer, > player->priv->muted_volume); > + player->priv->muted_volume = -1; > + } > + > + break; > + case RB_REMOTE_COMMAND_VOLUME_DOWN: > + mmplayer = rb_shell_player_get_mm_player (player); > + volume = rb_player_get_volume (mmplayer) - .1; > + > + if (volume < 0.0) > + volume = 0.0; > + > + if (player->priv->muted_volume == -1) { > + rb_player_set_volume (mmplayer, volume); > + } else { > + rb_player_set_volume (mmplayer, > player->priv->muted_volume); > + player->priv->muted_volume = -1; > + } > + > + break; > + case RB_REMOTE_COMMAND_MUTE: > + mmplayer = rb_shell_player_get_mm_player (player); > + > + if (player->priv->muted_volume == -1) { > + player->priv->muted_volume = > rb_player_get_volume (mmplayer); > + rb_player_set_volume (mmplayer, 0.0); > + } else { > + rb_player_set_volume (mmplayer, > player->priv->muted_volume); > + player->priv->muted_volume = -1; > + } > + > + break; > + case RB_REMOTE_COMMAND_UNKNOWN: > + break; > + } > +} > +#endif /* HAVE_REMOTE */ > + > #ifdef HAVE_MMKEYS > static void > grab_mmkey (int key_code, GdkWindow *root) > _______________________________________________ > rhythmbox-devel mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/rhythmbox-devel _______________________________________________ rhythmbox-devel mailing list [email protected] http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
