TizenRT Public API  v2.0 M2
OutputDataSource.h
Go to the documentation of this file.
1 /* ****************************************************************
2  *
3  * Copyright 2018 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ******************************************************************/
18 
29 #ifndef __MEDIA_OUTPUTDATASOURCE_H
30 #define __MEDIA_OUTPUTDATASOURCE_H
31 
32 #include <pthread.h>
33 #include <media/DataSource.h>
35 
36 namespace media {
37 class MediaRecorderImpl;
38 namespace stream {
39 class StreamBuffer;
40 class StreamBufferReader;
41 class StreamBufferWriter;
42 
50 {
51 public:
66  OutputDataSource(unsigned int channels, unsigned int sampleRate, audio_format_type_t pcmFormat);
67 
73  OutputDataSource(const OutputDataSource& source);
85  virtual ~OutputDataSource();
86 
87 public:
93  virtual ssize_t write(unsigned char *buf, size_t size) = 0;
94 
100  void setRecorder(std::shared_ptr<MediaRecorderImpl> mr) { mRecorder = mr; }
101 
102 protected:
103  std::shared_ptr<MediaRecorderImpl> getRecorder() { return mRecorder.lock(); }
104 
105 private:
106  std::weak_ptr<MediaRecorderImpl> mRecorder;
107 };
108 } // namespace stream
109 } // namespace media
110 
111 #endif
112  // end of MEDIA group
virtual ~OutputDataSource()
Deconstructs an empty OutputDataSource.
Media DataSource APIs.
OutputDataSource & operator=(const OutputDataSource &source)
Operator= for OutputDataSource.
virtual ssize_t write(unsigned char *buf, size_t size)=0
Puts the stream data.
void setRecorder(std::shared_ptr< MediaRecorderImpl > mr)
Register current recorder to get data souce state and other infomations.
Media BufferObserverInterface APIs.
OutputDataSource()
Constructs an empty OutputDataSource.