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 virtual int Read(int size, uint8* data) OVERRIDE;
26 virtual bool GetPosition(int64* position_out) OVERRIDE;
27 virtual bool SetPosition(int64 position) OVERRIDE;
28 virtual bool GetSize(int64* size_out) OVERRIDE;
29 virtual bool IsStreaming() OVERRIDE;
37 DISALLOW_IMPLICIT_CONSTRUCTORS(InMemoryUrlProtocol);
42 #endif // MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_