Changeset 979f5cc201141379f1153ad721b1a6ec4032e20f
- Timestamp:
- 09/15/07 22:10:50
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1189887050 +0000
- git-parent:
[d212179528ff468f9aed583eef8552203b32093f]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1189887050 +0000
- Message:
Announce API simplification
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r974be97 |
r979f5cc |
|
| 209 | 209 | |
|---|
| 210 | 210 | /**************************************************************************** |
|---|
| 211 | | * Announce handler mess |
|---|
| | 211 | * Announce handler |
|---|
| 212 | 212 | ****************************************************************************/ |
|---|
| 213 | 213 | VLC_EXPORT(session_descriptor_t*,sout_AnnounceRegisterSDP, (sout_instance_t *, const char *, const char *, const char *, announce_method_t* ) ); |
|---|
| 214 | 214 | VLC_EXPORT( int, sout_AnnounceUnRegister, (sout_instance_t *,session_descriptor_t* ) ); |
|---|
| 215 | 215 | |
|---|
| 216 | | VLC_EXPORT(void, sout_AnnounceSessionDestroy, (session_descriptor_t *) ); |
|---|
| 217 | 216 | VLC_EXPORT(announce_method_t*, sout_SAPMethod, (void) ); |
|---|
| 218 | 217 | VLC_EXPORT(void, sout_MethodRelease, (announce_method_t *) ); |
|---|
| rbc650c5 |
r979f5cc |
|
| 1197 | 1197 | sout_stream_sys_t *p_sys = p_stream->p_sys; |
|---|
| 1198 | 1198 | sout_instance_t *p_sout = p_stream->p_sout; |
|---|
| 1199 | | announce_method_t *p_method = sout_SAPMethod(); |
|---|
| 1200 | 1199 | |
|---|
| 1201 | 1200 | /* Remove the previous session */ |
|---|
| … | … | |
| 1203 | 1202 | { |
|---|
| 1204 | 1203 | sout_AnnounceUnRegister( p_sout, p_sys->p_session); |
|---|
| 1205 | | sout_AnnounceSessionDestroy( p_sys->p_session ); |
|---|
| 1206 | 1204 | p_sys->p_session = NULL; |
|---|
| 1207 | 1205 | } |
|---|
| … | … | |
| 1209 | 1207 | if( ( p_sys->i_es > 0 || p_sys->p_mux ) && p_sys->psz_sdp && *p_sys->psz_sdp ) |
|---|
| 1210 | 1208 | { |
|---|
| | 1209 | announce_method_t *p_method = sout_SAPMethod(); |
|---|
| 1211 | 1210 | p_sys->p_session = sout_AnnounceRegisterSDP( p_sout, SOUT_CFG_PREFIX, |
|---|
| 1212 | 1211 | p_sys->psz_sdp, |
|---|
| 1213 | 1212 | p_sys->psz_destination, |
|---|
| 1214 | 1213 | p_method ); |
|---|
| 1215 | | } |
|---|
| 1216 | | |
|---|
| 1217 | | sout_MethodRelease( p_method ); |
|---|
| | 1214 | sout_MethodRelease( p_method ); |
|---|
| | 1215 | } |
|---|
| | 1216 | |
|---|
| 1218 | 1217 | return VLC_SUCCESS; |
|---|
| 1219 | 1218 | } |
|---|
| r5a922f6 |
r979f5cc |
|
| 409 | 409 | |
|---|
| 410 | 410 | if( p_sys->p_session != NULL ) |
|---|
| 411 | | { |
|---|
| 412 | 411 | sout_AnnounceUnRegister( p_stream->p_sout, p_sys->p_session ); |
|---|
| 413 | | sout_AnnounceSessionDestroy( p_sys->p_session ); |
|---|
| 414 | | } |
|---|
| 415 | 412 | |
|---|
| 416 | 413 | sout_MuxDelete( p_sys->p_mux ); |
|---|
| r974be97 |
r979f5cc |
|
| 266 | 266 | sout_AccessOutWrite |
|---|
| 267 | 267 | sout_AnnounceRegisterSDP |
|---|
| 268 | | sout_AnnounceSessionDestroy |
|---|
| 269 | 268 | sout_AnnounceUnRegister |
|---|
| 270 | 269 | sout_MuxAddStream |
|---|
| rd212179 |
r979f5cc |
|
| 48 | 48 | |
|---|
| 49 | 49 | /** |
|---|
| 50 | | * Create and initialize a session descriptor |
|---|
| 51 | | * |
|---|
| 52 | | * \return a new session descriptor |
|---|
| 53 | | */ |
|---|
| 54 | | static session_descriptor_t * sout_AnnounceSessionCreate (vlc_object_t *obj, |
|---|
| 55 | | const char *cfgpref) |
|---|
| 56 | | { |
|---|
| 57 | | return calloc (1, sizeof (session_descriptor_t)); |
|---|
| 58 | | } |
|---|
| 59 | | |
|---|
| 60 | | /** |
|---|
| 61 | 50 | * Register a new session with the announce handler, using a pregenerated SDP |
|---|
| 62 | 51 | * |
|---|
| 63 | 52 | * \param p_sout a sout instance structure |
|---|
| 64 | 53 | * \param psz_sdp the SDP to register |
|---|
| 65 | | * \param psz_uri session address (needed for SAP address auto detection) |
|---|
| | 54 | * \param psz_dst session address (needed for SAP address auto detection) |
|---|
| 66 | 55 | * \param p_method an announce method descriptor |
|---|
| 67 | 56 | * \return the new session descriptor structure |
|---|
| … | … | |
| 69 | 58 | session_descriptor_t * |
|---|
| 70 | 59 | sout_AnnounceRegisterSDP( sout_instance_t *p_sout, const char *cfgpref, |
|---|
| 71 | | const char *psz_sdp, const char *psz_uri, |
|---|
| | 60 | const char *psz_sdp, const char *psz_dst, |
|---|
| 72 | 61 | announce_method_t *p_method ) |
|---|
| 73 | 62 | { |
|---|
| … | … | |
| 89 | 78 | } |
|---|
| 90 | 79 | |
|---|
| 91 | | p_session = sout_AnnounceSessionCreate(VLC_OBJECT (p_sout), cfgpref); |
|---|
| | 80 | p_session = malloc( sizeof( *p_session ) ); |
|---|
| | 81 | memset( p_session, 0, sizeof( *p_session ) ); |
|---|
| 92 | 82 | p_session->psz_sdp = strdup( psz_sdp ); |
|---|
| 93 | 83 | |
|---|
| 94 | 84 | /* GRUIK. We should not convert back-and-forth from string to numbers */ |
|---|
| 95 | 85 | struct addrinfo *res; |
|---|
| 96 | | if (vlc_getaddrinfo (VLC_OBJECT (p_sout), psz_uri, 0, NULL, &res) == 0) |
|---|
| | 86 | if (vlc_getaddrinfo (VLC_OBJECT (p_sout), psz_dst, 0, NULL, &res) == 0) |
|---|
| 97 | 87 | { |
|---|
| 98 | 88 | if (res->ai_addrlen <= sizeof (p_session->addr)) |
|---|
| … | … | |
| 129 | 119 | } |
|---|
| 130 | 120 | i_ret = announce_UnRegister( p_announce, p_session ); |
|---|
| | 121 | if( i_ret == 0 ) |
|---|
| | 122 | free( p_session ); |
|---|
| 131 | 123 | |
|---|
| 132 | 124 | vlc_object_release( p_announce ); |
|---|
| 133 | 125 | |
|---|
| 134 | 126 | return i_ret; |
|---|
| 135 | | } |
|---|
| 136 | | |
|---|
| 137 | | /** |
|---|
| 138 | | * Destroy a session descriptor and free all |
|---|
| 139 | | * |
|---|
| 140 | | * \param p_session the session to destroy |
|---|
| 141 | | * \return Nothing |
|---|
| 142 | | */ |
|---|
| 143 | | void sout_AnnounceSessionDestroy( session_descriptor_t *p_session ) |
|---|
| 144 | | { |
|---|
| 145 | | free( p_session ); |
|---|
| 146 | 127 | } |
|---|
| 147 | 128 | |
|---|