Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to merge the modification from cybergarage. #15

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b0fb36f
Add project for iOS.
jink2005 Nov 10, 2015
0516912
Add Readme
jink2005 Nov 10, 2015
f48dcba
Add the lib of upnp & av component for iOS. need debug on the play or…
jink2005 Nov 18, 2015
3e9b451
Add the lib project for iOS.
jink2005 Nov 18, 2015
4902a67
Add functions to play music.
jink2005 Dec 10, 2015
25aad06
Add Event Listener.
jink2005 Dec 13, 2015
5b6ec16
Modify: Keep the Render & Server Object to store the status of the sa…
jink2005 Dec 15, 2015
a388c81
Add get position info notification for UI.
jink2005 Dec 16, 2015
1eafeb7
Add the auto play next function and get media info from local and net…
jink2005 Dec 17, 2015
b73362a
Remote the useless file include in project.
jink2005 Dec 17, 2015
f98e147
Remove the no use property.
jink2005 Dec 18, 2015
1cc947e
Add UPnPDeviceManager.
jink2005 Dec 18, 2015
11b1a95
1. Add reference count for mUpnpDevice to fix crash when remove device.
jink2005 Dec 25, 2015
953efc4
add delegate function in Renderer to give a chance for app to prepare…
jink2005 Dec 26, 2015
ae8f67a
Add UI for air quality.
jink2005 Dec 31, 2015
a4d2a26
Update for show data on air quality.
jink2005 Dec 31, 2015
a354088
Update for Render Play with Server music.
jink2005 Jan 8, 2016
b48a9d8
Give interface for user to decide if render will auto control to skip…
jink2005 Jan 11, 2016
fef093c
Add code to create AvItem and add AvResource. Fix the mistake use for…
jink2005 Jan 12, 2016
c79aece
Change the time of get media info. Add metadata string for AvItems.
jink2005 Jan 13, 2016
41cfbbd
Add setManufacturer/ModelName for DMS.
jink2005 Jan 15, 2016
568c620
Remove the collection check when play only one music.
jink2005 Jan 18, 2016
9e8acb6
1. Add set artist, album, genre and parent id method. 2. Add method t…
jink2005 Jan 21, 2016
0fa7de8
Add static for single instance.
jink2005 Jan 26, 2016
e39ecb9
Merge from Official Base by manual.
jink2005 Feb 2, 2016
864c0e6
Fix warnings in the project.
jink2005 Feb 19, 2016
9f0a41c
Remove the UPnP.h in mUPnP framework for it is confused with the file…
jink2005 Feb 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# mupnpc
This project is forked from cybergarage/mupnpc. And will keep fix the bugs and add features based on the practice and ordinary useage.

mUPnP for C is a development package for UPnP™ developers. CyberLink controls these protocols automatically, and supports to create your devices and control points quickly.
8 changes: 1 addition & 7 deletions include/mupnp/controlpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,7 @@ mUpnpDevice *mupnp_controlpoint_getdevicebyudn(mUpnpControlPoint *ctrlPoint,
* @param ctrlPoint The control point in question
* @param evlistener The callback function to set, that is of type @ref MUPNP_EVENT_LISTENER, or NULL
*/
#define mupnp_controlpoint_seteventlistener(ctrlPoint, evlistener) \
do {\
if (evlistener == NULL) \
mupnp_eventlistenerlist_remove(ctrlPoint->eventListeners, ctrlPoint->eventListeners->next->listener); \
else \
mupnp_eventlistenerlist_add(ctrlPoint->eventListeners, evlistener); \
} while(0)
bool mupnp_controlpoint_seteventlistener(mUpnpControlPoint* ctrlPoint, MUPNP_EVENT_LISTENER evlistener);

/**
* Get the single event listener for the control point.
Expand Down
2 changes: 2 additions & 0 deletions include/mupnp/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ typedef struct _mUpnpDevice
{
MUPNP_LIST_STRUCT_MEMBERS

/** Referrence Count */
int refCount;
/** List of XML root nodes */
mUpnpXmlNodeList *rootNodeList;
/** This device's description XML node */
Expand Down
12 changes: 6 additions & 6 deletions include/mupnp/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define _MUPNP_EVENT_H_

#include <mupnp/typedef.h>

#include <mupnp/http/http.h>
#include <mupnp/util/string.h>
#include <mupnp/util/list.h>
Expand Down Expand Up @@ -106,14 +105,16 @@ typedef mUpnpHttpResponse mUpnpSubscriptionResponse;
/**
* Type definition for event listener callback
*/
typedef void (*MUPNP_EVENT_LISTENER)(mUpnpProperty *);
typedef void (*MUPNP_EVENT_LISTENER)(void *, mUpnpProperty *);

/**
* Type definition for event listener list
*/
typedef struct _mUpnpEventListenerList {
MUPNP_LIST_STRUCT_MEMBERS

// MUPNP_LIST_STRUCT_MEMBERS
bool headFlag;
struct _mUpnpEventListenerList *prev;
struct _mUpnpEventListenerList *next;
MUPNP_EVENT_LISTENER listener;
} mUpnpEventListenerList;

Expand Down Expand Up @@ -533,8 +534,7 @@ void mupnp_eventlistenerlist_add(mUpnpEventListenerList* eventListenerList, MUPN
* @param eventListenerList The list to iterate thru
* @param property The property that has been evented
*/
void mupnp_eventlistenerlist_notify(mUpnpEventListenerList* eventListenerList, mUpnpProperty *property);

void mupnp_eventlistenerlist_notify(void *ctrlPoint, mUpnpEventListenerList* eventListenerList, mUpnpProperty *property);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions include/mupnp/util/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*
******************************************************************/

#ifndef _MUPNP_UTIL_STRING_H_
#define _MUPNP_UTIL_STRING_H_
#ifndef _MUPNP_UTIL_STRING_H_A_
#define _MUPNP_UTIL_STRING_H_A_

#include <mupnp/typedef.h>
#include <stdlib.h>
Expand Down
1,006 changes: 1,006 additions & 0 deletions lib/mupnpiOS/mupnpiOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions mUPnPiOS.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/mupnp/controlpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ static mUpnpDevice *mupnp_controlpoint_createdevicefromssdkpacket(mUpnpSSDPPacke
url = mupnp_net_url_new();
mupnp_net_url_set(url, location);
parseSuccess = mupnp_device_parsedescriptionurl(dev, url);
if (parseSuccess) {
mupnp_device_sethttpport(dev, mupnp_net_url_getport(url));
}
mupnp_net_url_delete(url);

if (parseSuccess == false) {
Expand Down
16 changes: 16 additions & 0 deletions src/mupnp/controlpoint_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@

#if !defined(MUPNP_NOUSE_CONTROLPOINT) && !defined(MUPNP_NOUSE_SUBSCRIPTION)

bool mupnp_controlpoint_seteventlistener(mUpnpControlPoint* ctrlPoint, MUPNP_EVENT_LISTENER evlistener)
{

mUpnpEventListenerList* nextEvListener;
do {
if (evlistener == NULL) {
nextEvListener = (mUpnpEventListenerList*)ctrlPoint->eventListeners->next;
mupnp_eventlistenerlist_remove(ctrlPoint->eventListeners, nextEvListener->listener);
}
else
mupnp_eventlistenerlist_add(ctrlPoint->eventListeners, evlistener);
} while (0);

return true;
}

mUpnpService *mupnp_device_getfirstexpiratedservice(mUpnpControlPoint *ctrlPoint,
mUpnpDevice *dev,
mUpnpTime expirationTime)
Expand Down
3 changes: 2 additions & 1 deletion src/mupnp/controlpoint_http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void mupnp_controlpoint_httprequestreceived(mUpnpHttpRequest *httpReq)
prop != NULL;
prop = mupnp_property_next(prop))
{
mupnp_eventlistenerlist_notify(eventListeners, prop);
// printf("\n%s\n%s\n%s\n", prop->name->value, prop->sid->value, prop->value->value);
mupnp_eventlistenerlist_notify(ctrlPoint, eventListeners, prop);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/mupnp/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mUpnpDevice *mupnp_device_new()
#ifdef MUPNP_HTTP_USE_PERSISTENT_CONNECTIONS
mupnp_http_persistentconnection_init();
#endif
dev->refCount = 0;

dev->rootNodeList = NULL;
dev->deviceNode = NULL;
Expand Down Expand Up @@ -96,6 +97,9 @@ mUpnpDevice *mupnp_device_new()
void mupnp_device_delete(mUpnpDevice *dev)
{
mupnp_log_debug_l4("Entering...\n");
if (dev->refCount > 0) {
return;
}

mupnp_list_remove((mUpnpList *)dev);

Expand Down
5 changes: 3 additions & 2 deletions src/mupnp/event/eventlistener_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
******************************************************************/

#include <mupnp/controlpoint.h>
#include <mupnp/event/event.h>
#include <mupnp/util/log.h>

Expand Down Expand Up @@ -117,7 +118,7 @@ void mupnp_eventlistenerlist_add(mUpnpEventListenerList* eventListenerList, MUPN
* @param eventListenerList The list to iterate thru
* @param property The property that has been evented
*/
void mupnp_eventlistenerlist_notify(mUpnpEventListenerList* eventListenerList, mUpnpProperty *property)
void mupnp_eventlistenerlist_notify(void *ctrlPoint, mUpnpEventListenerList* eventListenerList, mUpnpProperty *property)
{
mUpnpEventListenerList *list_node = NULL;

Expand All @@ -129,7 +130,7 @@ void mupnp_eventlistenerlist_notify(mUpnpEventListenerList* eventListenerList, m
{
if (list_node->listener != NULL)
{
list_node->listener(property);
list_node->listener(ctrlPoint, property);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/mupnp/http/http_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* to_month_string()
****************************************/

#if defined(ITRON)

static char MONTH_STRING[][4] = {
"Jan",
"Feb",
Expand All @@ -45,10 +47,14 @@ static char *to_month_string(int value)
return "";
}

#endif

/****************************************
* to_week_string()
****************************************/

#if defined(ITRON)

static char WEEK_STRING[][4] = {
"Sun",
"Mon",
Expand All @@ -71,6 +77,8 @@ static char *to_week_string(int value)
mupnp_log_debug_l4("Leaving...\n");
}

#endif

/****************************************
* mupnp_http_getservername()
****************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/mupnp/util/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void mupnp_log_print(int severity, const char *file, int line_n, const char *fun
char log_line[MAX_LOG_STRING], *l_ptr, t_ptr[MAX_LOG_STRING];
int prefix_length = -1;
struct fd_list *temp = NULL;
size_t timestamp;
time_t timestamp;
struct tm *timestamp_human_readable;

/* If output targets are empty, do return */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void mupnp_upnpav_content_copy(mUpnpAvContent *destContent, mUpnpAvContent *srcC
void mupnp_upnpav_content_addchildcontent(mUpnpAvContent *con, mUpnpAvContent *childCon);
int mupnp_upnpav_content_getnchildcontents(mUpnpAvContent *con);
mUpnpAvContent *mupnp_upnpav_content_getchildcontents(mUpnpAvContent *con);
BOOL mupnp_upnpav_content_haschildcontents(mUpnpAvContent *con);
bool mupnp_upnpav_content_haschildcontents(mUpnpAvContent *con);
#define mupnp_upnpav_content_clearchildcontents(con) mupnp_xml_nodelist_clear(mupnp_xml_node_getchildnodelist(con))

#define mupnp_upnpav_content_setid(con, val) mupnp_xml_node_setattribute(con, CG_UPNPAV_CONTENT_ID, val)
Expand All @@ -109,14 +109,14 @@ BOOL mupnp_upnpav_content_haschildcontents(mUpnpAvContent *con);
void mupnp_upnpav_content_settype(mUpnpAvContent *con, int type);
int mupnp_upnpav_content_gettype(mUpnpAvContent *con);

#define mupnp_upnpav_content_isitemnode(node) (mupnp_upnpav_content_gettype(node) == CG_UPNPAV_CONTENT_ITEM ? TRUE : FALSE)
#define mupnp_upnpav_content_iscontainernode(node) (mupnp_upnpav_content_gettype(node) == CG_UPNPAV_CONTENT_CONTAINER ? TRUE : FALSE)
BOOL mupnp_upnpav_content_iscontentnode(mUpnpXmlNode *node);
#define mupnp_upnpav_content_isitemnode(node) (mupnp_upnpav_content_gettype(node) == CG_UPNPAV_CONTENT_ITEM ? true : false)
#define mupnp_upnpav_content_iscontainernode(node) (mupnp_upnpav_content_gettype(node) == CG_UPNPAV_CONTENT_CONTAINER ? true : false)
bool mupnp_upnpav_content_iscontentnode(mUpnpXmlNode *node);

#define mupnp_upnpav_content_setuserdata(con, data) mupnp_xml_node_setuserdata(con, data)
#define mupnp_upnpav_content_getuserdata(con) mupnp_xml_node_getuserdata(con)

typedef BOOL (*CG_UPNPAV_CONTENT_COMPARE_FUNC)(mUpnpAvContent *con, void *userData);
typedef bool (*CG_UPNPAV_CONTENT_COMPARE_FUNC)(mUpnpAvContent *con, void *userData);
mUpnpAvContent *mupnp_upnpav_content_getbyid(mUpnpAvContent *con, char *id);
mUpnpAvContent *mupnp_upnpav_content_getbytitle(mUpnpAvContent *con, char *title);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" {
mUpnpXmlNode *mupnp_upnpav_didl_node_new();

#define mupnp_upnpav_didl_node_delete(node) mupnp_xml_node_delete(node)
#define mupnp_upnpav_didl_node_tostring(node, str) mupnp_xml_node_tostring(node, TRUE, str)
#define mupnp_upnpav_didl_node_tostring(node, str) mupnp_xml_node_tostring(node, true, str)

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mUpnpAvContent *mupnp_upnpav_dms_findcontentbyid(mUpnpAvServer *dms, char *objec
* Connection Manager
****************************************/

BOOL mupnp_upnpav_dms_conmgr_init(mUpnpAvServer *dms);
bool mupnp_upnpav_dms_conmgr_init(mUpnpAvServer *dms);

/****************************************
* Network Interface
Expand All @@ -190,14 +190,14 @@ BOOL mupnp_upnpav_dms_conmgr_init(mUpnpAvServer *dms);
#define mupnp_upnpav_dms_getnetworkinterfaces(dms) mupnp_net_interfacelist_gets(dms->networkInterfaceList)
#define mupnp_upnpav_dms_getnnetworkinterfaces(dms) mupnp_net_interfacelist_size(dms->networkInterfaceList)

BOOL mupnp_upnpav_dms_updatenetworkinterfaces(mUpnpAvServer *dms);
bool mupnp_upnpav_dms_updatenetworkinterfaces(mUpnpAvServer *dms);
mUpnpNetworkInterface *mupnp_upnpav_dms_getnetworkinterface(mUpnpAvServer *dms);

/****************************************
* Content Directory
****************************************/

BOOL mupnp_upnpav_dms_condir_init(mUpnpAvServer *dms);
bool mupnp_upnpav_dms_condir_init(mUpnpAvServer *dms);

void mupnp_upnpav_dms_condir_setsystemupdateid(mUpnpAvServer *dms, int id);
int mupnp_upnpav_dms_condir_getsystemupdateid(mUpnpAvServer *dms);
Expand All @@ -207,7 +207,7 @@ void mupnp_upnpav_dms_condir_updatesystemupdateid(mUpnpAvServer *dms);
* Media Receiveer
****************************************/

BOOL mupnp_upnpav_dms_medrec_init(mUpnpAvServer *dms);
bool mupnp_upnpav_dms_medrec_init(mUpnpAvServer *dms);


#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C" {
* The generic protocolinfo struct
*/
typedef struct _mUpnpAvProtocolInfo {
BOOL headFlag;
bool headFlag;
struct _mUpnpAvProtocolInfo *prev;
struct _mUpnpAvProtocolInfo *next;
mUpnpString *protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,32 @@
extern "C" {
#endif

#define CG_UPNPAV_OBJECT_CONTAINER "container"
#define CG_UPNPAV_OBJECT_ITEM "item"
#define CG_UPNPAV_OBJECT_ID "id"
#define CG_UPNPAV_OBJECT_PARENTID "parentID"
#define CG_UPNPAV_OBJECT_CHILDCOUNT "childCount"
#define CG_UPNPAV_OBJECT_RESTRICTED "restricted"
#define CG_UPNPAV_OBJECT_TITLE "dc:title"
#define CG_UPNPAV_OBJECT_CREATOR "dc:creator"
#define CG_UPNPAV_OBJECT_DATE "dc:date"
#define CG_UPNPAV_OBJECT_UPNPCLASS "upnp:class"
#define CG_UPNPAV_OBJECT_TRACKNUMBER "upnp:originalTrackNumber"
#define CG_UPNPAV_OBJECT_ARTIST "upnp:artist"
#define CG_UPNPAV_OBJECT_ALBUM "upnp:album"
#define CG_UPNPAV_OBJECT_GENRE "upnp:genre"
#define CG_UPNPAV_OBJECT_ALBUMARTURI "upnp:albumArtURI"
#define CG_UPNPAV_OBJECT_ROOT_ID "0"

#define CG_UPNPAV_RES "res"
#define CG_UPNPAV_RES_PROTOCOLINFO "protocolInfo"
#define CG_UPNPAV_RES_SIZE "size"
#define CG_UPNPAV_RES_DURATION "duration"
#define CG_UPNPAV_RES_BITRATE "bitrate"

typedef BOOL (*CG_UPNPAV_HTTP_LISTENER)(mUpnpHttpRequest *);
typedef BOOL (*CG_UPNPAV_ACTION_LISTNER)(mUpnpAction *);
typedef BOOL (*CG_UPNPAV_STATEVARIABLE_LISTNER)(mUpnpStateVariable *);
typedef bool (*CG_UPNPAV_HTTP_LISTENER)(mUpnpHttpRequest *);
typedef bool (*CG_UPNPAV_ACTION_LISTNER)(mUpnpAction *);
typedef bool (*CG_UPNPAV_STATEVARIABLE_LISTNER)(mUpnpStateVariable *);

#ifdef __cplusplus
}
Expand Down
Loading