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

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

Issue 360042: First patch in making destructors of refcounted objects private. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time
6 // will support demuxing any audio/video format thrown at it. The streams 6 // will support demuxing any audio/video format thrown at it. The streams
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs
9 // can be used to create and initialize the corresponding FFmpeg decoder. 9 // can be used to create and initialize the corresponding FFmpeg decoder.
10 // 10 //
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 // Forward declaration for scoped_ptr_malloc. 48 // Forward declaration for scoped_ptr_malloc.
49 class ScopedPtrAVFree; 49 class ScopedPtrAVFree;
50 50
51 class FFmpegDemuxerStream : public DemuxerStream, public AVStreamProvider { 51 class FFmpegDemuxerStream : public DemuxerStream, public AVStreamProvider {
52 public: 52 public:
53 // Maintains a reference to |demuxer| and initializes itself using information 53 // Maintains a reference to |demuxer| and initializes itself using information
54 // inside |stream|. 54 // inside |stream|.
55 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); 55 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream);
56 56
57 virtual ~FFmpegDemuxerStream();
58
59 // Returns true is this stream has pending reads, false otherwise. 57 // Returns true is this stream has pending reads, false otherwise.
60 // 58 //
61 // Safe to call on any thread. 59 // Safe to call on any thread.
62 virtual bool HasPendingReads(); 60 virtual bool HasPendingReads();
63 61
64 // Enqueues and takes ownership over the given AVPacket, returns the timestamp 62 // Enqueues and takes ownership over the given AVPacket, returns the timestamp
65 // of the enqueued packet. 63 // of the enqueued packet.
66 virtual base::TimeDelta EnqueuePacket(AVPacket* packet); 64 virtual base::TimeDelta EnqueuePacket(AVPacket* packet);
67 65
68 // Signals to empty the buffer queue and mark next packet as discontinuous. 66 // Signals to empty the buffer queue and mark next packet as discontinuous.
69 virtual void FlushBuffers(); 67 virtual void FlushBuffers();
70 68
71 // Empties the queues and ignores any additional calls to Read(). 69 // Empties the queues and ignores any additional calls to Read().
72 virtual void Stop(); 70 virtual void Stop();
73 71
74 // Returns the duration of this stream. 72 // Returns the duration of this stream.
75 virtual base::TimeDelta duration() { return duration_; } 73 virtual base::TimeDelta duration() { return duration_; }
76 74
77 // DemuxerStream implementation. 75 // DemuxerStream implementation.
78 virtual const MediaFormat& media_format(); 76 virtual const MediaFormat& media_format();
79 virtual void Read(Callback1<Buffer*>::Type* read_callback); 77 virtual void Read(Callback1<Buffer*>::Type* read_callback);
80 78
81 // AVStreamProvider implementation. 79 // AVStreamProvider implementation.
82 virtual AVStream* GetAVStream() { return stream_; } 80 virtual AVStream* GetAVStream() { return stream_; }
83 81
84 protected: 82 protected:
85 virtual void* QueryInterface(const char* interface_id); 83 virtual void* QueryInterface(const char* interface_id);
86 84
87 private: 85 private:
86 virtual ~FFmpegDemuxerStream();
87
88 // Carries out enqueuing a pending read on the demuxer thread. 88 // Carries out enqueuing a pending read on the demuxer thread.
89 void ReadTask(Callback1<Buffer*>::Type* read_callback); 89 void ReadTask(Callback1<Buffer*>::Type* read_callback);
90 90
91 // Attempts to fulfill a single pending read by dequeueing a buffer and read 91 // Attempts to fulfill a single pending read by dequeueing a buffer and read
92 // callback pair and executing the callback. 92 // callback pair and executing the callback.
93 void FulfillPendingRead(); 93 void FulfillPendingRead();
94 94
95 // Converts an FFmpeg stream timestamp into a base::TimeDelta. 95 // Converts an FFmpeg stream timestamp into a base::TimeDelta.
96 base::TimeDelta ConvertTimestamp(int64 timestamp); 96 base::TimeDelta ConvertTimestamp(int64 timestamp);
97 97
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // If true, then it's our first seek and we won't call av_read_frame(). It's 226 // If true, then it's our first seek and we won't call av_read_frame(). It's
227 // a hack to get around some issue with FFmpeg. 227 // a hack to get around some issue with FFmpeg.
228 bool first_seek_hack_; 228 bool first_seek_hack_;
229 229
230 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 230 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
231 }; 231 };
232 232
233 } // namespace media 233 } // namespace media
234 234
235 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 235 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« media/base/factory.h ('K') | « media/base/factory.h ('k') | printing/printed_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698