#ifndef _PLT_MEDIA_SERVER_H_
#define _PLT_MEDIA_SERVER_H_
#include "Neptune.h"
#include "PltDeviceHost.h"
#include "PltMediaItem.h"
#define MAX_PATH_LENGTH 1024
class PLT_MediaServerDelegate
{
public:
PLT_MediaServerDelegate() {}
virtual ~PLT_MediaServerDelegate() {}
virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& ,
const char* ,
const char* ,
NPT_UInt32 ,
NPT_UInt32 ,
const char* ,
const PLT_HttpRequestContext& ) = 0;
virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& ,
const char* ,
const char* ,
NPT_UInt32 ,
NPT_UInt32 ,
const char* ,
const PLT_HttpRequestContext& ) = 0;
virtual NPT_Result OnSearchContainer(PLT_ActionReference& ,
const char* ,
const char* ,
const char* ,
NPT_UInt32 ,
NPT_UInt32 ,
const char* ,
const PLT_HttpRequestContext& ) = 0;
virtual NPT_Result ProcessFileRequest(NPT_HttpRequest& ,
const NPT_HttpRequestContext& ,
NPT_HttpResponse& ) = 0;
};
class PLT_MediaServer : public PLT_DeviceHost
{
public:
enum BrowseFlags {
BROWSEMETADATA,
BROWSEDIRECTCHILDREN
};
static NPT_Result ParseBrowseFlag(const char* str, BrowseFlags& flag);
static NPT_Result ParseSort(const NPT_String& sort, NPT_List<NPT_String>& list);
PLT_MediaServer(const char* friendly_name,
bool show_ip = false,
const char* uuid = NULL,
NPT_UInt16 port = 0,
bool port_rebind = false);
virtual void SetDelegate(PLT_MediaServerDelegate* delegate) { m_Delegate = delegate; }
PLT_MediaServerDelegate* GetDelegate() { return m_Delegate; }
virtual void UpdateSystemUpdateID(NPT_UInt32 update);
virtual void UpdateContainerUpdateID(const char* id, NPT_UInt32 update);
protected:
virtual ~PLT_MediaServer();
virtual NPT_Result SetupServices();
virtual NPT_Result OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result ProcessHttpGetRequest(NPT_HttpRequest& request,
const NPT_HttpRequestContext& context,
NPT_HttpResponse& response);
virtual NPT_Result OnGetCurrentConnectionIDs(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnGetProtocolInfo(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnGetSortCapabilities(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnGetSearchCapabilities(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnGetSystemUpdateID(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnBrowse(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnSearch(PLT_ActionReference& action,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action,
const char* object_id,
const char* filter,
NPT_UInt32 starting_index,
NPT_UInt32 requested_count,
const char* sort_criteria,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action,
const char* object_id,
const char* filter,
NPT_UInt32 starting_index,
NPT_UInt32 requested_count,
const char* sort_criteria,
const PLT_HttpRequestContext& context);
virtual NPT_Result OnSearchContainer(PLT_ActionReference& action,
const char* container_id,
const char* search_criteria,
const char* filter,
NPT_UInt32 starting_index,
NPT_UInt32 requested_count,
const char* sort_criteria,
const PLT_HttpRequestContext& context);
private:
PLT_MediaServerDelegate* m_Delegate;
};
#endif