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 #include "webkit/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 if (web_video_frame) { | 638 if (web_video_frame) { |
639 scoped_refptr<media::VideoFrame> video_frame( | 639 scoped_refptr<media::VideoFrame> video_frame( |
640 WebVideoFrameImpl::toVideoFrame(web_video_frame)); | 640 WebVideoFrameImpl::toVideoFrame(web_video_frame)); |
641 proxy_->PutCurrentFrame(video_frame); | 641 proxy_->PutCurrentFrame(video_frame); |
642 delete web_video_frame; | 642 delete web_video_frame; |
643 } else { | 643 } else { |
644 proxy_->PutCurrentFrame(NULL); | 644 proxy_->PutCurrentFrame(NULL); |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
| 648 #define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \ |
| 649 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayer::webkit_name) == \ |
| 650 static_cast<int>(media::ChunkDemuxer::chromium_name), \ |
| 651 mismatching_status_enums) |
| 652 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusOk, kOk); |
| 653 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusNotSupported, kNotSupported); |
| 654 COMPILE_ASSERT_MATCHING_STATUS_ENUM(AddIdStatusReachedIdLimit, kReachedIdLimit); |
| 655 |
| 656 WebKit::WebMediaPlayer::AddIdStatus WebMediaPlayerImpl::sourceAddId( |
| 657 const WebKit::WebString& id, |
| 658 const WebKit::WebString& type) { |
| 659 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 660 return static_cast<WebKit::WebMediaPlayer::AddIdStatus>( |
| 661 proxy_->DemuxerAddId(id.utf8().data(), type.utf8().data())); |
| 662 } |
| 663 |
| 664 bool WebMediaPlayerImpl::sourceRemoveId(const WebKit::WebString& id) { |
| 665 DCHECK(!id.isEmpty()); |
| 666 proxy_->DemuxerRemoveId(id.utf8().data()); |
| 667 return true; |
| 668 } |
| 669 |
648 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, | 670 bool WebMediaPlayerImpl::sourceAppend(const unsigned char* data, |
649 unsigned length) { | 671 unsigned length) { |
| 672 return sourceAppend(WebKit::WebString::fromUTF8("DefaultSourceId"), |
| 673 data, length); |
| 674 } |
| 675 |
| 676 bool WebMediaPlayerImpl::sourceAppend(const WebKit::WebString& id, |
| 677 const unsigned char* data, |
| 678 unsigned length) { |
650 DCHECK_EQ(main_loop_, MessageLoop::current()); | 679 DCHECK_EQ(main_loop_, MessageLoop::current()); |
651 return proxy_->DemuxerAppend(data, length); | 680 return proxy_->DemuxerAppend(id.utf8().data(), data, length); |
652 } | 681 } |
653 | 682 |
654 void WebMediaPlayerImpl::sourceEndOfStream( | 683 void WebMediaPlayerImpl::sourceEndOfStream( |
655 WebMediaPlayer::EndOfStreamStatus status) { | 684 WebMediaPlayer::EndOfStreamStatus status) { |
656 DCHECK_EQ(main_loop_, MessageLoop::current()); | 685 DCHECK_EQ(main_loop_, MessageLoop::current()); |
657 media::PipelineStatus pipeline_status = media::PIPELINE_OK; | 686 media::PipelineStatus pipeline_status = media::PIPELINE_OK; |
658 | 687 |
659 switch(status) { | 688 switch(status) { |
660 case WebMediaPlayer::EndOfStreamStatusNoError: | 689 case WebMediaPlayer::EndOfStreamStatusNoError: |
661 break; | 690 break; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 return audio_source_provider_; | 1059 return audio_source_provider_; |
1031 } | 1060 } |
1032 | 1061 |
1033 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1062 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
1034 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1063 DCHECK_EQ(main_loop_, MessageLoop::current()); |
1035 incremented_externally_allocated_memory_ = true; | 1064 incremented_externally_allocated_memory_ = true; |
1036 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1065 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
1037 } | 1066 } |
1038 | 1067 |
1039 } // namespace webkit_media | 1068 } // namespace webkit_media |
OLD | NEW |