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
9#include <packager/file.h>
10
11namespace shaka {
12
15class CallbackFile : public File {
16 public:
22 CallbackFile(const char* file_name, const char* mode);
23
26 bool Close() override;
27 int64_t Read(void* buffer, uint64_t length) override;
28 int64_t Write(const void* buffer, uint64_t length) override;
29 void CloseForWriting() override;
30 int64_t Size() override;
31 bool Flush() override;
32 bool Seek(uint64_t position) override;
33 bool Tell(uint64_t* position) override;
35
36 protected:
37 ~CallbackFile() override;
38
39 bool Open() override;
40
41 private:
42 CallbackFile(const CallbackFile&) = delete;
43 CallbackFile& operator=(const CallbackFile&) = delete;
44
45 const BufferCallbackParams* callback_params_ = nullptr;
46 std::string name_;
47 std::string file_mode_;
48};
49
50} // namespace shaka
All the methods that are virtual are virtual for mocking.