TizenRT Public API  v2.0 M2
FileOutputDataSource.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_FILEOUTPUTDATASOURCE_H
30 #define __MEDIA_FILEOUTPUTDATASOURCE_H
31 
32 #include <media/OutputDataSource.h>
33 
34 namespace media {
35 namespace stream {
43 {
44 public:
51  FileOutputDataSource() = delete;
58  FileOutputDataSource(const std::string& dataPath);
68  FileOutputDataSource(unsigned int channels, unsigned int sampleRate, audio_format_type_t pcmFormat, const std::string& dataPath);
86  virtual ~FileOutputDataSource();
87 
94  bool isPrepare() override;
101  bool open() override;
108  bool close() override;
117  ssize_t write(unsigned char *buf, size_t size) override;
118 
119 private:
120  std::string mDataPath;
121  FILE* mFp;
122 };
123 } // namespace stream
124 } // namespace media
125 
126 #endif
127  // end of MEDIA group
FileOutputDataSource & operator=(const FileOutputDataSource &source)
Operator= for FileOutputDataSource.
ssize_t write(unsigned char *buf, size_t size) override
Write the file.
bool open() override
Open the file.
Media OutputDataSource APIs.
bool isPrepare() override
Whether file is ready to be write.
FileOutputDataSource()=delete
Constructs an empty FileOutputDataSource.
bool close() override
Close the file.
virtual ~FileOutputDataSource()
Deconstructs an empty FileOutputDataSource.