Shaka Packager SDK
Loading...
Searching...
No Matches
callback_file.h
1// Copyright 2017 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#include <cstdint>
8#include <string>
9
10#include <packager/buffer_callback_params.h>
11#include <packager/file.h>
12
13namespace shaka {
14
17class CallbackFile : public File {
18 public:
24 CallbackFile(const char* file_name, const char* mode);
25
28 bool Close() override;
29 int64_t Read(void* buffer, uint64_t length) override;
30 int64_t Write(const void* buffer, uint64_t length) override;
31 void CloseForWriting() override;
32 int64_t Size() override;
33 bool Flush() override;
34 bool Seek(uint64_t position) override;
35 bool Tell(uint64_t* position) override;
37
38 protected:
39 ~CallbackFile() override;
40
41 bool Open() override;
42
43 private:
44 CallbackFile(const CallbackFile&) = delete;
45 CallbackFile& operator=(const CallbackFile&) = delete;
46
47 const BufferCallbackParams* callback_params_ = nullptr;
48 std::string name_;
49 std::string file_mode_;
50};
51
52} // namespace shaka
All the methods that are virtual are virtual for mocking.