1 /*
2  *			GPAC - Multimedia Framework C SDK
3  *
4  *			Authors: Jean Le Feuvre
5  *			Copyright (c) Telecom ParisTech 2009-2012
6  *			All rights reserved
7  *
8  *  This file is part of GPAC / Platinum UPnP module
9  *
10  *  GPAC is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU Lesser General Public License as published by
12  *  the Free Software Foundation; either version 2, or (at your option)
13  *  any later version.
14  *
15  *  GPAC is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; see the file COPYING.  If not, write to
22  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  *
25  *	----------------------------------------------------------------------------------
26  *		PLATINUM IS LICENSED UNDER GPL or commercial agreement - cf platinum license
27  *	----------------------------------------------------------------------------------
28  *
29  */
30 
31 
32 
33 #ifndef _GPAC_MEDIA_RENDER_H_
34 #define _GPAC_MEDIA_RENDER_H_
35 
36 #include "Neptune.h"
37 #include "PltMediaRenderer.h"
38 #include "PltService.h"
39 
40 class GF_UPnP;
41 
42 class GPAC_MediaRenderer  : public PLT_DeviceHost,
43 	public PLT_MediaRendererDelegate
44 {
45 public:
46 	GPAC_MediaRenderer (GF_UPnP *upnp, const char*          friendly_name,
47 	                    bool                 show_ip = false,
48 	                    const char*          uuid = NULL,
49 	                    unsigned int         port = 0);
50 
51 	// PLT_DeviceHost methods
52 	virtual NPT_Result SetupServices();
53 	virtual NPT_Result OnAction(PLT_ActionReference &action, const PLT_HttpRequestContext& context);
54 
55 	/*these are called when event filtering is used (no JS)*/
56 	void SetDuration(Double duration, Bool can_seek);
57 	void SetTime(Double time);
58 	void SetConnected(const char *url);
59 
60 protected:
61 	virtual ~GPAC_MediaRenderer();
62 
63 	// PLT_MediaRendererInterface methods
64 	// ConnectionManager
65 	virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action);
66 
67 	// AVTransport
68 	virtual NPT_Result OnNext(PLT_ActionReference& action);
69 	virtual NPT_Result OnPause(PLT_ActionReference& action);
70 	virtual NPT_Result OnPlay(PLT_ActionReference& action);
71 	virtual NPT_Result OnPrevious(PLT_ActionReference& action);
72 	virtual NPT_Result OnSeek(PLT_ActionReference& action);
73 	virtual NPT_Result OnStop(PLT_ActionReference& action);
74 	virtual NPT_Result OnSetAVTransportURI(PLT_ActionReference& action);
75 	virtual NPT_Result OnSetPlayMode(PLT_ActionReference& action);
76 
77 	// RenderingControl
78 	//virtual NPT_Result OnGetVolume(PLT_ActionReference& action);
79 	virtual NPT_Result OnSetVolume(PLT_ActionReference& action);
80 	virtual NPT_Result OnSetVolumeDB(PLT_ActionReference& action);
81 	virtual NPT_Result OnSetMute(PLT_ActionReference& action);
82 	virtual NPT_Result OnGetVolumeDBRange(PLT_ActionReference &action);
83 
84 
85 private:
86 	GF_UPnP *m_pUPnP;
87 
88 	Bool m_connected;
89 
90 	/*pointer to the AV service for further StateVariable modifications*/
91 	PLT_Service *m_pAVService;
92 	PLT_Service *m_pMigrationService;
93 
94 	GF_List *m_mediaHistoryList;
95 	u32 m_track_pos;
96 //	u32 m_volume;
97 //	Bool m_muted, m_l_muted, m_r_muted;
98 	NPT_String m_ip_src;
99 	Double m_Duration, m_Time;
100 };
101 
102 #endif	/*_GPAC_MEDIA_RENDER_H_*/
103