1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_
6 #define MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_
10 #include "base/compiler_specific.h"
11 #include "media/filters/ffmpeg_glue.h"
15 // Simple FFmpegURLProtocol that reads from a buffer.
16 // NOTE: This object does not copy the buffer so the
17 // buffer pointer passed into the constructor
18 // needs to remain valid for the entire lifetime of
20 class MEDIA_EXPORT InMemoryUrlProtocol : public FFmpegURLProtocol {
22 InMemoryUrlProtocol() = delete;
24 InMemoryUrlProtocol(const uint8_t* buf, int64_t size, bool streaming);
26 InMemoryUrlProtocol(const InMemoryUrlProtocol&) = delete;
27 InMemoryUrlProtocol& operator=(const InMemoryUrlProtocol&) = delete;
29 virtual ~InMemoryUrlProtocol();
31 // FFmpegURLProtocol methods.
32 int Read(int size, uint8_t* data) override;
33 bool GetPosition(int64_t* position_out) override;
34 bool SetPosition(int64_t position) override;
35 bool GetSize(int64_t* size_out) override;
36 bool IsStreaming() override;
47 #endif // MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_