TizenRT Public API  v2.0 M2
DataSource.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_DATASOURCE_H
30 #define __MEDIA_DATASOURCE_H
31 
32 #include <iostream>
33 #include <media/MediaTypes.h>
34 
35 namespace media {
36 
44 {
45 public:
51  DataSource();
57  ~DataSource();
66  DataSource(unsigned int channels, unsigned int sampleRate, audio_format_type_t pcmFormat);
72  DataSource(const DataSource&);
79 
80 public:
86  virtual bool open() = 0;
92  virtual bool close() = 0;
98  virtual bool isPrepare() = 0;
99 
106  unsigned int getChannels();
113  unsigned int getSampleRate();
120  audio_format_type_t getPcmFormat();
121 
128  void setChannels(unsigned int channels);
135  void setSampleRate(unsigned int sampleRate);
142  void setPcmFormat(audio_format_type_t pcmFormat);
149  void setAudioType(audio_type_t audioType);
157 
158 private:
159  unsigned char mChannels;
160  unsigned int mSampleRate;
161  audio_format_type_t mPcmFormat;
162  audio_type_t mAudioType;
163 };
164 } // namespace media
165 
166 #endif
167  // end of MEDIA group
void setChannels(unsigned int channels)
Sets the channel count of the stream data.
void setSampleRate(unsigned int sampleRate)
Sets the sample rate of the stream data.
Provide definiton of Media Type.
audio_type_t getAudioType()
Gets the audio type of the stream data.
void setAudioType(audio_type_t audioType)
Sets the audio type of the stream data.
unsigned int getChannels()
Gets the channel count of the stream data.
void setPcmFormat(audio_format_type_t pcmFormat)
Sets the pcm format of the stream data.
audio_format_type_t getPcmFormat()
Gets the pcm format of the stream data.
enum media::audio_type_e audio_type_t
Audio type.
virtual bool open()=0
open the stream data
DataSource()
Constructs an empty DataSource.
virtual bool isPrepare()=0
Whether data is ready to be read.
~DataSource()
Deconstructs an empty DataSource.
unsigned int getSampleRate()
Gets the sample rate of the stream data.
virtual bool close()=0
close the stream data
DataSource & operator=(const DataSource &)
Operator= for DataSource.