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
d8a18326
Commit
d8a18326
authored
Aug 04, 2004
by
Derk-Jan Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Fix
parent
7476804c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
239 additions
and
0 deletions
+239
-0
modules/stream_out/announce.c
modules/stream_out/announce.c
+172
-0
modules/stream_out/announce.h
modules/stream_out/announce.h
+67
-0
No files found.
modules/stream_out/announce.c
0 → 100644
View file @
d8a18326
/*****************************************************************************
* announce.c : Session announcement
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
* Damien Lucas <nitrox@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h>
/* free() */
#include <errno.h>
/* ENOMEM */
#include <stdio.h>
/* sprintf() */
#include <vlc/vlc.h>
#include <vlc/sout.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
# ifndef IN_MULTICAST
# define IN_MULTICAST(a) IN_CLASSD(a)
# endif
#else
# include <sys/socket.h>
#endif
#ifdef HAVE_SLP_H
# include <slp.h>
#endif
#include "announce.h"
#include "network.h"
#define DEFAULT_PORT 1234
#ifdef HAVE_SLP_H
/*****************************************************************************
* sout_SLPBuildName: Builds a service name according to SLP standard
*****************************************************************************/
static
char
*
sout_SLPBuildName
(
char
*
psz_url
,
char
*
psz_name
)
{
char
*
psz_service
;
unsigned
int
i_size
;
/* name to build is: service:vlc.services.videolan://$(url) */
i_size
=
8
+
12
+
12
+
5
+
strlen
(
psz_url
)
+
1
;
psz_service
=
(
char
*
)
malloc
(
i_size
*
sizeof
(
char
));
snprintf
(
psz_service
,
i_size
,
"service:vlc.services.videolan://udp:@%s"
,
psz_url
);
/* How piggy ! */
psz_service
[
i_size
]
=
'\0'
;
/* Just to make sure */
return
psz_service
;
}
/*****************************************************************************
* sout_SLPReport: Reporting function. Unused at the moment but needed
*****************************************************************************/
static
void
sout_SLPReport
(
SLPHandle
slp_handle
,
SLPError
slp_error
,
void
*
cookie
)
{
}
#endif
/*****************************************************************************
* sout_SLPReg: Registers the program with SLP
*****************************************************************************/
int
sout_SLPReg
(
sout_instance_t
*
p_sout
,
char
*
psz_url
,
char
*
psz_name
)
{
#ifdef HAVE_SLP_H
SLPHandle
slp_handle
;
SLPError
slp_res
;
char
*
psz_service
=
sout_SLPBuildName
(
psz_url
,
psz_name
);
if
(
SLPOpen
(
NULL
,
SLP_FALSE
,
&
slp_handle
)
!=
SLP_OK
)
{
msg_Warn
(
p_sout
,
"Unable to initialize SLP"
);
return
-
1
;
}
msg_Info
(
p_sout
,
"Registering %s (name: %s) in SLP"
,
psz_service
,
psz_name
);
slp_res
=
SLPReg
(
slp_handle
,
psz_service
,
SLP_LIFETIME_MAXIMUM
,
NULL
,
psz_name
,
SLP_TRUE
,
sout_SLPReport
,
NULL
);
if
(
slp_res
!=
SLP_OK
)
{
msg_Warn
(
p_sout
,
"Error while registering service: %i"
,
slp_res
);
return
-
1
;
}
return
0
;
#else
/* This function should never be called if this is false */
return
-
1
;
#endif
}
/*****************************************************************************
* sout_SLDePReg: Unregisters the program from SLP
*****************************************************************************/
int
sout_SLPDereg
(
sout_instance_t
*
p_sout
,
char
*
psz_url
,
char
*
psz_name
)
{
#ifdef HAVE_SLP_H
SLPHandle
slp_handle
;
SLPError
slp_res
;
char
*
psz_service
=
sout_SLPBuildName
(
psz_url
,
psz_name
);
if
(
SLPOpen
(
NULL
,
SLP_FALSE
,
&
slp_handle
)
!=
SLP_OK
)
{
msg_Warn
(
p_sout
,
"Unable to initialize SLP"
);
return
-
1
;
}
msg_Info
(
p_sout
,
"Unregistering %s from SLP"
,
psz_service
);
slp_res
=
SLPDereg
(
slp_handle
,
psz_service
,
sout_SLPReport
,
NULL
);
if
(
slp_res
!=
SLP_OK
)
{
msg_Warn
(
p_sout
,
"Error while registering service: %i"
,
slp_res
);
return
-
1
;
}
return
0
;
#else
/* This function should never be called if this is false */
return
-
1
;
#endif
}
modules/stream_out/announce.h
0 → 100644
View file @
d8a18326
/*****************************************************************************
* announce.h : Session announcement
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id$
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#if defined( UNDER_CE )
# include <winsock.h>
#elif defined( WIN32 )
# include <winsock2.h>
# include <ws2tcpip.h>
# define close closesocket
#else
# include <netdb.h>
/* hostent ... */
# include <sys/socket.h>
# include <netinet/in.h>
# ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
/* inet_ntoa(), inet_aton() */
# endif
#endif
#ifdef HAVE_SLP_H
# include <slp.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
/*****************************************************************************
* slp_session_t: SLP Session descriptor
*****************************************************************************/
struct
slp_session_t
{
char
*
psz_url
;
char
*
psz_name
;
};
typedef
struct
slp_session_t
slp_session_t
;
/*****************************************************************************
* Prototypes
*****************************************************************************/
int
sout_SLPReg
(
sout_instance_t
*
,
char
*
,
char
*
);
int
sout_SLPDereg
(
sout_instance_t
*
,
char
*
,
char
*
);
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