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
0336f134
Commit
0336f134
authored
Feb 09, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial announce API cleanup
To be continued
parent
c1ebd402
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
66 deletions
+37
-66
include/vlc_sout.h
include/vlc_sout.h
+1
-9
modules/stream_out/rtp.c
modules/stream_out/rtp.c
+1
-1
modules/stream_out/standard.c
modules/stream_out/standard.c
+1
-2
src/stream_output/announce.c
src/stream_output/announce.c
+13
-32
src/stream_output/sap.c
src/stream_output/sap.c
+21
-10
src/stream_output/stream_output.h
src/stream_output/stream_output.h
+0
-12
No files found.
include/vlc_sout.h
View file @
0336f134
...
...
@@ -220,25 +220,17 @@ struct session_descriptor_t
char
*
psz_group
;
sap_session_t
*
p_sap
;
/* If we have a sap session, remember it */
char
*
psz_sdp
;
vlc_bool_t
b_rtp
;
};
#define METHOD_TYPE_SAP 1
struct
announce_method_t
{
int
i_type
;
};
VLC_EXPORT
(
int
,
sout_AnnounceRegister
,
(
sout_instance_t
*
,
session_descriptor_t
*
,
announce_method_t
*
)
);
VLC_EXPORT
(
session_descriptor_t
*
,
sout_AnnounceRegisterSDP
,
(
sout_instance_t
*
,
const
char
*
,
const
char
*
,
announce_method_t
*
)
);
VLC_EXPORT
(
int
,
sout_AnnounceUnRegister
,
(
sout_instance_t
*
,
session_descriptor_t
*
)
);
VLC_EXPORT
(
session_descriptor_t
*
,
sout_AnnounceSessionCreate
,
(
void
)
);
VLC_EXPORT
(
void
,
sout_AnnounceSessionDestroy
,
(
session_descriptor_t
*
)
);
VLC_EXPORT
(
announce_method_t
*
,
sout_
AnnounceMethodCreate
,
(
int
)
);
VLC_EXPORT
(
announce_method_t
*
,
sout_
SAPMethod
,
(
void
)
);
#ifdef __cplusplus
}
...
...
modules/stream_out/rtp.c
View file @
0336f134
...
...
@@ -1533,7 +1533,7 @@ static int SapSetup( sout_stream_t *p_stream )
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
sout_instance_t
*
p_sout
=
p_stream
->
p_sout
;
announce_method_t
*
p_method
=
sout_
AnnounceMethodCreate
(
METHOD_TYPE_SAP
);
announce_method_t
*
p_method
=
sout_
SAPMethod
(
);
/* Remove the previous session */
if
(
p_sys
->
p_session
!=
NULL
)
...
...
modules/stream_out/standard.c
View file @
0336f134
...
...
@@ -316,8 +316,7 @@ static int Open( vlc_object_t *p_this )
(
strstr
(
psz_access
,
"udp"
)
||
strstr
(
psz_access
,
"rtp"
)
)
)
{
session_descriptor_t
*
p_session
=
sout_AnnounceSessionCreate
();
announce_method_t
*
p_method
=
sout_AnnounceMethodCreate
(
METHOD_TYPE_SAP
);
announce_method_t
*
p_method
=
sout_SAPMethod
();
vlc_url_t
url
;
var_Get
(
p_stream
,
SOUT_CFG_PREFIX
"name"
,
&
val
);
...
...
src/stream_output/announce.c
View file @
0336f134
/*****************************************************************************
* announce.c : announce handler
*****************************************************************************
* Copyright (C) 2002-200
4
the VideoLAN team
* Copyright (C) 2002-200
7
the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
...
...
@@ -32,6 +32,10 @@
#include <vlc_sout.h>
#include "stream_output.h"
struct
announce_method_t
{
}
sap_method
;
/****************************************************************************
* Sout-side functions
****************************************************************************/
...
...
@@ -103,11 +107,6 @@ session_descriptor_t *sout_AnnounceRegisterSDP( sout_instance_t *p_sout,
vlc_object_yield
(
p_announce
);
}
if
(
p_method
->
i_type
!=
METHOD_TYPE_SAP
)
{
msg_Warn
(
p_sout
,
"forcing SAP announcement"
);
}
p_session
=
sout_AnnounceSessionCreate
();
p_session
->
psz_sdp
=
strdup
(
psz_sdp
);
p_session
->
psz_uri
=
strdup
(
psz_uri
);
...
...
@@ -180,21 +179,11 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session )
}
/**
* Create and initialize an announcement method structure
*
* \param i_type METHOD_TYPE_SAP
* \return a new announce_method structure
* \return the SAP announce method
*/
announce_method_t
*
sout_
AnnounceMethodCreate
(
int
i_type
)
announce_method_t
*
sout_
SAPMethod
(
void
)
{
announce_method_t
*
p_method
;
p_method
=
(
announce_method_t
*
)
malloc
(
sizeof
(
announce_method_t
)
);
if
(
p_method
==
NULL
)
return
NULL
;
p_method
->
i_type
=
i_type
;
return
p_method
;
return
&
sap_method
;
}
/************************************************************************
...
...
@@ -233,12 +222,11 @@ announce_handler_t *__announce_HandlerCreate( vlc_object_t *p_this )
*/
int
announce_HandlerDestroy
(
announce_handler_t
*
p_announce
)
{
if
(
p_announce
->
p_sap
)
{
p_announce
->
p_sap
->
b_die
=
VLC_TRUE
;
((
vlc_object_t
*
)
p_announce
->
p_sap
)
->
b_die
=
VLC_TRUE
;
/* Wait for the SAP thread to exit */
vlc_thread_join
(
p_announce
->
p_sap
);
vlc_thread_join
(
(
vlc_object_t
*
)
p_announce
->
p_sap
);
announce_SAPHandlerDestroy
(
p_announce
->
p_sap
);
}
...
...
@@ -255,7 +243,7 @@ int announce_Register( announce_handler_t *p_announce,
{
msg_Dbg
(
p_announce
,
"registering announce"
);
if
(
p_method
->
i_type
==
METHOD_TYPE_SAP
)
if
(
p_method
==
&
sap_method
)
{
/* Do we already have a SAP announce handler ? */
if
(
!
p_announce
->
p_sap
)
...
...
@@ -275,7 +263,7 @@ int announce_Register( announce_handler_t *p_announce,
}
else
{
msg_
Dbg
(
p_announce
,
"announce type unsupported"
);
msg_
Err
(
p_announce
,
"announce type unsupported"
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;;
...
...
@@ -287,14 +275,7 @@ int announce_UnRegister( announce_handler_t *p_announce,
session_descriptor_t
*
p_session
)
{
msg_Dbg
(
p_announce
,
"unregistering announce"
);
if
(
p_session
->
p_sap
!=
NULL
)
/* SAP Announce */
{
if
(
!
p_announce
->
p_sap
)
{
msg_Err
(
p_announce
,
"can't remove announce, no SAP handler"
);
return
VLC_ENOOBJ
;
}
if
(
p_announce
->
p_sap
)
p_announce
->
p_sap
->
pf_del
(
p_announce
->
p_sap
,
p_session
);
}
return
VLC_SUCCESS
;
}
src/stream_output/sap.c
View file @
0336f134
...
...
@@ -72,6 +72,19 @@ struct sap_address_t
int
i_limit
;
};
/* A SAP session descriptor, enqueued in the SAP handler queue */
struct
sap_session_t
{
char
*
psz_sdp
;
uint8_t
*
psz_data
;
unsigned
i_length
;
sap_address_t
*
p_address
;
session_descriptor_t
*
p_sd
;
/* Last and next send */
mtime_t
i_last
;
mtime_t
i_next
;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
...
...
@@ -252,7 +265,6 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
msg_Err
(
p_sap
,
"This should not happen. VLC needs fixing."
);
return
VLC_EGENERIC
;
}
/* Determine SAP multicast address automatically */
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
hints
.
ai_socktype
=
SOCK_DGRAM
;
...
...
@@ -369,6 +381,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
/* XXX: Check for dupes */
p_sap_session
=
(
sap_session_t
*
)
malloc
(
sizeof
(
sap_session_t
));
p_sap_session
->
p_sd
=
p_session
;
p_sap_session
->
p_address
=
NULL
;
/* Add the address to the buffer */
...
...
@@ -510,9 +523,6 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
msg_Dbg
(
p_sap
,
"%i addresses, %i sessions"
,
p_sap
->
i_addresses
,
p_sap
->
i_sessions
);
/* Remember the SAP session for later deletion */
p_session
->
p_sap
=
p_sap_session
;
vlc_mutex_unlock
(
&
p_sap
->
object_lock
);
return
VLC_SUCCESS
;
...
...
@@ -525,20 +535,21 @@ static int announce_SAPAnnounceDel( sap_handler_t *p_sap,
int
i
;
vlc_mutex_lock
(
&
p_sap
->
object_lock
);
msg_Dbg
(
p_sap
,
"removing SAP announce %p"
,
p_session
->
p_sap
);
msg_Dbg
(
p_sap
,
"removing session %p from SAP"
,
p_session
);
/* Dequeue the announce */
for
(
i
=
0
;
i
<
p_sap
->
i_sessions
;
i
++
)
{
if
(
p_session
->
p_sap
==
p_sap
->
pp_sessions
[
i
]
)
if
(
p_session
==
p_sap
->
pp_sessions
[
i
]
->
p_sd
)
{
sap_session_t
*
p_mysession
=
p_sap
->
pp_sessions
[
i
];
REMOVE_ELEM
(
p_sap
->
pp_sessions
,
p_sap
->
i_sessions
,
i
);
FREENULL
(
p_session
->
p_sap
->
psz_sdp
);
FREENULL
(
p_session
->
p_sap
->
psz_data
);
free
(
p_
session
->
p_sap
);
free
(
p_mysession
->
psz_sdp
);
free
(
p_mysession
->
psz_data
);
free
(
p_
mysession
);
break
;
}
}
...
...
src/stream_output/stream_output.h
View file @
0336f134
...
...
@@ -47,18 +47,6 @@ VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t
/* Announce system */
/* A SAP session descriptor, enqueued in the SAP handler queue */
struct
sap_session_t
{
char
*
psz_sdp
;
uint8_t
*
psz_data
;
unsigned
i_length
;
sap_address_t
*
p_address
;
/* Last and next send */
mtime_t
i_last
;
mtime_t
i_next
;
};
/* The SAP handler, running in a separate thread */
struct
sap_handler_t
{
...
...
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