Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
6531388a
Commit
6531388a
authored
Jan 08, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upnp_intel: split the big cpp file in two, declaration and implementation.
parent
4e25d25b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
229 additions
and
209 deletions
+229
-209
modules/services_discovery/Modules.am
modules/services_discovery/Modules.am
+1
-1
modules/services_discovery/upnp_intel.cpp
modules/services_discovery/upnp_intel.cpp
+9
-208
modules/services_discovery/upnp_intel.hpp
modules/services_discovery/upnp_intel.hpp
+219
-0
No files found.
modules/services_discovery/Modules.am
View file @
6531388a
...
...
@@ -2,6 +2,6 @@ SOURCES_sap = sap.c
SOURCES_hal = hal.c
SOURCES_shout = shout.c
SOURCES_upnp_cc = upnp_cc.cpp
SOURCES_upnp_intel = upnp_intel.cpp
SOURCES_upnp_intel = upnp_intel.cpp
upnp_intel.hpp
SOURCES_bonjour = bonjour.c
SOURCES_podcast = podcast.c
modules/services_discovery/upnp_intel.cpp
View file @
6531388a
...
...
@@ -29,38 +29,22 @@
\TODO: Debug messages: "__FILE__, __LINE__" ok ???, Wrn/Err ???
\TODO: Change names to VLC standard ???
*/
#include <vector>
#include <string>
#include <upnp/upnp.h>
#include <upnp/upnptools.h>
#undef PACKAGE_NAME
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include "upnp_intel.hpp"
#include <vlc_plugin.h>
#include <vlc_services_discovery.h>
// Constants
// Constants
const
char
*
MEDIA_SERVER_DEVICE_TYPE
=
"urn:schemas-upnp-org:device:MediaServer:1"
;
const
char
*
CONTENT_DIRECTORY_SERVICE_TYPE
=
"urn:schemas-upnp-org:service:ContentDirectory:1"
;
// Classes
class
MediaServer
;
class
MediaServerList
;
class
Item
;
class
Container
;
class
Lockable
;
// VLC handle
struct
services_discovery_sys_t
{
UpnpClient_Handle
clientHandle
;
...
...
@@ -68,202 +52,19 @@ struct services_discovery_sys_t
Lockable
*
callbackLock
;
};
// Class definitions...
class
Lockable
{
public:
Lockable
()
{
vlc_mutex_init
(
&
_mutex
);
}
~
Lockable
()
{
vlc_mutex_destroy
(
&
_mutex
);
}
void
lock
()
{
vlc_mutex_lock
(
&
_mutex
);
}
void
unlock
()
{
vlc_mutex_unlock
(
&
_mutex
);
}
private:
vlc_mutex_t
_mutex
;
};
class
Locker
{
public:
Locker
(
Lockable
*
l
)
{
_lockable
=
l
;
_lockable
->
lock
();
}
~
Locker
()
{
_lockable
->
unlock
();
}
private:
Lockable
*
_lockable
;
};
class
MediaServer
{
public:
static
void
parseDeviceDescription
(
IXML_Document
*
doc
,
const
char
*
location
,
services_discovery_t
*
p_sd
);
MediaServer
(
const
char
*
UDN
,
const
char
*
friendlyName
,
services_discovery_t
*
p_sd
);
~
MediaServer
();
const
char
*
getUDN
()
const
;
const
char
*
getFriendlyName
()
const
;
void
setContentDirectoryEventURL
(
const
char
*
url
);
const
char
*
getContentDirectoryEventURL
()
const
;
void
setContentDirectoryControlURL
(
const
char
*
url
);
const
char
*
getContentDirectoryControlURL
()
const
;
void
subscribeToContentDirectory
();
void
fetchContents
();
void
setInputItem
(
input_item_t
*
p_input_item
);
bool
compareSID
(
const
char
*
sid
);
private:
bool
_fetchContents
(
Container
*
parent
);
void
_buildPlaylist
(
Container
*
container
);
IXML_Document
*
_browseAction
(
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
);
services_discovery_t
*
_p_sd
;
Container
*
_contents
;
input_item_t
*
_inputItem
;
std
::
string
_UDN
;
std
::
string
_friendlyName
;
std
::
string
_contentDirectoryEventURL
;
std
::
string
_contentDirectoryControlURL
;
int
_subscriptionTimeOut
;
Upnp_SID
_subscriptionID
;
};
class
MediaServerList
{
public:
MediaServerList
(
services_discovery_t
*
p_sd
);
~
MediaServerList
();
bool
addServer
(
MediaServer
*
s
);
void
removeServer
(
const
char
*
UDN
);
MediaServer
*
getServer
(
const
char
*
UDN
);
MediaServer
*
getServerBySID
(
const
char
*
);
private:
services_discovery_t
*
_p_sd
;
std
::
vector
<
MediaServer
*>
_list
;
};
class
Item
{
public:
Item
(
Container
*
parent
,
const
char
*
objectID
,
const
char
*
title
,
const
char
*
resource
);
~
Item
();
const
char
*
getObjectID
()
const
;
const
char
*
getTitle
()
const
;
const
char
*
getResource
()
const
;
void
setInputItem
(
input_item_t
*
p_input_item
);
input_item_t
*
getInputItem
()
const
;
private:
input_item_t
*
_inputItem
;
Container
*
_parent
;
std
::
string
_objectID
;
std
::
string
_title
;
std
::
string
_resource
;
};
class
Container
{
public:
Container
(
Container
*
parent
,
const
char
*
objectID
,
const
char
*
title
);
~
Container
();
void
addItem
(
Item
*
item
);
void
addContainer
(
Container
*
container
);
const
char
*
getObjectID
()
const
;
const
char
*
getTitle
()
const
;
unsigned
int
getNumItems
()
const
;
unsigned
int
getNumContainers
()
const
;
Item
*
getItem
(
unsigned
int
i
)
const
;
Container
*
getContainer
(
unsigned
int
i
)
const
;
Container
*
getParent
();
void
setInputItem
(
input_item_t
*
p_input_item
);
input_item_t
*
getInputItem
()
const
;
private:
input_item_t
*
_inputItem
;
Container
*
_parent
;
std
::
string
_objectID
;
std
::
string
_title
;
std
::
vector
<
Item
*>
_items
;
std
::
vector
<
Container
*>
_containers
;
};
// VLC callback prototypes
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
// Module descriptor
vlc_module_begin
();
set_shortname
(
"UPnP"
);
set_description
(
N_
(
"Universal Plug'n'Play discovery"
)
);
set_category
(
CAT_PLAYLIST
);
set_subcategory
(
SUBCAT_PLAYLIST_SD
);
set_capability
(
"services_discovery"
,
0
);
set_callbacks
(
Open
,
Close
);
set_shortname
(
"UPnP"
);
set_description
(
N_
(
"Universal Plug'n'Play discovery"
)
);
set_category
(
CAT_PLAYLIST
);
set_subcategory
(
SUBCAT_PLAYLIST_SD
);
set_capability
(
"services_discovery"
,
0
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
...
...
modules/services_discovery/upnp_intel.hpp
0 → 100644
View file @
6531388a
/*****************************************************************************
* Upnp_intel.hpp : UPnP discovery module (Intel SDK) header
*****************************************************************************
* Copyright (C) 2004-2008 the VideoLAN team
* $Id$
*
* Authors: Rémi Denis-Courmont <rem # videolan.org> (original plugin)
* Christian Henz <henz # c-lab.de>
* Mirsal Ennaime <mirsal dot ennaime at gmail dot com>
*
* UPnP Plugin using the Intel SDK (libupnp) instead of CyberLink
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vector>
#include <string>
#include <upnp/upnp.h>
#include <upnp/upnptools.h>
#include <vlc_common.h>
// Classes
class
Container
;
class
Lockable
{
public:
Lockable
()
{
vlc_mutex_init
(
&
_mutex
);
}
~
Lockable
()
{
vlc_mutex_destroy
(
&
_mutex
);
}
void
lock
()
{
vlc_mutex_lock
(
&
_mutex
);
}
void
unlock
()
{
vlc_mutex_unlock
(
&
_mutex
);
}
private:
vlc_mutex_t
_mutex
;
};
class
Locker
{
public:
Locker
(
Lockable
*
l
)
{
_lockable
=
l
;
_lockable
->
lock
();
}
~
Locker
()
{
_lockable
->
unlock
();
}
private:
Lockable
*
_lockable
;
};
class
MediaServer
{
public:
static
void
parseDeviceDescription
(
IXML_Document
*
doc
,
const
char
*
location
,
services_discovery_t
*
p_sd
);
MediaServer
(
const
char
*
UDN
,
const
char
*
friendlyName
,
services_discovery_t
*
p_sd
);
~
MediaServer
();
const
char
*
getUDN
()
const
;
const
char
*
getFriendlyName
()
const
;
void
setContentDirectoryEventURL
(
const
char
*
url
);
const
char
*
getContentDirectoryEventURL
()
const
;
void
setContentDirectoryControlURL
(
const
char
*
url
);
const
char
*
getContentDirectoryControlURL
()
const
;
void
subscribeToContentDirectory
();
void
fetchContents
();
void
setInputItem
(
input_item_t
*
p_input_item
);
bool
compareSID
(
const
char
*
sid
);
private:
bool
_fetchContents
(
Container
*
parent
);
void
_buildPlaylist
(
Container
*
container
);
IXML_Document
*
_browseAction
(
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
);
services_discovery_t
*
_p_sd
;
Container
*
_contents
;
input_item_t
*
_inputItem
;
std
::
string
_UDN
;
std
::
string
_friendlyName
;
std
::
string
_contentDirectoryEventURL
;
std
::
string
_contentDirectoryControlURL
;
int
_subscriptionTimeOut
;
Upnp_SID
_subscriptionID
;
};
class
MediaServerList
{
public:
MediaServerList
(
services_discovery_t
*
p_sd
);
~
MediaServerList
();
bool
addServer
(
MediaServer
*
s
);
void
removeServer
(
const
char
*
UDN
);
MediaServer
*
getServer
(
const
char
*
UDN
);
MediaServer
*
getServerBySID
(
const
char
*
);
private:
services_discovery_t
*
_p_sd
;
std
::
vector
<
MediaServer
*>
_list
;
};
class
Item
{
public:
Item
(
Container
*
parent
,
const
char
*
objectID
,
const
char
*
title
,
const
char
*
resource
);
~
Item
();
const
char
*
getObjectID
()
const
;
const
char
*
getTitle
()
const
;
const
char
*
getResource
()
const
;
void
setInputItem
(
input_item_t
*
p_input_item
);
input_item_t
*
getInputItem
()
const
;
private:
input_item_t
*
_inputItem
;
Container
*
_parent
;
std
::
string
_objectID
;
std
::
string
_title
;
std
::
string
_resource
;
};
class
Container
{
public:
Container
(
Container
*
parent
,
const
char
*
objectID
,
const
char
*
title
);
~
Container
();
void
addItem
(
Item
*
item
);
void
addContainer
(
Container
*
container
);
const
char
*
getObjectID
()
const
;
const
char
*
getTitle
()
const
;
unsigned
int
getNumItems
()
const
;
unsigned
int
getNumContainers
()
const
;
Item
*
getItem
(
unsigned
int
i
)
const
;
Container
*
getContainer
(
unsigned
int
i
)
const
;
Container
*
getParent
();
void
setInputItem
(
input_item_t
*
p_input_item
);
input_item_t
*
getInputItem
()
const
;
private:
input_item_t
*
_inputItem
;
Container
*
_parent
;
std
::
string
_objectID
;
std
::
string
_title
;
std
::
vector
<
Item
*>
_items
;
std
::
vector
<
Container
*>
_containers
;
};
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