[vlc-devel] [PATCH 3/3] spu: rss: Fix TODOs: If no item exists then RSS feed is skipped, fix comment
Daniel Glaas
daniel.glaas at freenet.de
Wed Aug 26 01:10:15 CEST 2020
In function *Filter, there already existed a TODO note that it needs to be
checked whether the feeds have items at all. As this can change with every
parsing of the URLs, this can only be dony dynamically at that point in time
when the display is rendered.
The TODO note in the function comment of ParseUrls seems to be outdated as the
check for an non empty url string is already done in function CreateFilter() in
lines 263..268.
---
modules/spu/rss.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/modules/spu/rss.c b/modules/spu/rss.c
index 0c86963843..95f55e34a4 100644
--- a/modules/spu/rss.c
+++ b/modules/spu/rss.c
@@ -347,6 +347,11 @@ static void DestroyFilter( vlc_object_t *p_this )
free( p_sys );
}
+static void switchToNextFeed(filter_sys_t *p_sys)
+{
+ p_sys->i_cur_feed = (p_sys->i_cur_feed + 1)%p_sys->i_feeds;
+}
+
/****************************************************************************
* Filter: the whole thing
****************************************************************************
@@ -365,13 +370,21 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
vlc_mutex_lock( &p_sys->lock );
/* Check if the feeds have been fetched and that we have some feeds */
- /* TODO: check that we have items for each feeds */
if( !p_sys->b_fetched && p_sys->i_feeds > 0 )
{
vlc_mutex_unlock( &p_sys->lock );
return NULL;
}
+ /* If the current feed has no item then switch to the next feed
+ and skip further processing */
+ if (p_sys->p_feeds[p_sys->i_cur_feed].i_items == 0)
+ {
+ switchToNextFeed(p_sys);
+ vlc_mutex_unlock( &p_sys->lock );
+ return NULL;
+ }
+
if( p_sys->last_date
+ ( p_sys->i_cur_char <= 0 &&
p_sys->i_cur_item == ( p_sys->i_title == scroll_title ? -1 : 0 ) ? 5 : 1 )
@@ -397,7 +410,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
p_sys->i_cur_item = -1;
else
p_sys->i_cur_item = 0;
- p_sys->i_cur_feed = (p_sys->i_cur_feed + 1)%p_sys->i_feeds;
+ switchToNextFeed(p_sys);
}
}
@@ -625,7 +638,7 @@ static char *removeWhiteChars( const char *psz_src )
/****************************************************************************
- * Parse url list, psz_urls must be non empty (TODO: check it !)
+ * Parse url list, psz_urls must be non empty (ensured by check in CreateFilter() )
***************************************************************************/
static int ParseUrls( filter_t *p_filter, char *psz_urls )
{
--
2.17.1
More information about the vlc-devel
mailing list