[vlc-commits] demux: playlist: simplify setting duration

Rémi Denis-Courmont git at videolan.org
Sun May 14 21:29:14 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 14 21:38:56 2017 +0300| [72dbf02813d4c2a6cf16eef546be8639b1123ff9] | committer: Rémi Denis-Courmont

demux: playlist: simplify setting duration

The input item needs not be locked when it has not yet been exposed (to
any other thread), since there are no ways that any other thread could
acccess it yet.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72dbf02813d4c2a6cf16eef546be8639b1123ff9
---

 modules/demux/playlist/asx.c     | 4 ++--
 modules/demux/playlist/podcast.c | 2 +-
 modules/demux/playlist/xspf.c    | 5 +----
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index e340b8943e..67eab58699 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -294,8 +294,8 @@ static void ProcessEntry( int *pi_n_entry, xml_reader_t *p_xml_reader,
                     input_item_SetURL( p_entry, psz_moreinfo );
                 if( psz_description )
                     input_item_SetDescription( p_entry, psz_description );
-                if( i_duration > 0)
-                    input_item_SetDuration( p_entry, i_duration );
+                if( i_duration > 0 )
+                    p_entry->i_duration = i_duration;
 
                 input_item_node_AppendItem( p_subitems, p_entry );
 
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index 466f85efef..9f6553cce2 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -263,7 +263,7 @@ static int Demux( demux_t *p_demux )
 
                     /* Set the duration if available */
                     if( psz_item_duration )
-                        input_item_SetDuration( p_input, strTimeToMTime( psz_item_duration ) );
+                        p_input->i_duration = strTimeToMTime( psz_item_duration );
 
 #define ADD_INFO( info, field ) \
     if( field ) { \
diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 8dbd487fca..68d54fa7c1 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -541,10 +541,7 @@ static bool set_item_info SIMPLE_INTERFACE
     else if (!strcmp(psz_name, "trackNum"))
         input_item_SetTrackNum(p_input, psz_value);
     else if (!strcmp(psz_name, "duration"))
-    {
-        long i_num = atol(psz_value);
-        input_item_SetDuration(p_input, (mtime_t) i_num*1000);
-    }
+        p_input->i_duration = atol(psz_value) * INT64_C(1000);
     else if (!strcmp(psz_name, "annotation"))
         input_item_SetDescription(p_input, psz_value);
     else if (!strcmp(psz_name, "info"))



More information about the vlc-commits mailing list