Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: media/filters/ffmpeg_glue.h

Issue 7203002: Adding ChunkDemuxer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup & commenting Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // FFmpegGlue is an adapter for FFmpeg's URLProtocol interface that allows us to 5 // FFmpegGlue is an adapter for FFmpeg's URLProtocol interface that allows us to
6 // use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's 6 // use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's
7 // av_open_input_file function, which analyzes the filename given to it and 7 // av_open_input_file function, which analyzes the filename given to it and
8 // automatically initializes the appropriate URLProtocol. 8 // automatically initializes the appropriate URLProtocol.
9 // 9 //
10 // Since the DataSource is already open by time we call av_open_input_file, we 10 // Since the DataSource is already open by time we call av_open_input_file, we
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // retrieved. 57 // retrieved.
58 virtual bool GetSize(int64* size_out) = 0; 58 virtual bool GetSize(int64* size_out) = 0;
59 59
60 // Returns false if this protocol supports random seeking. 60 // Returns false if this protocol supports random seeking.
61 virtual bool IsStreaming() = 0; 61 virtual bool IsStreaming() = 0;
62 62
63 private: 63 private:
64 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); 64 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol);
65 }; 65 };
66 66
67 // Simple FFmpegURLProtocol that reads from a buffer.
68 // NOTE: This object does not copy the buffer so the
69 // buffer pointer passed into the constructor
70 // needs to remain valid for the entire lifetime of
71 // this object.
72 class BufferUrlProtocol : public FFmpegURLProtocol {
scherkus (not reviewing) 2011/06/22 17:31:09 any reason why this class can't be a part of the c
acolwell GONE FROM CHROMIUM 2011/06/23 16:51:28 Done. Moved code to media/filters/buffer_url_proto
73 public:
74 BufferUrlProtocol(const uint8* buf, int size, bool streaming);
75 virtual ~BufferUrlProtocol();
76
77 // FFmpegURLProtocol methods.
78 virtual int Read(int size, uint8* data);
79 virtual bool GetPosition(int64* position_out);
80 virtual bool SetPosition(int64 position);
81 virtual bool GetSize(int64* size_out);
82 virtual bool IsStreaming();
83
84 private:
85 const uint8* buf_;
86 int size_;
87 int offset_;
88 bool streaming_;
89 };
scherkus (not reviewing) 2011/06/22 17:31:09 DISALLOW etc.
acolwell GONE FROM CHROMIUM 2011/06/23 16:51:28 Done.
90
67 class FFmpegGlue { 91 class FFmpegGlue {
68 public: 92 public:
69 // Returns the singleton instance. 93 // Returns the singleton instance.
70 static FFmpegGlue* GetInstance(); 94 static FFmpegGlue* GetInstance();
71 95
72 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string 96 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string
73 // that can be passed to FFmpeg to identify the data source. 97 // that can be passed to FFmpeg to identify the data source.
74 std::string AddProtocol(FFmpegURLProtocol* protocol); 98 std::string AddProtocol(FFmpegURLProtocol* protocol);
75 99
76 // Removes a FFmpegProtocol from the FFmpeg glue layer. Using strings from 100 // Removes a FFmpegProtocol from the FFmpeg glue layer. Using strings from
(...skipping 21 matching lines...) Expand all
98 // Map between keys and FFmpegProtocol references. 122 // Map between keys and FFmpegProtocol references.
99 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; 123 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap;
100 ProtocolMap protocols_; 124 ProtocolMap protocols_;
101 125
102 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); 126 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue);
103 }; 127 };
104 128
105 } // namespace media 129 } // namespace media
106 130
107 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ 131 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698