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" |
| 11 #include "media/base/demuxer_stream.h" |
11 #include "media/base/video_decoder.h" | 12 #include "media/base/video_decoder.h" |
12 | 13 |
13 class MessageLoop; | 14 class MessageLoop; |
14 | 15 |
15 struct AVCodecContext; | 16 struct AVCodecContext; |
16 struct AVFrame; | 17 struct AVFrame; |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 | 20 |
20 class DecoderBuffer; | 21 class DecoderBuffer; |
(...skipping 29 matching lines...) Expand all Loading... |
50 kNormal, | 51 kNormal, |
51 kFlushCodec, | 52 kFlushCodec, |
52 kDecodeFinished, | 53 kDecodeFinished, |
53 }; | 54 }; |
54 | 55 |
55 // Carries out the reading operation scheduled by Read(). | 56 // Carries out the reading operation scheduled by Read(). |
56 void DoRead(const ReadCB& read_cb); | 57 void DoRead(const ReadCB& read_cb); |
57 | 58 |
58 // Reads from the demuxer stream with corresponding callback method. | 59 // Reads from the demuxer stream with corresponding callback method. |
59 void ReadFromDemuxerStream(); | 60 void ReadFromDemuxerStream(); |
60 void DecryptOrDecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); | 61 void DecryptOrDecodeBuffer(DemuxerStream::Status status, |
| 62 const scoped_refptr<DecoderBuffer>& buffer); |
61 | 63 |
62 // Carries out the buffer processing operation scheduled by | 64 // Carries out the buffer processing operation scheduled by |
63 // DecryptOrDecodeBuffer(). | 65 // DecryptOrDecodeBuffer(). |
64 void DoDecryptOrDecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); | 66 void DoDecryptOrDecodeBuffer(DemuxerStream::Status status, |
| 67 const scoped_refptr<DecoderBuffer>& buffer); |
65 | 68 |
66 // Callback called by the decryptor to deliver decrypted data buffer and | 69 // Callback called by the decryptor to deliver decrypted data buffer and |
67 // reporting decrypt status. This callback could be called synchronously or | 70 // reporting decrypt status. This callback could be called synchronously or |
68 // asynchronously. | 71 // asynchronously. |
69 void BufferDecrypted(Decryptor::DecryptStatus decrypt_status, | 72 void BufferDecrypted(Decryptor::DecryptStatus decrypt_status, |
70 const scoped_refptr<DecoderBuffer>& buffer); | 73 const scoped_refptr<DecoderBuffer>& buffer); |
71 | 74 |
72 // Carries out the operation scheduled by BufferDecrypted(). | 75 // Carries out the operation scheduled by BufferDecrypted(). |
73 void DoBufferDecrypted(Decryptor::DecryptStatus decrypt_status, | 76 void DoBufferDecrypted(Decryptor::DecryptStatus decrypt_status, |
74 const scoped_refptr<DecoderBuffer>& buffer); | 77 const scoped_refptr<DecoderBuffer>& buffer); |
75 | 78 |
76 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); | 79 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); |
77 bool Decode(const scoped_refptr<DecoderBuffer>& buffer, | 80 bool Decode(const scoped_refptr<DecoderBuffer>& buffer, |
78 scoped_refptr<VideoFrame>* video_frame); | 81 scoped_refptr<VideoFrame>* video_frame); |
79 | 82 |
80 // Delivers the frame to |read_cb_| and resets the callback. | |
81 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); | |
82 | |
83 // Releases resources associated with |codec_context_| and |av_frame_| | 83 // Releases resources associated with |codec_context_| and |av_frame_| |
84 // and resets them to NULL. | 84 // and resets them to NULL. |
85 void ReleaseFFmpegResources(); | 85 void ReleaseFFmpegResources(); |
86 | 86 |
87 // Reset decoder and call |reset_cb_|. | 87 // Reset decoder and call |reset_cb_|. |
88 void DoReset(); | 88 void DoReset(); |
89 | 89 |
90 // This is !is_null() iff Initialize() hasn't been called. | 90 // This is !is_null() iff Initialize() hasn't been called. |
91 base::Callback<MessageLoop*()> message_loop_factory_cb_; | 91 base::Callback<MessageLoop*()> message_loop_factory_cb_; |
92 | 92 |
(...skipping 22 matching lines...) Expand all Loading... |
115 scoped_refptr<DemuxerStream> demuxer_stream_; | 115 scoped_refptr<DemuxerStream> demuxer_stream_; |
116 | 116 |
117 Decryptor* decryptor_; | 117 Decryptor* decryptor_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 119 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace media | 122 } // namespace media |
123 | 123 |
124 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 124 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |