[vlc-devel] Code cleanup and feature. libvlc_media_list_player_set_playback_mode

Lennart Moerkens lennart at ironlegend.student.utwente.nl
Wed Jul 27 00:01:11 CEST 2011


hello,

When I was looking for a way to add playing in random mode to
libvlc_media_list_player_set_playback_mode
I noticed some not necessary variables. So here is the patch that should
fix that, in preparation for libvlc_playback_mode_random

Any help or advice is of course welcome, I'm just starting to poke around
the vlc code now.

Lennart

-- 
--The quieter you become, the more you hear.--
--Any sufficiently advanced technology is indistinguishable from magic.--
--Whoever said 'nothing is impossible' never tried slamming a revolving
door.--
-------------- next part --------------
From 1b581853a0b17f2b68060d2e449722e69b8003ac Mon Sep 17 00:00:00 2001
From: Lennart Moerkens <lennart at ironlegend.student.utwente.nl>
Date: Tue, 26 Jul 2011 23:29:32 +0200
Subject: [PATCH] Code cleanup: un needed variable.
 Signed-off-by: Lennart Moerkens <lennart at ironlegend.student.utwente.nl>

---
 src/control/media_list_player.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/control/media_list_player.c b/src/control/media_list_player.c
index 343866b..6954b8a 100644
--- a/src/control/media_list_player.c
+++ b/src/control/media_list_player.c
@@ -132,7 +132,7 @@ static inline libvlc_event_manager_t * mplayer_em(libvlc_media_list_player_t * p
  *  the list it will return the first item in the list.
  **************************************************************************/
 static libvlc_media_list_path_t
-get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
+get_next_path(libvlc_media_list_player_t * p_mlp )
 {
     assert_locked(p_mlp);
 
@@ -176,7 +176,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
         depth--;
         if (depth <= 0)
         {
-            if(b_loop)
+			if(p_mlp->e_playback_mode == libvlc_playback_mode_loop)
             {
                 ret[0] = 0;
                 ret[1] = -1;
@@ -241,7 +241,7 @@ find_last_item( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t current_
  *  the list it will return the last descendant of the last item in the list.
  **************************************************************************/
 static libvlc_media_list_path_t
-get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
+get_previous_path(libvlc_media_list_player_t * p_mlp)
 {
     assert_locked(p_mlp);
 
@@ -282,7 +282,7 @@ get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
         if (depth <= 0)
         {
             // Is looping enabled?
-            if(b_loop)
+            if(p_mlp->e_playback_mode == libvlc_playback_mode_loop)
             {
                 int i_count = libvlc_media_list_count(p_parent_of_playing_item);
 
@@ -733,13 +733,11 @@ static int set_relative_playlist_position_and_play(
 
     if(p_mlp->e_playback_mode != libvlc_playback_mode_repeat)
     {
-        bool b_loop = (p_mlp->e_playback_mode == libvlc_playback_mode_loop);
-
         if(i_relative_position > 0)
         {
             do
             {
-                path = get_next_path(p_mlp, b_loop);
+                path = get_next_path(p_mlp);
                 set_current_playing_item(p_mlp, path);
                 --i_relative_position;
             }
@@ -749,7 +747,7 @@ static int set_relative_playlist_position_and_play(
         {
             do
             {
-                path = get_previous_path(p_mlp, b_loop);
+                path = get_previous_path(p_mlp);
                 set_current_playing_item(p_mlp, path);
                 ++i_relative_position;
             }
-- 
1.7.0.4



More information about the vlc-devel mailing list