Chromium Code Reviews| Index: media/filters/ffmpeg_demuxer.h |
| diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h |
| index 6097c6b4f31a665d685efc8175fb1ccb59ba6881..1f665e923d1781c4a289624340f5ffe0c06cf9e6 100644 |
| --- a/media/filters/ffmpeg_demuxer.h |
| +++ b/media/filters/ffmpeg_demuxer.h |
| @@ -23,6 +23,7 @@ |
| #define MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| #include <deque> |
| +#include <string> |
| #include <vector> |
| #include "base/callback.h" |
| @@ -43,6 +44,11 @@ struct AVStream; |
| namespace media { |
| +// A new potentially encrypted stream has been parsed. |
| +// First parameter - The initialization data associated with the stream. |
| +// Second parameter - Number of bytes of the initialization data. |
| +typedef base::Callback<bool(scoped_array<uint8>, int)> FFmpegNeedKeyCB; |
| + |
| class FFmpegDemuxer; |
| class FFmpegH264ToAnnexBBitstreamConverter; |
| class ScopedPtrAVFreePacket; |
| @@ -92,6 +98,8 @@ class FFmpegDemuxerStream : public DemuxerStream { |
| // Used to determine stream duration when it's not known ahead of time. |
| base::TimeDelta GetElapsedTime() const; |
| + void KeyAdded(); |
| + |
| protected: |
| virtual ~FFmpegDemuxerStream(); |
| @@ -128,6 +136,9 @@ class FFmpegDemuxerStream : public DemuxerStream { |
| scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; |
| + bool need_decryption_key_; |
|
ddorwin
2012/08/22 23:20:29
Curious why the demuxer cares. It shouldn't be blo
fgalligan1
2012/08/23 02:39:11
See the other comment. Also if we don't have the d
xhwang
2012/08/23 19:04:53
I am not quite sure what's the problem. But the De
fgalligan1
2012/08/24 20:01:26
Removed. With xhwang's change this will work now.
|
| + std::string enc_key_id_; |
|
ddorwin
2012/08/22 23:20:29
Why do we store the key ID as state? There can be
fgalligan1
2012/08/23 02:39:11
I'm using this to decide if to create a DecryptCon
|
| + |
| // Used to synchronize access to |buffer_queue_|, |read_queue_|, and |
| // |stopped_|. This is so other threads can get access to buffers that have |
| // already been demuxed without having the demuxer thread sending the |
| @@ -141,7 +152,8 @@ class FFmpegDemuxerStream : public DemuxerStream { |
| class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { |
| public: |
| FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| - const scoped_refptr<DataSource>& data_source); |
| + const scoped_refptr<DataSource>& data_source, |
| + const FFmpegNeedKeyCB& need_key_cb); |
| // Posts a task to perform additional demuxing. |
| virtual void PostDemuxTask(); |
| @@ -167,6 +179,9 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { |
| // Provide access to FFmpegDemuxerStream. |
| scoped_refptr<base::MessageLoopProxy> message_loop(); |
| + virtual void KeyAdded() OVERRIDE; |
| + void NeedKey(const std::string& key_id); |
|
ddorwin
2012/08/22 23:20:29
Should this be public?
fgalligan1
2012/08/23 02:39:11
This is called from FFmpegDemuxerStream.
|
| + |
| // Allow FFmpegDemuxerStream to notify us when there is updated information |
| // about what buffered data is available. |
| void NotifyBufferingChanged(); |
| @@ -192,6 +207,8 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { |
| // Carries out disabling the audio stream on the demuxer thread. |
| void DisableAudioStreamTask(); |
| + void KeyAddedTask(); |
| + |
| // Returns true if any of the streams have pending reads. Since we lazily |
| // post a DemuxTask() for every read, we use this method to quickly terminate |
| // the tasks if there is no work to do. |
| @@ -267,6 +284,8 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { |
| // stream -- at this moment we definitely know duration. |
| bool duration_known_; |
| + FFmpegNeedKeyCB need_key_cb_; |
|
ddorwin
2012/08/22 23:20:29
const
fgalligan1
2012/08/23 02:39:11
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| }; |