| 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 CONTENT_RENDERER_MEDIA_WEBSOURCEBUFFER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBSOURCEBUFFER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBSOURCEBUFFER_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_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 struct InitSegment; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 class WebSourceBufferImpl : public blink::WebSourceBuffer { | 22 class WebSourceBufferImpl : public blink::WebSourceBuffer { |
| 22 public: | 23 public: |
| 23 WebSourceBufferImpl(const std::string& id, media::ChunkDemuxer* demuxer); | 24 WebSourceBufferImpl(const std::string& id, media::ChunkDemuxer* demuxer); |
| 24 virtual ~WebSourceBufferImpl(); | 25 virtual ~WebSourceBufferImpl(); |
| 25 | 26 |
| 26 // blink::WebSourceBuffer implementation. | 27 // blink::WebSourceBuffer implementation. |
| 27 virtual bool setMode(AppendMode mode); | 28 virtual bool setMode(AppendMode mode); |
| 28 virtual blink::WebTimeRanges buffered(); | 29 virtual blink::WebTimeRanges buffered(); |
| 29 virtual void append( | 30 virtual void append( |
| 30 const unsigned char* data, | 31 const unsigned char* data, |
| 31 unsigned length, | 32 unsigned length, |
| 32 double* timestamp_offset); | 33 double* timestamp_offset); |
| 33 virtual void abort(); | 34 virtual void abort(); |
| 34 virtual void remove(double start, double end); | 35 virtual void remove(double start, double end); |
| 35 virtual bool setTimestampOffset(double offset); | 36 virtual bool setTimestampOffset(double offset); |
| 36 virtual void setAppendWindowStart(double start); | 37 virtual void setAppendWindowStart(double start); |
| 37 virtual void setAppendWindowEnd(double end); | 38 virtual void setAppendWindowEnd(double end); |
| 38 virtual void removedFromMediaSource(); | 39 virtual void removedFromMediaSource(); |
| 39 | 40 |
| 41 void OnNewInitSegment(const media::InitSegment& init_segment, |
| 42 bool active_track_flag); |
| 40 private: | 43 private: |
| 41 std::string id_; | 44 std::string id_; |
| 42 media::ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. | 45 media::ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. |
| 43 | 46 |
| 44 // Controls the offset applied to timestamps when processing appended media | 47 // Controls the offset applied to timestamps when processing appended media |
| 45 // segments. It is initially 0, which indicates that no offset is being | 48 // segments. It is initially 0, which indicates that no offset is being |
| 46 // applied. Both setTimestampOffset() and append() may update this value. | 49 // applied. Both setTimestampOffset() and append() may update this value. |
| 47 base::TimeDelta timestamp_offset_; | 50 base::TimeDelta timestamp_offset_; |
| 48 | 51 |
| 49 base::TimeDelta append_window_start_; | 52 base::TimeDelta append_window_start_; |
| 50 base::TimeDelta append_window_end_; | 53 base::TimeDelta append_window_end_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); | 55 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 } // namespace content | 58 } // namespace content |
| 56 | 59 |
| 57 #endif // CONTENT_RENDERER_MEDIA_WEBSOURCEBUFFER_IMPL_H_ | 60 #endif // CONTENT_RENDERER_MEDIA_WEBSOURCEBUFFER_IMPL_H_ |
| OLD | NEW |