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
495b0633
Commit
495b0633
authored
Nov 27, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LIRC: do not use pf_run
parent
0ca738e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
modules/control/lirc.c
modules/control/lirc.c
+24
-14
No files found.
modules/control/lirc.c
View file @
495b0633
...
@@ -73,14 +73,14 @@ vlc_module_end ()
...
@@ -73,14 +73,14 @@ vlc_module_end ()
struct
intf_sys_t
struct
intf_sys_t
{
{
struct
lirc_config
*
config
;
struct
lirc_config
*
config
;
vlc_thread_t
thread
;
int
i_fd
;
int
i_fd
;
};
};
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
);
static
void
*
Run
(
void
*
);
static
void
Process
(
intf_thread_t
*
);
static
void
Process
(
intf_thread_t
*
);
...
@@ -91,40 +91,45 @@ static int Open( vlc_object_t *p_this )
...
@@ -91,40 +91,45 @@ static int Open( vlc_object_t *p_this )
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
;
intf_sys_t
*
p_sys
;
char
*
psz_file
;
/* Allocate instance and initialize some members */
/* Allocate instance and initialize some members */
p_intf
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
p_intf
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
p_sys
==
NULL
)
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
p_intf
->
pf_run
=
Run
;
p_intf
->
pf_run
=
NULL
;
p_sys
->
i_fd
=
lirc_init
(
"vlc"
,
1
);
p_sys
->
i_fd
=
lirc_init
(
"vlc"
,
1
);
if
(
p_sys
->
i_fd
==
-
1
)
if
(
p_sys
->
i_fd
==
-
1
)
{
{
msg_Err
(
p_intf
,
"lirc initialisation failed"
);
msg_Err
(
p_intf
,
"lirc initialisation failed"
);
goto
e
xit
;
goto
e
rror
;
}
}
/* We want polling */
/* We want polling */
fcntl
(
p_sys
->
i_fd
,
F_SETFL
,
fcntl
(
p_sys
->
i_fd
,
F_GETFL
)
|
O_NONBLOCK
);
fcntl
(
p_sys
->
i_fd
,
F_SETFL
,
fcntl
(
p_sys
->
i_fd
,
F_GETFL
)
|
O_NONBLOCK
);
/* Read the configuration file */
/* Read the configuration file */
psz_file
=
var_CreateGetNonEmptyString
(
p_intf
,
"lirc-file"
);
char
*
psz_file
=
var_InheritString
(
p_intf
,
"lirc-file"
);
if
(
lirc_readconfig
(
psz_file
,
&
p_sys
->
config
,
NULL
)
!=
0
)
int
val
=
lirc_readconfig
(
psz_file
,
&
p_sys
->
config
,
NULL
);
free
(
psz_file
);
if
(
val
!=
0
)
{
{
msg_Err
(
p_intf
,
"failure while reading lirc config"
);
msg_Err
(
p_intf
,
"failure while reading lirc config"
);
free
(
psz_file
);
lirc_deinit
();
goto
exit
;
goto
error
;
}
if
(
vlc_clone
(
&
p_sys
->
thread
,
Run
,
p_intf
,
VLC_THREAD_PRIORITY_LOW
)
)
{
lirc_freeconfig
(
p_sys
->
config
);
lirc_deinit
();
goto
error
;
}
}
free
(
psz_file
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
exit:
error:
if
(
p_sys
->
i_fd
!=
-
1
)
lirc_deinit
();
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -137,6 +142,9 @@ static void Close( vlc_object_t *p_this )
...
@@ -137,6 +142,9 @@ static void Close( vlc_object_t *p_this )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
vlc_cancel
(
p_sys
->
thread
);
vlc_join
(
p_sys
->
thread
,
NULL
);
/* Destroy structure */
/* Destroy structure */
lirc_freeconfig
(
p_sys
->
config
);
lirc_freeconfig
(
p_sys
->
config
);
lirc_deinit
();
lirc_deinit
();
...
@@ -146,8 +154,9 @@ static void Close( vlc_object_t *p_this )
...
@@ -146,8 +154,9 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
/*****************************************************************************
* Run: main loop
* Run: main loop
*****************************************************************************/
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
p_intf
)
static
void
*
Run
(
void
*
data
)
{
{
intf_thread_t
*
p_intf
=
data
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
for
(
;;
)
for
(
;;
)
...
@@ -167,6 +176,7 @@ static void Run( intf_thread_t *p_intf )
...
@@ -167,6 +176,7 @@ static void Run( intf_thread_t *p_intf )
Process
(
p_intf
);
Process
(
p_intf
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
}
}
return
NULL
;
}
}
static
void
Process
(
intf_thread_t
*
p_intf
)
static
void
Process
(
intf_thread_t
*
p_intf
)
...
...
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