OLD | NEW |
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_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_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/decryptor.h" | 10 #include "media/base/decryptor.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual ~FFmpegVideoDecoder(); | 44 virtual ~FFmpegVideoDecoder(); |
45 | 45 |
46 private: | 46 private: |
47 enum DecoderState { | 47 enum DecoderState { |
48 kUninitialized, | 48 kUninitialized, |
49 kNormal, | 49 kNormal, |
50 kFlushCodec, | 50 kFlushCodec, |
51 kDecodeFinished | 51 kDecodeFinished |
52 }; | 52 }; |
53 | 53 |
54 // Carries out the reading operation scheduled by Read(). | 54 // Reads from the demuxer stream and corresponding read callback. |
55 void DoRead(const ReadCB& read_cb); | |
56 | |
57 // Reads from the demuxer stream. | |
58 void ReadFromDemuxerStream(); | 55 void ReadFromDemuxerStream(); |
59 | 56 void DecryptOrDecodeBuffer(DemuxerStream::Status status, |
60 // Carries out the buffer processing operation scheduled by | 57 const scoped_refptr<DecoderBuffer>& buffer); |
61 // DecryptOrDecodeBuffer(). | |
62 void DoDecryptOrDecodeBuffer(DemuxerStream::Status status, | |
63 const scoped_refptr<DecoderBuffer>& buffer); | |
64 | 58 |
65 // Callback called by the decryptor to deliver decrypted data buffer and | 59 // Callback called by the decryptor to deliver decrypted data buffer and |
66 // reporting decrypt status. This callback could be called synchronously or | 60 // reporting decrypt status. This callback could be called synchronously or |
67 // asynchronously. | 61 // asynchronously. |
68 void BufferDecrypted(Decryptor::Status decrypt_status, | 62 void BufferDecrypted(Decryptor::Status decrypt_status, |
69 const scoped_refptr<DecoderBuffer>& buffer); | 63 const scoped_refptr<DecoderBuffer>& buffer); |
70 | 64 |
71 // Carries out the operation scheduled by BufferDecrypted(). | 65 // Handles decoding an unencrypted encoded buffer. |
72 void DoBufferDecrypted(Decryptor::Status decrypt_status, | |
73 const scoped_refptr<DecoderBuffer>& buffer); | |
74 | |
75 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); | 66 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); |
76 bool Decode(const scoped_refptr<DecoderBuffer>& buffer, | 67 bool Decode(const scoped_refptr<DecoderBuffer>& buffer, |
77 scoped_refptr<VideoFrame>* video_frame); | 68 scoped_refptr<VideoFrame>* video_frame); |
78 | 69 |
79 // Handles (re-)initializing the decoder with a (new) config. | 70 // Handles (re-)initializing the decoder with a (new) config. |
80 // Returns true if initialization was successful. | 71 // Returns true if initialization was successful. |
81 bool ConfigureDecoder(); | 72 bool ConfigureDecoder(); |
82 | 73 |
83 // Releases resources associated with |codec_context_| and |av_frame_| | 74 // Releases resources associated with |codec_context_| and |av_frame_| |
84 // and resets them to NULL. | 75 // and resets them to NULL. |
(...skipping 19 matching lines...) Expand all Loading... |
104 scoped_refptr<DemuxerStream> demuxer_stream_; | 95 scoped_refptr<DemuxerStream> demuxer_stream_; |
105 | 96 |
106 Decryptor* decryptor_; | 97 Decryptor* decryptor_; |
107 | 98 |
108 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 99 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
109 }; | 100 }; |
110 | 101 |
111 } // namespace media | 102 } // namespace media |
112 | 103 |
113 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 104 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |