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
50083d4a
Commit
50083d4a
authored
Jun 16, 2008
by
Przemyslaw Fiala
Committed by
Rémi Denis-Courmont
Jun 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MMS stream pausing
Signed-off-by:
Rémi Denis-Courmont
<
rdenis@simphalempin.com
>
parent
a58caab6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
2 deletions
+90
-2
modules/access/mms/mmsh.c
modules/access/mms/mmsh.c
+9
-1
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+66
-1
modules/access/mms/mmstu.h
modules/access/mms/mmstu.h
+15
-0
No files found.
modules/access/mms/mmsh.c
View file @
50083d4a
...
...
@@ -240,6 +240,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
bool
*
pb_bool
;
bool
b_bool
;
int
*
pi_int
;
int64_t
*
pi_64
;
int
i_int
;
...
...
@@ -253,11 +254,11 @@ static int Control( access_t *p_access, int i_query, va_list args )
break
;
case
ACCESS_CAN_FASTSEEK
:
case
ACCESS_CAN_PAUSE
:
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
pb_bool
=
false
;
break
;
case
ACCESS_CAN_PAUSE
:
case
ACCESS_CAN_CONTROL_PACE
:
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
pb_bool
=
true
;
...
...
@@ -285,6 +286,13 @@ static int Control( access_t *p_access, int i_query, va_list args )
/* */
case
ACCESS_SET_PAUSE_STATE
:
b_bool
=
(
bool
)
va_arg
(
args
,
int
);
if
(
b_bool
)
Stop
(
p_access
);
else
Seek
(
p_access
,
p_access
->
info
.
i_pos
);
break
;
case
ACCESS_GET_TITLE_INFO
:
case
ACCESS_SET_TITLE
:
case
ACCESS_SET_SEEKPOINT
:
...
...
modules/access/mms/mmstu.c
View file @
50083d4a
...
...
@@ -92,6 +92,7 @@ static int mms_HeaderMediaRead( access_t *, int );
static
int
mms_ReceivePacket
(
access_t
*
);
static
void
KeepAliveThread
(
vlc_object_t
*
p_this
);
int
MMSTUOpen
(
access_t
*
p_access
)
{
...
...
@@ -116,12 +117,15 @@ int MMSTUOpen( access_t *p_access )
p_sys
->
i_timeout
=
var_CreateGetInteger
(
p_access
,
"mms-timeout"
);
vlc_mutex_init
(
&
p_sys
->
lock_netwrite
);
/* *** Parse URL and get server addr/port and path *** */
vlc_UrlParse
(
&
p_sys
->
url
,
p_access
->
psz_path
,
0
);
if
(
p_sys
->
url
.
psz_host
==
NULL
||
*
p_sys
->
url
.
psz_host
==
'\0'
)
{
msg_Err
(
p_access
,
"invalid server name"
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_mutex_destroy
(
&
p_sys
->
lock_netwrite
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -162,6 +166,7 @@ int MMSTUOpen( access_t *p_access )
{
msg_Err
(
p_access
,
"cannot connect to server"
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_mutex_destroy
(
&
p_sys
->
lock_netwrite
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -196,6 +201,16 @@ int MMSTUOpen( access_t *p_access )
MMSTUClose
(
p_access
);
return
VLC_EGENERIC
;
}
/* Keep the connection alive when paused */
p_sys
->
p_keepalive_thread
=
vlc_object_create
(
p_access
,
sizeof
(
mmstu_keepalive_thread_t
)
);
p_sys
->
p_keepalive_thread
->
p_access
=
p_access
;
p_sys
->
p_keepalive_thread
->
b_paused
=
false
;
p_sys
->
p_keepalive_thread
->
b_thread_error
=
false
;
if
(
vlc_thread_create
(
p_sys
->
p_keepalive_thread
,
"mmstu keepalive thread"
,
KeepAliveThread
,
VLC_THREAD_PRIORITY_LOW
,
false
)
)
p_sys
->
p_keepalive_thread
->
b_thread_error
=
true
;
return
VLC_SUCCESS
;
}
...
...
@@ -206,11 +221,17 @@ void MMSTUClose( access_t *p_access )
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
vlc_object_kill
(
p_sys
->
p_keepalive_thread
);
if
(
!
p_sys
->
p_keepalive_thread
->
b_thread_error
)
vlc_thread_join
(
p_sys
->
p_keepalive_thread
);
vlc_object_release
(
p_sys
->
p_keepalive_thread
);
/* close connection with server */
MMSClose
(
p_access
);
/* free memory */
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_mutex_destroy
(
&
p_sys
->
lock_netwrite
);
free
(
p_sys
);
}
...
...
@@ -222,6 +243,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
bool
*
pb_bool
;
bool
b_bool
;
int
*
pi_int
;
int64_t
*
pi_64
;
int
i_int
;
...
...
@@ -236,11 +258,15 @@ static int Control( access_t *p_access, int i_query, va_list args )
break
;
case
ACCESS_CAN_FASTSEEK
:
case
ACCESS_CAN_PAUSE
:
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
pb_bool
=
false
;
break
;
case
ACCESS_CAN_PAUSE
:
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
pb_bool
=
true
;
break
;
case
ACCESS_CAN_CONTROL_PACE
:
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
...
...
@@ -274,6 +300,23 @@ static int Control( access_t *p_access, int i_query, va_list args )
/* */
case
ACCESS_SET_PAUSE_STATE
:
b_bool
=
(
bool
)
va_arg
(
args
,
int
);
if
(
b_bool
)
{
MMSStop
(
p_access
);
vlc_object_lock
(
p_sys
->
p_keepalive_thread
);
p_sys
->
p_keepalive_thread
->
b_paused
=
true
;
vlc_object_unlock
(
p_sys
->
p_keepalive_thread
);
}
else
{
Seek
(
p_access
,
p_access
->
info
.
i_pos
);
vlc_object_lock
(
p_sys
->
p_keepalive_thread
);
p_sys
->
p_keepalive_thread
->
b_paused
=
false
;
vlc_object_unlock
(
p_sys
->
p_keepalive_thread
);
}
break
;
case
ACCESS_GET_TITLE_INFO
:
case
ACCESS_SET_TITLE
:
case
ACCESS_SET_SEEKPOINT
:
...
...
@@ -986,8 +1029,10 @@ static int mms_CommandSend( access_t *p_access, int i_command,
var_buffer_add64
(
&
buffer
,
0
);
/* send it */
vlc_mutex_lock
(
&
p_sys
->
lock_netwrite
);
i_ret
=
net_Write
(
p_access
,
p_sys
->
i_handle_tcp
,
NULL
,
buffer
.
p_data
,
buffer
.
i_data
-
(
8
-
(
i_data
-
i_data_old
)
)
);
vlc_mutex_unlock
(
&
p_sys
->
lock_netwrite
);
if
(
i_ret
!=
buffer
.
i_data
-
(
8
-
(
i_data
-
i_data_old
)
)
)
{
msg_Err
(
p_access
,
"failed to send command"
);
...
...
@@ -1554,3 +1599,23 @@ static int mms_HeaderMediaRead( access_t *p_access, int i_type )
return
-
1
;
}
static
void
KeepAliveThread
(
vlc_object_t
*
p_this
)
{
mmstu_keepalive_thread_t
*
p_thread
=
(
mmstu_keepalive_thread_t
*
)
p_this
;
access_t
*
p_access
=
p_thread
->
p_access
;
bool
b_paused
;
bool
b_was_paused
=
false
;
vlc_object_lock
(
p_thread
);
while
(
vlc_object_alive
(
p_thread
)
)
{
b_paused
=
p_thread
->
b_paused
;
if
(
b_paused
&&
b_was_paused
)
mms_CommandSend
(
p_access
,
0x1b
,
0
,
0
,
NULL
,
0
);
b_was_paused
=
b_paused
;
vlc_object_timedwait
(
p_thread
,
mdate
()
+
10000000
);
}
vlc_object_unlock
(
p_thread
);
}
modules/access/mms/mmstu.h
View file @
50083d4a
...
...
@@ -33,6 +33,9 @@
#define MMS_CMD_HEADERSIZE 48
#define MMS_BUFFER_SIZE 100000
typedef
struct
mmstu_keepalive_thread_t
mmstu_keepalive_thread_t
;
struct
access_sys_t
{
int
i_proto
;
/* MMS_PROTO_TCP, MMS_PROTO_UDP */
...
...
@@ -92,6 +95,18 @@ struct access_sys_t
/* misc */
bool
b_seekable
;
mmstu_keepalive_thread_t
*
p_keepalive_thread
;
vlc_mutex_t
lock_netwrite
;
};
struct
mmstu_keepalive_thread_t
{
VLC_COMMON_MEMBERS
access_t
*
p_access
;
bool
b_paused
;
bool
b_thread_error
;
};
#endif
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