| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ |
| 6 #define MEDIA_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const VideoDecodeCB& video_decode_cb) final; | 43 const VideoDecodeCB& video_decode_cb) final; |
| 44 void ResetDecoder(StreamType stream_type) final; | 44 void ResetDecoder(StreamType stream_type) final; |
| 45 void DeinitializeDecoder(StreamType stream_type) final; | 45 void DeinitializeDecoder(StreamType stream_type) final; |
| 46 | 46 |
| 47 // Called when keys have changed and an additional key is available. | 47 // Called when keys have changed and an additional key is available. |
| 48 void OnKeyAdded(); | 48 void OnKeyAdded(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // Called when a buffer is decrypted. | 51 // Called when a buffer is decrypted. |
| 52 void OnBufferDecrypted(const DecryptCB& decrypt_cb, | 52 void OnBufferDecrypted(const DecryptCB& decrypt_cb, |
| 53 mojom::Decryptor::Status status, | 53 Status status, |
| 54 mojom::DecoderBufferPtr buffer); | 54 mojom::DecoderBufferPtr buffer); |
| 55 void OnAudioDecoded(const AudioDecodeCB& audio_decode_cb, | 55 void OnAudioDecoded(const AudioDecodeCB& audio_decode_cb, |
| 56 mojom::Decryptor::Status status, | 56 Status status, |
| 57 std::vector<mojom::AudioBufferPtr> audio_buffers); | 57 std::vector<mojom::AudioBufferPtr> audio_buffers); |
| 58 void OnVideoDecoded(const VideoDecodeCB& video_decode_cb, | 58 void OnVideoDecoded(const VideoDecodeCB& video_decode_cb, |
| 59 mojom::Decryptor::Status status, | 59 Status status, |
| 60 mojom::VideoFramePtr video_frame); | 60 mojom::VideoFramePtr video_frame); |
| 61 | 61 |
| 62 // Called when done with a VideoFrame in order to reuse the shared memory. | 62 // Called when done with a VideoFrame in order to reuse the shared memory. |
| 63 void ReleaseSharedBuffer(mojo::ScopedSharedBufferHandle buffer, | 63 void ReleaseSharedBuffer(mojo::ScopedSharedBufferHandle buffer, |
| 64 size_t buffer_size); | 64 size_t buffer_size); |
| 65 | 65 |
| 66 base::ThreadChecker thread_checker_; | 66 base::ThreadChecker thread_checker_; |
| 67 | 67 |
| 68 mojom::DecryptorPtr remote_decryptor_; | 68 mojom::DecryptorPtr remote_decryptor_; |
| 69 | 69 |
| 70 // Helper class to send DecoderBuffer to the |remote_decryptor_| for decrypt | 70 // Helper class to send DecoderBuffer to the |remote_decryptor_| for decrypt |
| 71 // or decrypt-and-decode. | 71 // or decrypt-and-decode. |
| 72 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; | 72 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; |
| 73 | 73 |
| 74 // Helper class to receive decrypted DecoderBuffer from the | 74 // Helper class to receive decrypted DecoderBuffer from the |
| 75 // |remote_decryptor_|. | 75 // |remote_decryptor_|. |
| 76 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; | 76 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; |
| 77 | 77 |
| 78 NewKeyCB new_audio_key_cb_; | 78 NewKeyCB new_audio_key_cb_; |
| 79 NewKeyCB new_video_key_cb_; | 79 NewKeyCB new_video_key_cb_; |
| 80 | 80 |
| 81 base::WeakPtrFactory<MojoDecryptor> weak_factory_; | 81 base::WeakPtrFactory<MojoDecryptor> weak_factory_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(MojoDecryptor); | 83 DISALLOW_COPY_AND_ASSIGN(MojoDecryptor); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace media | 86 } // namespace media |
| 87 | 87 |
| 88 #endif // MEDIA_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ | 88 #endif // MEDIA_MOJO_CLIENTS_MOJO_DECRYPTOR_H_ |
| OLD | NEW |