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

Side by Side Diff: media/base/video_decoder.h

Issue 12989009: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ 5 #ifndef MEDIA_BASE_VIDEO_DECODER_H_
6 #define MEDIA_BASE_VIDEO_DECODER_H_ 6 #define MEDIA_BASE_VIDEO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/pipeline_status.h" 10 #include "media/base/pipeline_status.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class DemuxerStream; 16 class DemuxerStream;
17 class VideoFrame; 17 class VideoFrame;
18 18
19 class MEDIA_EXPORT VideoDecoder 19 class MEDIA_EXPORT VideoDecoder {
20 : public base::RefCountedThreadSafe<VideoDecoder> {
21 public: 20 public:
22 // Status codes for read operations on VideoDecoder. 21 // Status codes for read operations on VideoDecoder.
23 enum Status { 22 enum Status {
24 kOk, // Everything went as planned. 23 kOk, // Everything went as planned.
25 kDecodeError, // Decoding error happened. 24 kDecodeError, // Decoding error happened.
26 kDecryptError // Decrypting error happened. 25 kDecryptError // Decrypting error happened.
27 }; 26 };
28 27
28 VideoDecoder();
29 virtual ~VideoDecoder();
30
29 // Initializes a VideoDecoder with the given DemuxerStream, executing the 31 // Initializes a VideoDecoder with the given DemuxerStream, executing the
30 // |status_cb| upon completion. 32 // |status_cb| upon completion.
31 // |statistics_cb| is used to update the global pipeline statistics. 33 // |statistics_cb| is used to update the global pipeline statistics.
32 // Note: No VideoDecoder calls should be made before |status_cb| is executed. 34 // Note: No VideoDecoder calls should be made before |status_cb| is executed.
33 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 35 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
34 const PipelineStatusCB& status_cb, 36 const PipelineStatusCB& status_cb,
35 const StatisticsCB& statistics_cb) = 0; 37 const StatisticsCB& statistics_cb) = 0;
36 38
37 // Requests a frame to be decoded. The status of the decoder and decoded frame 39 // Requests a frame to be decoded. The status of the decoder and decoded frame
38 // are returned via the provided callback. Only one read may be in flight at 40 // are returned via the provided callback. Only one read may be in flight at
(...skipping 29 matching lines...) Expand all
68 // have alpha so the default is false. Override and return true for decoders 70 // have alpha so the default is false. Override and return true for decoders
69 // that return formats with an alpha channel. 71 // that return formats with an alpha channel.
70 virtual bool HasAlpha() const; 72 virtual bool HasAlpha() const;
71 73
72 // Returns true if the decoder currently has the ability to decode and return 74 // Returns true if the decoder currently has the ability to decode and return
73 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence 75 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence
74 // this will always return true. Override and return false for decoders that 76 // this will always return true. Override and return false for decoders that
75 // use a fixed set of VideoFrames for decoding. 77 // use a fixed set of VideoFrames for decoding.
76 virtual bool HasOutputFrameAvailable() const; 78 virtual bool HasOutputFrameAvailable() const;
77 79
78 protected: 80 private:
79 friend class base::RefCountedThreadSafe<VideoDecoder>;
80 virtual ~VideoDecoder();
81 VideoDecoder();
82
83 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); 81 DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
84 }; 82 };
85 83
86 } // namespace media 84 } // namespace media
87 85
88 #endif // MEDIA_BASE_VIDEO_DECODER_H_ 86 #endif // MEDIA_BASE_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698