1 /*****************************************************************************
2 * rss.c : rss feed display video plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2003-2006 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
33 #include "vlc_filter.h"
34 #include "vlc_block.h"
37 #include "vlc_block.h"
38 #include "vlc_stream.h"
42 #include "vlc_image.h"
44 /*****************************************************************************
46 *****************************************************************************/
47 static int CreateFilter ( vlc_object_t * );
48 static void DestroyFilter( vlc_object_t * );
49 static subpicture_t *Filter( filter_t *, mtime_t );
51 static int FetchRSS( filter_t * );
52 static void FreeRSS( filter_t * );
54 static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
55 0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00,
56 0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080,
57 0x00000080, 0x000000FF, 0x0000FFFF};
58 static char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"),
59 N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), N_("Red"),
60 N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"),
61 N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"),
64 /*****************************************************************************
65 * filter_sys_t: rss filter descriptor
66 *****************************************************************************/
71 char *psz_description;
78 char *psz_description;
84 struct rss_item_t *p_items;
92 int i_xoff, i_yoff; /* offsets for the display string in the video window */
93 int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
97 char *psz_marquee; /* marquee string */
99 text_style_t *p_style; /* font control */
105 struct rss_feed_t *p_feeds;
108 time_t t_last_update;
116 #define MSG_TEXT N_("RSS feed URLs")
117 #define MSG_LONGTEXT N_("RSS feed '|' (pipe) seperated URLs")
118 #define SPEED_TEXT N_("RSS feed speed")
119 #define SPEED_LONGTEXT N_("RSS feed speed (bigger is slower)")
120 #define LENGTH_TEXT N_("RSS feed max number of chars displayed")
121 #define LENGTH_LONGTEXT N_("RSS feed max number of chars displayed")
122 #define TTL_TEXT N_("Number of seconds between each forced refresh of the feeds")
123 #define TTL_LONGTEXT N_("Number of seconds between each forced refresh of the feeds. If 0, the feeds will never be updated.")
124 #define IMAGE_TEXT N_("Display feed images if available")
125 #define IMAGE_LONGTEXT N_("Display feed images if available")
127 #define POSX_TEXT N_("X offset, from left")
128 #define POSX_LONGTEXT N_("X offset, from the left screen edge" )
129 #define POSY_TEXT N_("Y offset, from the top")
130 #define POSY_LONGTEXT N_("Y offset, down from the top" )
131 #define OPACITY_TEXT N_("Opacity")
132 #define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of " \
133 "overlay text. 0 = transparent, 255 = totally opaque. " )
134 #define SIZE_TEXT N_("Font size, pixels")
135 #define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
136 "with -1 = use freetype-fontsize" )
138 #define COLOR_TEXT N_("Text Default Color")
139 #define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal. " \
140 "#000000 = all colors off, " \
141 "0xFF0000 = just Red, 0xFFFFFF = all color on [White]" )
143 #define POS_TEXT N_("Marquee position")
144 #define POS_LONGTEXT N_( \
145 "You can enforce the marquee position on the video " \
146 "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
147 "also use combinations of these values by adding them).")
149 static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
150 static char *ppsz_pos_descriptions[] =
151 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
152 N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
154 /*****************************************************************************
156 *****************************************************************************/
158 set_capability( "sub filter", 0 );
159 set_shortname( "RSS" );
160 set_callbacks( CreateFilter, DestroyFilter );
161 set_category( CAT_VIDEO );
162 set_subcategory( SUBCAT_VIDEO_SUBPIC );
163 add_string( "rss-urls", "rss", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
165 set_section( N_("Position"), NULL );
166 add_integer( "rss-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
167 add_integer( "rss-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
168 add_integer( "rss-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
169 change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
171 set_section( N_("Font"), NULL );
172 /* 5 sets the default to top [1] left [4] */
173 add_integer_with_range( "rss-opacity", 255, 0, 255, NULL,
174 OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
175 add_integer( "rss-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT,
177 change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
178 add_integer( "rss-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
180 set_section( N_("Misc"), NULL );
181 add_integer( "rss-speed", 100000, NULL, SPEED_TEXT, SPEED_LONGTEXT,
183 add_integer( "rss-length", 60, NULL, LENGTH_TEXT, LENGTH_LONGTEXT,
185 add_integer( "rss-ttl", 1800, NULL, TTL_TEXT, TTL_LONGTEXT, VLC_FALSE );
186 add_bool( "rss-images", 1, NULL, IMAGE_TEXT, IMAGE_LONGTEXT, VLC_FALSE );
188 set_description( _("RSS feed display") );
189 add_shortcut( "rss" );
192 /*****************************************************************************
193 * CreateFilter: allocates RSS video filter
194 *****************************************************************************/
195 static int CreateFilter( vlc_object_t *p_this )
197 filter_t *p_filter = (filter_t *)p_this;
201 /* Allocate structure */
202 p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
205 msg_Err( p_filter, "out of memory" );
209 vlc_mutex_init( p_filter, &p_sys->lock );
210 vlc_mutex_lock( &p_sys->lock );
212 p_sys->psz_urls = var_CreateGetString( p_filter, "rss-urls" );
213 p_sys->i_cur_feed = 0;
214 p_sys->i_cur_item = 0;
215 p_sys->i_cur_char = 0;
217 p_sys->p_feeds = NULL;
218 p_sys->i_speed = var_CreateGetInteger( p_filter, "rss-speed" );
219 p_sys->i_length = var_CreateGetInteger( p_filter, "rss-length" );
220 p_sys->i_ttl = __MAX( 0, var_CreateGetInteger( p_filter, "rss-ttl" ) );
221 p_sys->b_images = var_CreateGetBool( p_filter, "rss-images" );
222 p_sys->psz_marquee = (char *)malloc( p_sys->i_length );
224 p_sys->p_style = malloc( sizeof( text_style_t ));
225 memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ));
227 p_sys->i_xoff = var_CreateGetInteger( p_filter, "rss-x" );
228 p_sys->i_yoff = var_CreateGetInteger( p_filter, "rss-y" );
229 p_sys->i_pos = var_CreateGetInteger( p_filter, "rss-position" );
230 p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_filter, "rss-opacity" );
231 p_sys->p_style->i_font_color = var_CreateGetInteger( p_filter, "rss-color" );
232 p_sys->p_style->i_font_size = var_CreateGetInteger( p_filter, "rss-size" );
234 if( p_sys->b_images == VLC_TRUE && p_sys->p_style->i_font_size == -1 )
236 msg_Warn( p_filter, "rrs-size wasn't specified. Feed images will thus be displayed without being resized" );
239 if( FetchRSS( p_filter ) )
241 msg_Err( p_filter, "failed while fetching RSS ... too bad" );
242 vlc_mutex_unlock( &p_sys->lock );
245 p_sys->t_last_update = time( NULL );
247 if( p_sys->i_feeds == 0 )
249 vlc_mutex_unlock( &p_sys->lock );
252 for( i_feed=0; i_feed < p_sys->i_feeds; i_feed ++ )
253 if( p_sys->p_feeds[i_feed].i_items == 0 )
255 vlc_mutex_unlock( &p_sys->lock );
260 p_filter->pf_sub_filter = Filter;
261 p_sys->last_date = (mtime_t)0;
263 vlc_mutex_unlock( &p_sys->lock );
267 /*****************************************************************************
268 * DestroyFilter: destroy RSS video filter
269 *****************************************************************************/
270 static void DestroyFilter( vlc_object_t *p_this )
272 filter_t *p_filter = (filter_t *)p_this;
273 filter_sys_t *p_sys = p_filter->p_sys;
275 vlc_mutex_lock( &p_sys->lock );
277 if( p_sys->p_style ) free( p_sys->p_style );
278 if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
279 free( p_sys->psz_urls );
281 vlc_mutex_unlock( &p_sys->lock );
282 vlc_mutex_destroy( &p_sys->lock );
285 /* Delete the RSS variables */
286 var_Destroy( p_filter, "rss-urls" );
287 var_Destroy( p_filter, "rss-speed" );
288 var_Destroy( p_filter, "rss-length" );
289 var_Destroy( p_filter, "rss-ttl" );
290 var_Destroy( p_filter, "rss-images" );
291 var_Destroy( p_filter, "rss-x" );
292 var_Destroy( p_filter, "rss-y" );
293 var_Destroy( p_filter, "rss-position" );
294 var_Destroy( p_filter, "rss-color");
295 var_Destroy( p_filter, "rss-opacity");
296 var_Destroy( p_filter, "rss-size");
299 /****************************************************************************
300 * Filter: the whole thing
301 ****************************************************************************
302 * This function outputs subpictures at regular time intervals.
303 ****************************************************************************/
304 static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
306 filter_sys_t *p_sys = p_filter->p_sys;
308 video_format_t fmt = {0};
310 subpicture_region_t *p_region;
314 struct rss_feed_t *p_feed;
316 vlc_mutex_lock( &p_sys->lock );
319 + ( p_sys->i_cur_char == 0 && p_sys->i_cur_item == 0 ? 5 : 1 )
320 /* ( ... ? 5 : 1 ) means "wait more for the 1st char" */
321 * p_sys->i_speed > date )
323 vlc_mutex_unlock( &p_sys->lock );
327 /* Do we need to update the feeds ? */
329 && time( NULL ) > p_sys->t_last_update + (time_t)p_sys->i_ttl )
331 msg_Dbg( p_filter, "Forcing update of all the RSS feeds" );
332 if( FetchRSS( p_filter ) )
334 msg_Err( p_filter, "failed while fetching RSS ... too bad" );
335 vlc_mutex_unlock( &p_sys->lock );
336 return NULL; /* FIXME : we most likely messed up all the data,
337 * so we might need to do something about it */
339 p_sys->t_last_update = time( NULL );
342 p_sys->last_date = date;
344 if( p_sys->p_feeds[p_sys->i_cur_feed].p_items[p_sys->i_cur_item].psz_title[p_sys->i_cur_char] == 0 )
346 p_sys->i_cur_char = 0;
348 if( p_sys->i_cur_item >= p_sys->p_feeds[p_sys->i_cur_feed].i_items )
350 p_sys->i_cur_item = 0;
351 p_sys->i_cur_feed = (p_sys->i_cur_feed + 1)%p_sys->i_feeds;
355 p_spu = p_filter->pf_sub_buffer_new( p_filter );
358 vlc_mutex_unlock( &p_sys->lock );
362 fmt.i_chroma = VLC_FOURCC('T','E','X','T');
364 p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt );
365 if( !p_spu->p_region )
367 p_filter->pf_sub_buffer_del( p_filter, p_spu );
368 vlc_mutex_unlock( &p_sys->lock );
372 /* Generate the string that will be displayed. This string is supposed to
373 be p_sys->i_length characters long. */
374 i_item = p_sys->i_cur_item;
375 i_feed = p_sys->i_cur_feed;
376 p_feed = &p_sys->p_feeds[p_sys->i_cur_feed];
380 /* Don't display the feed's title if we have an image */
381 snprintf( p_sys->psz_marquee, p_sys->i_length, "%s",
382 p_sys->p_feeds[i_feed].p_items[i_item].psz_title
383 +p_sys->i_cur_char );
387 snprintf( p_sys->psz_marquee, p_sys->i_length, "%s : %s",
388 p_sys->p_feeds[i_feed].psz_title,
389 p_sys->p_feeds[i_feed].p_items[i_item].psz_title
390 +p_sys->i_cur_char );
393 while( strlen( p_sys->psz_marquee ) < (unsigned int)p_sys->i_length )
396 if( i_item == p_sys->p_feeds[i_feed].i_items ) break;
397 snprintf( strchr( p_sys->psz_marquee, 0 ),
398 p_sys->i_length - strlen( p_sys->psz_marquee ),
400 p_sys->p_feeds[i_feed].p_items[i_item].psz_title );
403 /* Calls to snprintf might split multibyte UTF8 chars ...
404 * which freetype doesn't like. */
406 char *a = strdup( p_sys->psz_marquee );
408 char *b = p_sys->psz_marquee;
409 EnsureUTF8( p_sys->psz_marquee );
410 /* we want to use ' ' instead of '?' for erroneous chars */
413 if( *b != *a ) *b = ' ';
419 p_spu->p_region->psz_text = strdup(p_sys->psz_marquee);
420 p_spu->i_start = date;
422 p_spu->b_ephemer = VLC_TRUE;
424 /* where to locate the string: */
425 if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
426 { /* set to one of the 9 relative locations */
427 p_spu->i_flags = p_sys->i_pos;
430 p_spu->b_absolute = VLC_FALSE;
433 { /* set to an absolute xy, referenced to upper left corner */
434 p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
435 p_spu->i_x = p_sys->i_xoff;
436 p_spu->i_y = p_sys->i_yoff;
437 p_spu->b_absolute = VLC_TRUE;
441 p_spu->p_region->p_style = p_sys->p_style;
445 /* Display the feed's image */
446 picture_t *p_pic = p_feed->p_pic;
447 video_format_t fmt_out = {0};
449 fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
450 fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
451 fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
453 fmt_out.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
455 fmt_out.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;
457 p_region = p_spu->pf_create_region( VLC_OBJECT( p_filter ), &fmt_out );
460 msg_Err( p_filter, "cannot allocate SPU region" );
464 vout_CopyPicture( p_filter, &p_region->picture, p_pic );
465 p_spu->p_region->p_next = p_region;
468 /* Offset text to display right next to the image */
469 p_spu->p_region->i_x = p_pic->p[Y_PLANE].i_visible_pitch;
472 vlc_mutex_unlock( &p_sys->lock );
476 /****************************************************************************
477 * RSS related functions
478 ****************************************************************************
479 * You should always lock the p_filter mutex before using any of these
481 ***************************************************************************/
483 /****************************************************************************
484 * download and resize image located at psz_url
485 ***************************************************************************/
486 picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
488 filter_sys_t *p_sys = p_filter->p_sys;
490 video_format_t fmt_in={0}, fmt_out={0};
491 picture_t *p_orig, *p_pic=NULL;
492 image_handler_t *p_handler = image_HandlerCreate( p_filter );
496 psz_local = ToLocale( psz_url );
497 fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
498 p_orig = image_ReadUrl( p_handler, psz_local, &fmt_in, &fmt_out );
499 LocaleFree( psz_local );
503 msg_Warn( p_filter, "Unable to read image %s", psz_url );
505 else if( p_sys->p_style->i_font_size > 0 )
508 fmt_in.i_chroma = VLC_FOURCC('Y','U','V','A');
509 fmt_in.i_height = p_orig->p[Y_PLANE].i_visible_lines;
510 fmt_in.i_width = p_orig->p[Y_PLANE].i_visible_pitch;
511 fmt_out.i_width = p_orig->p[Y_PLANE].i_visible_pitch
512 *p_sys->p_style->i_font_size/p_orig->p[Y_PLANE].i_visible_lines;
513 fmt_out.i_height = p_sys->p_style->i_font_size;
515 p_pic = image_Convert( p_handler, p_orig, &fmt_in, &fmt_out );
516 p_orig->pf_release( p_orig );
519 msg_Warn( p_filter, "Error while converting %s", psz_url );
527 image_HandlerDelete( p_handler );
532 /****************************************************************************
533 * remove all ' ' '\t' '\n' '\r' characters from the begining and end of the
535 ***************************************************************************/
536 char *removeWhiteChars( char *psz_src )
538 char *psz_src2 = strdup( psz_src );
539 char *psz_clean = strdup( psz_src2 );
542 while( ( *psz_clean == ' ' || *psz_clean == '\t'
543 || *psz_clean == '\n' || *psz_clean == '\r' )
544 && *psz_clean != '\0' )
548 i = strlen( psz_clean );
550 ( psz_clean[i] == ' ' || psz_clean[i] == '\t'
551 || psz_clean[i] == '\n' || psz_clean[i] == '\r' ) );
552 psz_clean[i+1] = '\0';
553 psz_clean2 = strdup( psz_clean );
558 /****************************************************************************
560 ***************************************************************************/
561 static int FetchRSS( filter_t *p_filter)
563 filter_sys_t *p_sys = p_filter->p_sys;
565 stream_t *p_stream = NULL;
567 xml_reader_t *p_xml_reader = NULL;
569 char *psz_eltname = NULL;
570 char *psz_eltvalue = NULL;
571 char *psz_feed = NULL;
572 char *psz_buffer = NULL;
573 char *psz_buffer_2 = NULL;
577 vlc_bool_t b_is_item;
578 vlc_bool_t b_is_image;
584 while( p_sys->psz_urls[i_int] != 0 )
585 if( p_sys->psz_urls[i_int++] == '|' )
587 p_sys->p_feeds = (struct rss_feed_t *)malloc( p_sys->i_feeds
588 * sizeof( struct rss_feed_t ) );
590 p_xml = xml_Create( p_filter );
593 msg_Err( p_filter, "Failed to open XML parser" );
597 psz_buffer = strdup( p_sys->psz_urls );
598 psz_buffer_2 = psz_buffer; /* keep track so we can free it */
599 for( i_feed = 0; i_feed < p_sys->i_feeds; i_feed++ )
601 struct rss_feed_t *p_feed = p_sys->p_feeds+i_feed;
603 if( psz_buffer == NULL ) break;
604 if( psz_buffer[0] == 0 ) psz_buffer++;
605 psz_feed = psz_buffer;
606 psz_buffer = strchr( psz_buffer, '|' );
607 if( psz_buffer != NULL ) psz_buffer[0] = 0;
609 p_feed->psz_title = NULL;
610 p_feed->psz_description = NULL;
611 p_feed->psz_link = NULL;
612 p_feed->psz_image = NULL;
613 p_feed->p_pic = NULL;
615 p_feed->p_items = NULL;
617 msg_Dbg( p_filter, "Opening %s RSS feed ...", psz_feed );
619 p_stream = stream_UrlNew( p_filter, psz_feed );
622 msg_Err( p_filter, "Failed to open %s for reading", psz_feed );
626 p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
629 msg_Err( p_filter, "Failed to open %s for parsing", psz_feed );
634 b_is_item = VLC_FALSE;
635 b_is_image = VLC_FALSE;
637 while( xml_ReaderRead( p_xml_reader ) == 1 )
639 switch( xml_ReaderNodeType( p_xml_reader ) )
645 case XML_READER_STARTELEM:
651 psz_eltname = xml_ReaderName( p_xml_reader );
657 msg_Dbg( p_filter, "element name : %s", psz_eltname );
659 if( !strcmp( psz_eltname, "item" ) )
661 b_is_item = VLC_TRUE;
663 p_feed->p_items = (struct rss_item_t *)realloc( p_feed->p_items, p_feed->i_items * sizeof( struct rss_item_t ) );
664 p_feed->p_items[p_feed->i_items-1].psz_title = NULL;
665 p_feed->p_items[p_feed->i_items-1].psz_description
667 p_feed->p_items[p_feed->i_items-1].psz_link = NULL;
669 else if( !strcmp( psz_eltname, "image" ) )
671 b_is_image = VLC_TRUE;
675 case XML_READER_ENDELEM:
681 psz_eltname = xml_ReaderName( p_xml_reader );
687 msg_Dbg( p_filter, "element end : %s", psz_eltname );
689 if( !strcmp( psz_eltname, "item" ) )
691 b_is_item = VLC_FALSE;
694 else if( !strcmp( psz_eltname, "image" ) )
696 b_is_image = VLC_FALSE;
702 case XML_READER_TEXT:
703 psz_eltvalue = xml_ReaderValue( p_xml_reader );
711 psz_clean = removeWhiteChars( psz_eltvalue );
712 free( psz_eltvalue ); psz_eltvalue = psz_clean;
715 msg_Dbg( p_filter, " text : <%s>", psz_eltvalue );
717 if( b_is_item == VLC_TRUE )
719 struct rss_item_t *p_item;
720 p_item = p_feed->p_items+i_item;
721 if( !strcmp( psz_eltname, "title" ) )
723 p_item->psz_title = psz_eltvalue;
725 else if( !strcmp( psz_eltname, "link" ) )
727 p_item->psz_link = psz_eltvalue;
729 else if( !strcmp( psz_eltname, "description" ) )
731 p_item->psz_description = psz_eltvalue;
735 free( psz_eltvalue );
739 else if( b_is_image == VLC_TRUE )
741 if( !strcmp( psz_eltname, "url" ) )
743 p_feed->psz_image = psz_eltvalue;
744 if( p_sys->b_images == VLC_TRUE )
745 p_feed->p_pic = LoadImage( p_filter,
750 free( psz_eltvalue );
756 if( !strcmp( psz_eltname, "title" ) )
758 p_feed->psz_title = psz_eltvalue;
760 else if( !strcmp( psz_eltname, "link" ) )
762 p_feed->psz_link = psz_eltvalue;
764 else if( !strcmp( psz_eltname, "description" ) )
766 p_feed->psz_description = psz_eltvalue;
770 free( psz_eltvalue );
778 if( p_xml_reader && p_xml ) xml_ReaderDelete( p_xml, p_xml_reader );
779 if( p_stream ) stream_Delete( p_stream );
780 msg_Dbg( p_filter, "Done with %s RSS feed.", psz_feed );
782 free( psz_buffer_2 );
783 if( p_xml ) xml_Delete( p_xml );
788 /****************************************************************************
790 ***************************************************************************/
791 static void FreeRSS( filter_t *p_filter)
793 filter_sys_t *p_sys = p_filter->p_sys;
795 struct rss_item_t *p_item;
796 struct rss_feed_t *p_feed;
801 for( i_feed = 0; i_feed < p_sys->i_feeds; i_feed++ )
803 p_feed = p_sys->p_feeds+i_feed;
804 for( i_item = 0; i_item < p_feed->i_items; i_item++ )
806 p_item = p_feed->p_items+i_item;
807 free( p_item->psz_title );
808 free( p_item->psz_link );
809 free( p_item->psz_description );
811 free( p_feed->p_items );
812 free( p_feed->psz_title);
813 free( p_feed->psz_link );
814 free( p_feed->psz_description );
815 free( p_feed->psz_image );
816 if( p_feed->p_pic != NULL )
817 p_feed->p_pic->pf_release( p_feed->p_pic );
819 free( p_sys->p_feeds );