mediarenderer1.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 254 行

H
254
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Eric Knudstrup
 *  Created: Thu Jul 14 18:24:59 2005
 *
 *******************************************************************/

#ifndef MEDIARENDERER1_H
#define MEDIARENDERER1_H

typedef enum {
    UPNP_MEDIA_VIDEO_ITEM,     /**< This is content  */
    UPNP_MEDIA_AUDIO_ITEM,     /**< This is content  */
    UPNP_MEDIA_IMAGE_ITEM,     /**< This is content  */
    UPNP_MEDIA_CONTAINER       /**< This is a directory */
} UPnPMediaObjType_t;

typedef enum {
    UPNP_PROTO_RTSP, /**< Resource URI is RTSP */
    UPNP_PROTO_HTTP  /**< Resource URI is HTTP */
} UPnPProto_t;

typedef enum {
    UPNP_MS_STATE_ALLOCATED = 0,
    UPNP_MS_STATE_DEV_GET,   /**< Retrieving device SCPD */
    UPNP_MS_STATE_SCPD_GET,  /**< In the process of retrieving SCPDs */
    UPNP_MS_STATE_READY,     /**< Init complete */
    UPNP_MS_STATE_ERROR,     /**< Something bad happened */
} UPnPMediaServerState_t;

typedef enum {
    UPNP_SERVICE_BUSY = (1<<0)
} UPnPServiceFlags_t;

typedef enum {
    UPNP_OBJ_FLAG_RESTRICTED = (1<<0) /**< Is the object modifiable on the server? */
} UPnPMediaObjectFlags_t;

typedef enum {
    UPNP_SOAP_OK = 0,             /**< Success */
    UPNP_SOAP_SERVER_ERROR,   /**< Something generally bad happened on the server side */
    UPNP_SOAP_ACCESS_ERROR,   /**< Access was denied */
    UPNP_SOAP_MEMORY_ERROR    /**< We failed to allocate memory */
} UPnPSOAPResult_t;

typedef struct upnp_media_obj_s  UPnPMediaObject_t;
typedef unsigned long UPnPMediaObjectSize_t;

/**
 * Callback type for UPnP ContentDirectory search results.
 */
typedef void (*UPnPMediaDirCb_t)(UPnPMediaObject_t *objects, 
                                 void *context, 
                                 UPnPSOAPResult_t result);

typedef struct {
    char *serviceType;
    char *serviceId;
    char *controlURL;
    char *eventSubURL;
    char *SCPDURL;
    Docptr SCPDDoc;

    UPnPMediaDirCb_t soap_cb;
    void *soap_arg;
    UPnPServiceFlags_t flags;
} UPnPService_t;

typedef void (*UPnPServiceCb_t)(UPnPService_t *service, Docptr doc);

typedef struct mediaserver_s {
    char friendlyName[DEFAULT_URI_LENGTH];
    char deviceType[DEFAULT_URI_LENGTH];
    char manufacturer[DEFAULT_URI_LENGTH];
    char uuid[DEFAULT_URI_LENGTH];

    struct ip_addr server_addr;
    URI_t *uri;
    int max_age;
    int current_age;
    int type;
#define UPNP_MEDIA_SERVER_NORMAL	0
#define UPNP_MEDIA_SERVER_KODAK		1
    UPnPMediaServerState_t state;

    UPnPService_t *ConnectionManager;
    UPnPService_t *ContentDirectory;
    UPnPService_t *MS_MediaReceiverRegistrar; /* Windows Media Connect */
} UPnPDevice_t;

struct upnp_media_obj_s {
    UPnPMediaObjType_t object_type;
    uint32_t magic;

    uint32_t object_index; /* Nth item in the parent's container */

    char *object_id;
    char *parent_id;
    char *title;             /* <dc:title>Unknown</dc:title> */

    UPnPMediaObjectFlags_t flags;
    struct upnp_media_obj_s *downlink;
    struct upnp_media_obj_s *uplink;
    struct upnp_media_obj_s *next;
};

/*
 *  <item id="46D1B2C6D8D2D21" refID="BF9A8FC65DD17FF" restricted="true" parentID="16503EA06BA127D8">
 *  <dc:title>u01_longfight_divx51_4mbps_mp3_cbr320.avi</dc:title>
 *  <res size="98486272" protocolInfo="http-get:*:video/avi:*">http://10.8.11.124:10243/WMCS/9DDCCC7063F112B6H.avi</res>
 *  <upnp:class>object.item.videoItem</upnp:class>
 *  <upnp:album>My Videos</upnp:album>
 *  <dc:date>2003-09-30</dc:date>
 *  </item>
 */
typedef struct {
    UPnPMediaObject_t base;
    UPnPMediaObjectSize_t size;
    UPnPProto_t proto;
    char *mime_type;
    char *uri;
    char *date;
} UPnPContentItem_t;

/*
 *  <container id="16503EA06BA127D8" restricted="true" parentID="A" childCount="2" searchable="true">
 *  <dc:title>Unknown</dc:title>
 *  <upnp:class>object.container.person.movieActor</upnp:class>
 *  <upnp:writeStatus>NOT_WRITABLE</upnp:writeStatus>
 *  <upnp:searchClass includeDerived="false">object.container.person.movieActor</upnp:searchClass>
 *  <upnp:searchClass includeDerived="false">object.item</upnp:searchClass>
 *  <upnp:searchClass includeDerived="false">object.item.videoItem</upnp:searchClass>
 *  </container>
 */
typedef struct {
    UPnPMediaObject_t base;
    int child_count;         /* childCount="2" */
    int windowMin;           /* Minimum child index retrieved */
    int windowCount;         /* Number of objects to retrieve at once */
} UPnPContainerItem_t;

extern AVSysEvent_t MS_sys_event_id;

#define IS_MEDIA_ITEM_CONTAINER(o) (o->object_type == UPNP_MEDIA_CONTAINER)

typedef enum {
    UPNP_NOTIFY_SUCCESS,
    UPNP_NOTIFY_ERROR
} UPnPNOTIFYStatus_t;

typedef void (*UPnPNOTIFYHandler_t)(Docptr doc, void *context, UPnPNOTIFYStatus_t notify_status);

/*;emacs generated header for file MediaRenderer1.c. Global function declarations only. */
extern void
mediaserver_subscribe(EventSubscriber_t *sub, 
 SysEventCb_t cb, unsigned arg);

/**
 * @returns event id for uPnP media server list change.
 */
extern AVSysEvent_t
mediaserver_eventid(void);

extern void
MediaRenderer_init(void);

/**
 * Given a GENA NOTIFY message, determine which action to take with this server, 
 * either removing it from the cache or clearing its age.
 */
extern void
process_notify_message(struct ip_addr *addr, HTTPInputMessage_t *message);

/**
 * Given a an M-SEARCH UPnP message, verify and update
 * the MediaServer table. If this is a new server then get its
 * service descriptions.
 */
extern void
process_msearch_message(struct ip_addr *addr, HTTPInputMessage_t *message);

/**
 * Get the next \a UPnPDevice_t from the system's list.
 * If \a server is NULL or has been deleted,
 * the first entry will be retrieved.
 */
extern UPnPDevice_t *
mediaserver_get_next(UPnPDevice_t *server);

/**
 * Clear media server list.
 */
void
mediaserver_clearlist(void);

/**
 * Update server list. This function marks
 * all server as "to be expired" flag, then it send server search request.
 * If the response doesn't clear this flag before next call then the marked servers
 * are removed from server list.
 */
void
mediaserver_updatelist(void);

/**
 * Retrieve the friendlyName of a \a UPnPDevice_t.
 *
 * @param [in] device Device to retrieve the friendlyName for.
 * @param [in,out] buffer Buffer to copy the string into.
 * @param [in] bufferLen Length of the \a buffer.
 *
 * @returns 0 if the \a device was valid, non-zero if not.
 */
extern int
upnp_device_friendlyName(UPnPDevice_t *device, char *buffer, int bufferLen);

/**
 * Check if a \a UPnPDevice_t is valid.
 * @param [in] device Device to check.
 *
 * @returns non-zero if valid.
 */
extern int
upnp_device_isvalid(UPnPDevice_t *device);

/**
 * Unlock a \a UPnPDevice_t so it can be deleted.
 */
extern void
upnp_device_unlock(UPnPDevice_t *device);

/**
 * Given a \a UPnPDevice_t, take a mutex preventing it from being
 * deleted. When the call is complete, \a upnp_device_unlock() must
 * be called.
 *
 * @param [in] device \a UPnPDevice_t to lock.
 * @returns non-zero if the device was valid and the lock taken, 0 if not.
 */
extern int
upnp_device_lock(UPnPDevice_t *device);

extern const char *
media_type_string(UPnPMediaObjType_t type);


/*;end emacs generated header for file MediaRenderer1.c. Global function declarations only. */

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?