Files
shaka-packager/packager/file/callback_file.h
Joey Parrish b1c79e5052
Some checks failed
Update Issues / update-issues (push) Has been cancelled
Release / Settings (push) Has been cancelled
Release / Artifacts (push) Has been cancelled
Release / Update NPM (push) Has been cancelled
Release / Build (push) Has been cancelled
Release / release (push) Has been cancelled
Release / Compute latest release flag (push) Has been cancelled
Release / Update docs (push) Has been cancelled
Release / Update docker image (push) Has been cancelled
Sync Labels / sync-labels (push) Has been cancelled
chore: Fix build in Arch and other dockers (#1506)
This adds missing cstdint headers in every header where we reference a
uint*_t.

This also adds a cmake definition that works around a guard in newer
cmakes that is meant to guard against libraries that only work in older
ones. (`-DCMAKE_POLICY_VERSION_MINIMUM=3.5`)
2025-08-12 11:41:25 -07:00

51 lines
1.5 KiB
C++

// Copyright 2017 Google LLC. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include <cstdint>
#include <packager/file.h>
namespace shaka {
/// Implements CallbackFile, which delegates read/write calls to the callback
/// functions set through the file name.
class CallbackFile : public File {
public:
/// @param file_name is the callback file name, which should have callback
/// address encoded. Note that the file type prefix should be stripped
/// off already.
/// @param mode C string containing a file access mode, refer to fopen for
/// the available modes.
CallbackFile(const char* file_name, const char* mode);
/// @name File implementation overrides.
/// @{
bool Close() override;
int64_t Read(void* buffer, uint64_t length) override;
int64_t Write(const void* buffer, uint64_t length) override;
void CloseForWriting() override;
int64_t Size() override;
bool Flush() override;
bool Seek(uint64_t position) override;
bool Tell(uint64_t* position) override;
/// @}
protected:
~CallbackFile() override;
bool Open() override;
private:
CallbackFile(const CallbackFile&) = delete;
CallbackFile& operator=(const CallbackFile&) = delete;
const BufferCallbackParams* callback_params_ = nullptr;
std::string name_;
std::string file_mode_;
};
} // namespace shaka