Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
fdfdfc52
Commit
fdfdfc52
authored
May 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
marq: add --marq-file to read/update the text from a file
parent
e2e5bcb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
modules/video_filter/marq.c
modules/video_filter/marq.c
+42
-1
No files found.
modules/video_filter/marq.c
View file @
fdfdfc52
...
@@ -46,7 +46,7 @@ static int CreateFilter ( vlc_object_t * );
...
@@ -46,7 +46,7 @@ static int CreateFilter ( vlc_object_t * );
static
void
DestroyFilter
(
vlc_object_t
*
);
static
void
DestroyFilter
(
vlc_object_t
*
);
static
subpicture_t
*
Filter
(
filter_t
*
,
mtime_t
);
static
subpicture_t
*
Filter
(
filter_t
*
,
mtime_t
);
static
char
*
ReadFile
(
filter_t
*
,
const
char
*
);
static
int
MarqueeCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
static
int
MarqueeCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
void
*
p_data
);
...
@@ -74,6 +74,7 @@ struct filter_sys_t
...
@@ -74,6 +74,7 @@ struct filter_sys_t
int
i_timeout
;
int
i_timeout
;
char
*
format
;
/**< marquee text format */
char
*
format
;
/**< marquee text format */
char
*
filepath
;
/**< marquee file path */
char
*
message
;
/**< marquee plain text */
char
*
message
;
/**< marquee plain text */
text_style_t
*
p_style
;
/* font control */
text_style_t
*
p_style
;
/* font control */
...
@@ -99,6 +100,8 @@ struct filter_sys_t
...
@@ -99,6 +100,8 @@ struct filter_sys_t
"$N = name, $O = audio language, $P = position (in %), $R = rate, " \
"$N = name, $O = audio language, $P = position (in %), $R = rate, " \
"$S = audio sample rate (in kHz), " \
"$S = audio sample rate (in kHz), " \
"$T = time, $U = publisher, $V = volume, $_ = new line) ")
"$T = time, $U = publisher, $V = volume, $_ = new line) ")
#define FILE_TEXT N_("Text file")
#define FILE_LONGTEXT N_("File to read the marquee text from.")
#define POSX_TEXT N_("X offset")
#define POSX_TEXT N_("X offset")
#define POSX_LONGTEXT N_("X offset, from the left screen edge." )
#define POSX_LONGTEXT N_("X offset, from the left screen edge." )
#define POSY_TEXT N_("Y offset")
#define POSY_TEXT N_("Y offset")
...
@@ -152,6 +155,7 @@ vlc_module_begin ()
...
@@ -152,6 +155,7 @@ vlc_module_begin ()
set_subcategory
(
SUBCAT_VIDEO_SUBPIC
)
set_subcategory
(
SUBCAT_VIDEO_SUBPIC
)
add_string
(
CFG_PREFIX
"marquee"
,
"VLC"
,
MSG_TEXT
,
MSG_LONGTEXT
,
add_string
(
CFG_PREFIX
"marquee"
,
"VLC"
,
MSG_TEXT
,
MSG_LONGTEXT
,
false
)
false
)
add_loadfile
(
CFG_PREFIX
"file"
,
NULL
,
FILE_TEXT
,
FILE_LONGTEXT
,
true
)
set_section
(
N_
(
"Position"
),
NULL
)
set_section
(
N_
(
"Position"
),
NULL
)
add_integer
(
CFG_PREFIX
"x"
,
0
,
POSX_TEXT
,
POSX_LONGTEXT
,
true
)
add_integer
(
CFG_PREFIX
"x"
,
0
,
POSX_TEXT
,
POSX_LONGTEXT
,
true
)
...
@@ -217,6 +221,7 @@ static int CreateFilter( vlc_object_t *p_this )
...
@@ -217,6 +221,7 @@ static int CreateFilter( vlc_object_t *p_this )
var_AddCallback
(
p_filter
,
"marq-refresh"
,
MarqueeCallback
,
p_sys
);
var_AddCallback
(
p_filter
,
"marq-refresh"
,
MarqueeCallback
,
p_sys
);
CREATE_VAR
(
i_pos
,
Integer
,
"marq-position"
);
CREATE_VAR
(
i_pos
,
Integer
,
"marq-position"
);
CREATE_VAR
(
format
,
String
,
"marq-marquee"
);
CREATE_VAR
(
format
,
String
,
"marq-marquee"
);
p_sys
->
filepath
=
var_InheritString
(
p_filter
,
"marq-file"
);
p_sys
->
message
=
NULL
;
p_sys
->
message
=
NULL
;
p_sys
->
p_style
->
i_font_alpha
=
var_CreateGetIntegerCommand
(
p_filter
,
p_sys
->
p_style
->
i_font_alpha
=
var_CreateGetIntegerCommand
(
p_filter
,
"marq-opacity"
);
"marq-opacity"
);
...
@@ -255,6 +260,7 @@ static void DestroyFilter( vlc_object_t *p_this )
...
@@ -255,6 +260,7 @@ static void DestroyFilter( vlc_object_t *p_this )
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
text_style_Delete
(
p_sys
->
p_style
);
text_style_Delete
(
p_sys
->
p_style
);
free
(
p_sys
->
format
);
free
(
p_sys
->
format
);
free
(
p_sys
->
filepath
);
free
(
p_sys
->
message
);
free
(
p_sys
->
message
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -274,6 +280,16 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -274,6 +280,16 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if
(
p_sys
->
last_time
+
p_sys
->
i_refresh
>
date
)
if
(
p_sys
->
last_time
+
p_sys
->
i_refresh
>
date
)
goto
out
;
goto
out
;
if
(
p_sys
->
filepath
!=
NULL
)
{
char
*
fmt
=
ReadFile
(
p_filter
,
p_sys
->
filepath
);
if
(
fmt
!=
NULL
)
{
free
(
p_sys
->
format
);
p_sys
->
format
=
fmt
;
}
}
char
*
msg
=
str_format
(
p_filter
,
p_sys
->
format
?
p_sys
->
format
:
""
);
char
*
msg
=
str_format
(
p_filter
,
p_sys
->
format
?
p_sys
->
format
:
""
);
if
(
unlikely
(
msg
==
NULL
)
)
if
(
unlikely
(
msg
==
NULL
)
)
goto
out
;
goto
out
;
...
@@ -331,6 +347,31 @@ out:
...
@@ -331,6 +347,31 @@ out:
return
p_spu
;
return
p_spu
;
}
}
static
char
*
ReadFile
(
filter_t
*
obj
,
const
char
*
path
)
{
FILE
*
stream
=
fopen
(
path
,
"rt"
);
if
(
stream
==
NULL
)
{
msg_Err
(
obj
,
"cannot open %s: %m"
,
path
);
return
NULL
;
}
char
*
line
=
NULL
;
ssize_t
len
=
getline
(
&
line
,
&
(
size_t
){
0
},
stream
);
if
(
len
==
-
1
)
{
msg_Err
(
obj
,
"cannot read %s: %m"
,
path
);
clearerr
(
stream
);
line
=
NULL
;
}
fclose
(
stream
);
if
(
len
>=
1
&&
line
[
len
-
1
]
==
'\n'
)
line
[
--
len
]
=
'\0'
;
return
line
;
}
/**********************************************************************
/**********************************************************************
* Callback to update params on the fly
* Callback to update params on the fly
**********************************************************************/
**********************************************************************/
...
...
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