| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "third_party/WebKit/public/platform/WebSourceBuffer.h" | 13 #include "third_party/WebKit/public/platform/WebSourceBuffer.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 class ChunkDemuxer; | 16 class ChunkDemuxer; |
| 17 | 17 |
| 18 class WebSourceBufferImpl : public blink::WebSourceBuffer { | 18 class WebSourceBufferImpl : public blink::WebSourceBuffer { |
| 19 public: | 19 public: |
| 20 WebSourceBufferImpl(const std::string& id, ChunkDemuxer* demuxer); | 20 WebSourceBufferImpl(const std::string& id, ChunkDemuxer* demuxer); |
| 21 virtual ~WebSourceBufferImpl(); | 21 virtual ~WebSourceBufferImpl(); |
| 22 | 22 |
| 23 // blink::WebSourceBuffer implementation. | 23 // blink::WebSourceBuffer implementation. |
| 24 virtual void setClient(blink::WebSourceBufferClient* client); |
| 24 virtual bool setMode(AppendMode mode); | 25 virtual bool setMode(AppendMode mode); |
| 25 virtual blink::WebTimeRanges buffered(); | 26 virtual blink::WebTimeRanges buffered(); |
| 26 virtual void append( | 27 virtual void append( |
| 27 const unsigned char* data, | 28 const unsigned char* data, |
| 28 unsigned length, | 29 unsigned length, |
| 29 double* timestamp_offset); | 30 double* timestamp_offset); |
| 30 virtual void abort(); | 31 virtual void abort(); |
| 31 virtual void remove(double start, double end); | 32 virtual void remove(double start, double end); |
| 32 virtual bool setTimestampOffset(double offset); | 33 virtual bool setTimestampOffset(double offset); |
| 33 virtual void setAppendWindowStart(double start); | 34 virtual void setAppendWindowStart(double start); |
| 34 virtual void setAppendWindowEnd(double end); | 35 virtual void setAppendWindowEnd(double end); |
| 35 virtual void removedFromMediaSource(); | 36 virtual void removedFromMediaSource(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 39 // Demuxer callback handler to process an initialization segment received |
| 40 // during an append() call. |
| 41 // BIG TODO: Add parameters here and in WebSourceBufferClient/SourceBuffer |
| 42 // when migrating the algorithm impl to blink. |
| 43 void InitSegmentReceived(); |
| 44 |
| 38 std::string id_; | 45 std::string id_; |
| 39 ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. | 46 ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. |
| 40 | 47 |
| 48 blink::WebSourceBufferClient* client_; |
| 49 |
| 41 // Controls the offset applied to timestamps when processing appended media | 50 // Controls the offset applied to timestamps when processing appended media |
| 42 // segments. It is initially 0, which indicates that no offset is being | 51 // segments. It is initially 0, which indicates that no offset is being |
| 43 // applied. Both setTimestampOffset() and append() may update this value. | 52 // applied. Both setTimestampOffset() and append() may update this value. |
| 44 base::TimeDelta timestamp_offset_; | 53 base::TimeDelta timestamp_offset_; |
| 45 | 54 |
| 46 base::TimeDelta append_window_start_; | 55 base::TimeDelta append_window_start_; |
| 47 base::TimeDelta append_window_end_; | 56 base::TimeDelta append_window_end_; |
| 48 | 57 |
| 49 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); | 58 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); |
| 50 }; | 59 }; |
| 51 | 60 |
| 52 } // namespace media | 61 } // namespace media |
| 53 | 62 |
| 54 #endif // MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 63 #endif // MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| OLD | NEW |