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

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

Issue 10825194: Change Deryptor::DecryptStatus and VideoDecoder::DecoderStatus to *::Status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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
« no previous file with comments | « media/base/decryptor.h ('k') | media/crypto/aes_decryptor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> { 20 : public base::RefCountedThreadSafe<VideoDecoder> {
21 public: 21 public:
22 // Status codes for read operations on VideoDecoder. 22 // Status codes for read operations on VideoDecoder.
23 enum DecoderStatus { 23 enum Status {
24 kOk, // Everything went as planned. 24 kOk, // Everything went as planned.
25 kDecodeError, // Decoding error happened. 25 kDecodeError, // Decoding error happened.
26 kDecryptError // Decrypting error happened. 26 kDecryptError // Decrypting error happened.
27 }; 27 };
28 28
29 // Initialize a VideoDecoder with the given DemuxerStream, executing the 29 // Initialize a VideoDecoder with the given DemuxerStream, executing the
30 // callback upon completion. 30 // callback upon completion.
31 // statistics_cb is used to update global pipeline statistics. 31 // statistics_cb is used to update global pipeline statistics.
32 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 32 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
33 const PipelineStatusCB& status_cb, 33 const PipelineStatusCB& status_cb,
34 const StatisticsCB& statistics_cb) = 0; 34 const StatisticsCB& statistics_cb) = 0;
35 35
36 // Requests a frame to be decoded. The status of the decoder and decoded frame 36 // Requests a frame to be decoded. The status of the decoder and decoded frame
37 // are returned via the provided callback. Only one read may be in flight at 37 // are returned via the provided callback. Only one read may be in flight at
38 // any given time. 38 // any given time.
39 // 39 //
40 // Implementations guarantee that the callback will not be called from within 40 // Implementations guarantee that the callback will not be called from within
41 // this method. 41 // this method.
42 // 42 //
43 // If the returned status is not kOk, some error has occurred in the video 43 // If the returned status is not kOk, some error has occurred in the video
44 // decoder. In this case, the returned frame should always be NULL. 44 // decoder. In this case, the returned frame should always be NULL.
45 // 45 //
46 // Otherwise, the video decoder is in good shape. In this case, Non-NULL 46 // Otherwise, the video decoder is in good shape. In this case, Non-NULL
47 // frames contain decoded video data or may indicate the end of the stream. 47 // frames contain decoded video data or may indicate the end of the stream.
48 // NULL video frames indicate an aborted read. This can happen if the 48 // NULL video frames indicate an aborted read. This can happen if the
49 // DemuxerStream gets flushed and doesn't have any more data to return. 49 // DemuxerStream gets flushed and doesn't have any more data to return.
50 typedef base::Callback<void(DecoderStatus, 50 typedef base::Callback<void(Status, const scoped_refptr<VideoFrame>&)> ReadCB;
51 const scoped_refptr<VideoFrame>&)> ReadCB;
52 virtual void Read(const ReadCB& read_cb) = 0; 51 virtual void Read(const ReadCB& read_cb) = 0;
53 52
54 // Reset decoder state, fulfilling all pending ReadCB and dropping extra 53 // Reset decoder state, fulfilling all pending ReadCB and dropping extra
55 // queued decoded data. After this call, the decoder is back to an initialized 54 // queued decoded data. After this call, the decoder is back to an initialized
56 // clean state. 55 // clean state.
57 virtual void Reset(const base::Closure& closure) = 0; 56 virtual void Reset(const base::Closure& closure) = 0;
58 57
59 // Stop decoder and set it to an uninitialized state. Note that a VideoDecoder 58 // Stop decoder and set it to an uninitialized state. Note that a VideoDecoder
60 // should/could not be re-initialized after it has been stopped. 59 // should/could not be re-initialized after it has been stopped.
61 virtual void Stop(const base::Closure& closure) = 0; 60 virtual void Stop(const base::Closure& closure) = 0;
(...skipping 15 matching lines...) Expand all
77 friend class base::RefCountedThreadSafe<VideoDecoder>; 76 friend class base::RefCountedThreadSafe<VideoDecoder>;
78 virtual ~VideoDecoder(); 77 virtual ~VideoDecoder();
79 VideoDecoder(); 78 VideoDecoder();
80 79
81 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); 80 DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
82 }; 81 };
83 82
84 } // namespace media 83 } // namespace media
85 84
86 #endif // MEDIA_BASE_VIDEO_DECODER_H_ 85 #endif // MEDIA_BASE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/base/decryptor.h ('k') | media/crypto/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698