1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
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_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "media/filters/ffmpeg_glue.h"
14 // Simple FFmpegURLProtocol that reads from a buffer.
15 // NOTE: This object does not copy the buffer so the
16 // buffer pointer passed into the constructor
17 // needs to remain valid for the entire lifetime of
19 class MEDIA_EXPORT InMemoryUrlProtocol : public FFmpegURLProtocol {
21 InMemoryUrlProtocol(const uint8* buf, int64 size, bool streaming);
22 virtual ~InMemoryUrlProtocol();
24 // FFmpegURLProtocol methods.
25 int Read(int size, uint8* data) override;
26 bool GetPosition(int64* position_out) override;
27 bool SetPosition(int64 position) override;
28 bool GetSize(int64* size_out) override;
29 bool IsStreaming() override;
37 DISALLOW_IMPLICIT_CONSTRUCTORS(InMemoryUrlProtocol);
42 #endif // MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_