Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
38311fb4
Commit
38311fb4
authored
Jul 31, 2005
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
free stuff and add mutex (will be needed when RSS feed get updated)
parent
e88514ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
16 deletions
+85
-16
modules/video_filter/rss.c
modules/video_filter/rss.c
+85
-16
No files found.
modules/video_filter/rss.c
View file @
38311fb4
...
@@ -46,6 +46,7 @@ static void DestroyFilter( vlc_object_t * );
...
@@ -46,6 +46,7 @@ static void DestroyFilter( vlc_object_t * );
static
subpicture_t
*
Filter
(
filter_t
*
,
mtime_t
);
static
subpicture_t
*
Filter
(
filter_t
*
,
mtime_t
);
static
int
FetchRSS
(
filter_t
*
);
static
int
FetchRSS
(
filter_t
*
);
static
void
FreeRSS
(
filter_t
*
);
static
int
pi_color_values
[]
=
{
0xf0000000
,
0x00000000
,
0x00808080
,
0x00C0C0C0
,
static
int
pi_color_values
[]
=
{
0xf0000000
,
0x00000000
,
0x00808080
,
0x00C0C0C0
,
0x00FFFFFF
,
0x00800000
,
0x00FF0000
,
0x00FF00FF
,
0x00FFFF00
,
0x00FFFFFF
,
0x00800000
,
0x00FF0000
,
0x00FF00FF
,
0x00FFFF00
,
...
@@ -80,6 +81,9 @@ struct rss_feed_t
...
@@ -80,6 +81,9 @@ struct rss_feed_t
struct
filter_sys_t
struct
filter_sys_t
{
{
vlc_mutex_t
lock
;
vlc_mutex_t
*
p_lock
;
int
i_xoff
,
i_yoff
;
/* offsets for the display string in the video window */
int
i_xoff
,
i_yoff
;
/* offsets for the display string in the video window */
int
i_pos
;
/* permit relative positioning (top, bottom, left, right, center) */
int
i_pos
;
/* permit relative positioning (top, bottom, left, right, center) */
int
i_speed
;
int
i_speed
;
...
@@ -102,14 +106,12 @@ struct filter_sys_t
...
@@ -102,14 +106,12 @@ struct filter_sys_t
int
i_cur_char
;
int
i_cur_char
;
};
};
// <TODO>
#define MSG_TEXT N_("RSS feed URLs")
#define MSG_TEXT N_("RSS feed URLs")
#define MSG_LONGTEXT N_("RSS feed comma
(TODO ?)
seperated URLs")
#define MSG_LONGTEXT N_("RSS feed comma seperated URLs")
#define SPEED_TEXT N_("RSS feed speed")
#define SPEED_TEXT N_("RSS feed speed")
#define SPEED_LONGTEXT N_("RSS feed speed (bigger is slower)")
#define SPEED_LONGTEXT N_("RSS feed speed (bigger is slower)")
#define LENGTH_TEXT N_("RSS feed max number of chars displayed")
#define LENGTH_TEXT N_("RSS feed max number of chars displayed")
#define LENGTH_LONGTEXT N_("RSS feed max number of chars displayed")
#define LENGTH_LONGTEXT N_("RSS feed max number of chars displayed")
// </TODO>
#define POSX_TEXT N_("X offset, from left")
#define POSX_TEXT N_("X offset, from left")
#define POSX_LONGTEXT N_("X offset, from the left screen edge" )
#define POSX_LONGTEXT N_("X offset, from the left screen edge" )
...
@@ -190,10 +192,15 @@ static int CreateFilter( vlc_object_t *p_this )
...
@@ -190,10 +192,15 @@ static int CreateFilter( vlc_object_t *p_this )
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
vlc_mutex_init
(
p_filter
,
&
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
psz_urls
=
var_CreateGetString
(
p_filter
,
"rss-urls"
);
p_sys
->
psz_urls
=
var_CreateGetString
(
p_filter
,
"rss-urls"
);
p_sys
->
i_cur_feed
=
0
;
p_sys
->
i_cur_feed
=
0
;
p_sys
->
i_cur_item
=
0
;
p_sys
->
i_cur_item
=
0
;
p_sys
->
i_cur_char
=
0
;
p_sys
->
i_cur_char
=
0
;
p_sys
->
i_feeds
=
0
;
p_sys
->
p_feeds
=
NULL
;
p_sys
->
i_speed
=
var_CreateGetInteger
(
p_filter
,
"rss-speed"
);
p_sys
->
i_speed
=
var_CreateGetInteger
(
p_filter
,
"rss-speed"
);
p_sys
->
i_length
=
var_CreateGetInteger
(
p_filter
,
"rss-length"
);
p_sys
->
i_length
=
var_CreateGetInteger
(
p_filter
,
"rss-length"
);
p_sys
->
psz_marquee
=
(
char
*
)
malloc
(
p_sys
->
i_length
);
p_sys
->
psz_marquee
=
(
char
*
)
malloc
(
p_sys
->
i_length
);
...
@@ -209,18 +216,27 @@ static int CreateFilter( vlc_object_t *p_this )
...
@@ -209,18 +216,27 @@ static int CreateFilter( vlc_object_t *p_this )
if
(
FetchRSS
(
p_filter
)
)
if
(
FetchRSS
(
p_filter
)
)
{
{
msg_Err
(
p_filter
,
"failed while fetching RSS ... too bad"
);
msg_Err
(
p_filter
,
"failed while fetching RSS ... too bad"
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
if
(
p_sys
->
i_feeds
==
0
)
return
VLC_EGENERIC
;
if
(
p_sys
->
i_feeds
==
0
)
{
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_EGENERIC
;
}
for
(
i_feed
=
0
;
i_feed
<
p_sys
->
i_feeds
;
i_feed
++
)
for
(
i_feed
=
0
;
i_feed
<
p_sys
->
i_feeds
;
i_feed
++
)
if
(
p_sys
->
p_feeds
[
i_feed
].
i_items
==
0
)
if
(
p_sys
->
p_feeds
[
i_feed
].
i_items
==
0
)
{
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
/* Misc init */
/* Misc init */
p_filter
->
pf_sub_filter
=
Filter
;
p_filter
->
pf_sub_filter
=
Filter
;
p_sys
->
last_date
=
(
mtime_t
)
0
;
p_sys
->
last_date
=
(
mtime_t
)
0
;
//p_sys->b_need_update = VLC_TRUE;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -232,9 +248,13 @@ static void DestroyFilter( vlc_object_t *p_this )
...
@@ -232,9 +248,13 @@ static void DestroyFilter( vlc_object_t *p_this )
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
p_sys
->
psz_marquee
)
free
(
p_sys
->
psz_marquee
);
if
(
p_sys
->
psz_marquee
)
free
(
p_sys
->
psz_marquee
);
free
(
p_sys
->
psz_urls
);
free
(
p_sys
->
psz_urls
);
/* TODO : free RSS feeds stuff */
FreeRSS
(
p_filter
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
);
free
(
p_sys
);
/* Delete the RSS variables */
/* Delete the RSS variables */
...
@@ -262,8 +282,14 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -262,8 +282,14 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
int
i_feed
,
i_item
;
int
i_feed
,
i_item
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
/* wait more for the 1st char */
/* wait more for the 1st char */
if
(
p_sys
->
last_date
+
(
p_sys
->
i_cur_char
==
0
&&
p_sys
->
i_cur_item
==
0
?
5
:
1
)
*
p_sys
->
i_speed
>
date
)
return
NULL
;
if
(
p_sys
->
last_date
+
(
p_sys
->
i_cur_char
==
0
&&
p_sys
->
i_cur_item
==
0
?
5
:
1
)
*
p_sys
->
i_speed
>
date
)
{
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
NULL
;
}
p_sys
->
last_date
=
date
;
p_sys
->
last_date
=
date
;
p_sys
->
i_cur_char
++
;
p_sys
->
i_cur_char
++
;
...
@@ -278,15 +304,12 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -278,15 +304,12 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
}
}
}
p_spu
=
p_filter
->
pf_sub_buffer_new
(
p_filter
);
/* We always need an update
if
(
!
p_spu
)
if( p_sys->b_need_update == VLC_FALSE )
{
{
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
NULL
;
return
NULL
;
}*/
}
p_spu
=
p_filter
->
pf_sub_buffer_new
(
p_filter
);
if
(
!
p_spu
)
return
NULL
;
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
fmt
.
i_chroma
=
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
);
fmt
.
i_chroma
=
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
);
...
@@ -299,6 +322,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -299,6 +322,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if
(
!
p_spu
->
p_region
)
if
(
!
p_spu
->
p_region
)
{
{
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
NULL
;
return
NULL
;
}
}
...
@@ -337,11 +361,20 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -337,11 +361,20 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu
->
p_region
->
i_text_alpha
=
255
-
p_sys
->
i_font_opacity
;
p_spu
->
p_region
->
i_text_alpha
=
255
-
p_sys
->
i_font_opacity
;
p_spu
->
p_region
->
i_text_size
=
p_sys
->
i_font_size
;
p_spu
->
p_region
->
i_text_size
=
p_sys
->
i_font_size
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
//p_sys->b_need_update = VLC_FALSE;
return
p_spu
;
return
p_spu
;
}
}
/****************************************************************************
* RSS related functions
****************************************************************************
* You should always lock the p_filter mutex before using any of these
* functions
***************************************************************************/
/****************************************************************************
* FetchRSS
***************************************************************************/
static
int
FetchRSS
(
filter_t
*
p_filter
)
static
int
FetchRSS
(
filter_t
*
p_filter
)
{
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
...
@@ -354,12 +387,14 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -354,12 +387,14 @@ static int FetchRSS( filter_t *p_filter)
char
*
psz_eltvalue
=
NULL
;
char
*
psz_eltvalue
=
NULL
;
char
*
psz_feed
=
NULL
;
char
*
psz_feed
=
NULL
;
char
*
psz_buffer
=
NULL
;
char
*
psz_buffer
=
NULL
;
char
*
psz_buffer_2
=
NULL
;
int
i_feed
;
int
i_feed
;
int
i_item
;
int
i_item
;
int
i_is_item
;
int
i_is_item
;
int
i_int
;
int
i_int
;
FreeRSS
(
p_filter
);
p_sys
->
i_feeds
=
1
;
p_sys
->
i_feeds
=
1
;
i_int
=
0
;
i_int
=
0
;
while
(
p_sys
->
psz_urls
[
i_int
]
!=
0
)
while
(
p_sys
->
psz_urls
[
i_int
]
!=
0
)
...
@@ -376,6 +411,7 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -376,6 +411,7 @@ static int FetchRSS( filter_t *p_filter)
}
}
psz_buffer
=
strdup
(
p_sys
->
psz_urls
);
psz_buffer
=
strdup
(
p_sys
->
psz_urls
);
psz_buffer_2
=
psz_buffer
;
/* keep track so we can free it */
for
(
i_feed
=
0
;
i_feed
<
p_sys
->
i_feeds
;
i_feed
++
)
for
(
i_feed
=
0
;
i_feed
<
p_sys
->
i_feeds
;
i_feed
++
)
{
{
struct
rss_feed_t
*
p_feed
=
p_sys
->
p_feeds
+
i_feed
;
struct
rss_feed_t
*
p_feed
=
p_sys
->
p_feeds
+
i_feed
;
...
@@ -505,7 +541,40 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -505,7 +541,40 @@ static int FetchRSS( filter_t *p_filter)
if
(
p_xml_reader
&&
p_xml
)
xml_ReaderDelete
(
p_xml
,
p_xml_reader
);
if
(
p_xml_reader
&&
p_xml
)
xml_ReaderDelete
(
p_xml
,
p_xml_reader
);
if
(
p_stream
)
stream_Delete
(
p_stream
);
if
(
p_stream
)
stream_Delete
(
p_stream
);
}
}
free
(
psz_buffer_2
);
if
(
p_xml
)
xml_Delete
(
p_xml
);
if
(
p_xml
)
xml_Delete
(
p_xml
);
return
0
;
return
0
;
}
}
/****************************************************************************
* FreeRSS
***************************************************************************/
static
void
FreeRSS
(
filter_t
*
p_filter
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
struct
rss_item_t
*
p_item
;
struct
rss_feed_t
*
p_feed
;
int
i_feed
;
int
i_item
;
for
(
i_feed
=
0
;
i_feed
<
p_sys
->
i_feeds
;
i_feed
++
)
{
p_feed
=
p_sys
->
p_feeds
+
i_feed
;
for
(
i_item
=
0
;
i_item
<
p_feed
->
i_items
;
i_item
++
)
{
p_item
=
p_feed
->
p_items
+
i_item
;
free
(
p_item
->
psz_title
);
free
(
p_item
->
psz_link
);
free
(
p_item
->
psz_description
);
}
free
(
p_feed
->
p_items
);
free
(
p_feed
->
psz_title
);
free
(
p_feed
->
psz_link
);
free
(
p_feed
->
psz_description
);
}
free
(
p_sys
->
p_feeds
);
p_sys
->
i_feeds
=
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment