reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
MediaResourceParticipant.hxx
Go to the documentation of this file.
1#if !defined(MediaResourceParticipant_hxx)
2#define MediaResourceParticipant_hxx
3
4#include <resip/stack/Uri.hxx>
5
7#include "Participant.hxx"
8
9namespace recon
10{
11class ConversationManager;
12
13// Used to delete a resource, from a media stack thread
15{
16 public:
20
21 void executeCommand() { Participant* participant = mConversationManager.getParticipant(mParticipantHandle); if(participant) delete participant; }
22
23 Message* clone() const { resip_assert(0); return 0; }
24 EncodeStream& encode(EncodeStream& strm) const { strm << "MediaResourceParticipantDeleterCmd: partHandle=" << mParticipantHandle; return strm; }
26
27 private:
28 ConversationManager& mConversationManager;
29 ParticipantHandle mParticipantHandle;
30};
31
41{
42public:
55
58 const resip::Uri& mediaUrl,
59 const std::shared_ptr<resip::Data>& audioBuffer);
61
62 virtual void startResource();
63 virtual bool hasInput();
64 virtual bool hasOutput();
65 virtual ResourceType getResourceType() { return mResourceType; }
66 virtual void destroyParticipant();
67 virtual void resourceDone();
68
69protected:
70 virtual void startResourceImpl() = 0;
71 virtual bool stopResource() = 0; // returns true if it's ok to destroy now, or false if we need to wait for an event
73 virtual resip::Uri& getMediaUrl() { return mMediaUrl; }
74 virtual bool isRepeat() { return mRepeat; }
75 virtual void setRepeat(bool repeat) { mRepeat = repeat; }
76 virtual bool isPrefetch() { return mPrefetch; }
77 virtual unsigned int getDurationMs() { return mDurationMs; }
78 virtual unsigned int getStartOffsetMs() { return mStartOffsetMs; }
79 virtual bool isRunning() { return mRunning; }
80 virtual void setRunning(bool running) { mRunning = running; }
81 virtual bool isDestroying() { return mDestroying; }
82 virtual void setDestroying(bool destroying) { mDestroying = destroying; }
83 virtual const std::shared_ptr<resip::Data>& getAudioBuffer() { return mAudioBuffer; }
84
85private:
86 resip::Uri mMediaUrl;
87 ResourceType mResourceType;
88 std::shared_ptr<resip::Data> mAudioBuffer; // only set if type is buffer playback
89
90 // Play settings
91 bool mRepeat;
92 bool mPrefetch;
93 unsigned int mDurationMs;
94 unsigned int mStartOffsetMs;
95
96 bool mRunning;
97 bool mDestroying;
98};
99
100}
101
102#endif
103
104
105/* ====================================================================
106
107 Copyright (c) 2021-2023, SIP Spectrum, Inc. http://www.sipspectrum.com
108 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
109 Copyright (c) 2007-2008, Plantronics, Inc.
110 All rights reserved.
111
112 Redistribution and use in source and binary forms, with or without
113 modification, are permitted provided that the following conditions are
114 met:
115
116 1. Redistributions of source code must retain the above copyright
117 notice, this list of conditions and the following disclaimer.
118
119 2. Redistributions in binary form must reproduce the above copyright
120 notice, this list of conditions and the following disclaimer in the
121 documentation and/or other materials provided with the distribution.
122
123 3. Neither the name of Plantronics nor the names of its contributors
124 may be used to endorse or promote products derived from this
125 software without specific prior written permission.
126
127 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
128 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
129 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
130 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
131 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
132 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
133 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
134 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
135 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
136 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
137 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
138
139 ==================================================================== */
#define resip_assert(x)
This file needs to work for both C and C++ code.
This class is one of two main classes of concern to an application using the UserAgent library.
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
MediaResourceParticipantDeleterCmd(ConversationManager &conversationManager, ParticipantHandle participantHandle)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
This class represents a media resource participant.
virtual ConversationManager & getConversationManager()
virtual const std::shared_ptr< resip::Data > & getAudioBuffer()
virtual void setDestroying(bool destroying)
virtual void startResourceImpl()=0
This is the base class for a RemoteParticipant, LocalParticipant and a MediaResourceParticipant.
ConversationManager & mConversationManager
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
unsigned int ParticipantHandle
#define EncodeStream
void list()
Definition userAdmin.cxx:66