OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/pepper/video_decoder_shim.h" | 5 #include "content/renderer/pepper/video_decoder_shim.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 kProgram_GrGLBackendState | kPixelStore_GrGLBackendState; | 42 kProgram_GrGLBackendState | kPixelStore_GrGLBackendState; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 bool IsCodecSupported(media::VideoCodec codec) { | 46 bool IsCodecSupported(media::VideoCodec codec) { |
47 #if !defined(MEDIA_DISABLE_LIBVPX) | 47 #if !defined(MEDIA_DISABLE_LIBVPX) |
48 if (codec == media::kCodecVP9) | 48 if (codec == media::kCodecVP9) |
49 return true; | 49 return true; |
50 #endif | 50 #endif |
51 | 51 |
| 52 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
52 return media::FFmpegVideoDecoder::IsCodecSupported(codec); | 53 return media::FFmpegVideoDecoder::IsCodecSupported(codec); |
| 54 #else |
| 55 return false; |
| 56 #endif |
53 } | 57 } |
54 | 58 |
55 } // namespace | 59 } // namespace |
56 | 60 |
57 // YUV->RGB converter class using a shader and FBO. | 61 // YUV->RGB converter class using a shader and FBO. |
58 class VideoDecoderShim::YUVConverter { | 62 class VideoDecoderShim::YUVConverter { |
59 public: | 63 public: |
60 YUVConverter(const scoped_refptr<cc_blink::ContextProviderWebContext>&); | 64 YUVConverter(const scoped_refptr<cc_blink::ContextProviderWebContext>&); |
61 ~YUVConverter(); | 65 ~YUVConverter(); |
62 bool Initialize(); | 66 bool Initialize(); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 686 |
683 void VideoDecoderShim::DecoderImpl::Initialize( | 687 void VideoDecoderShim::DecoderImpl::Initialize( |
684 media::VideoDecoderConfig config) { | 688 media::VideoDecoderConfig config) { |
685 DCHECK(!decoder_); | 689 DCHECK(!decoder_); |
686 #if !defined(MEDIA_DISABLE_LIBVPX) | 690 #if !defined(MEDIA_DISABLE_LIBVPX) |
687 if (config.codec() == media::kCodecVP9) { | 691 if (config.codec() == media::kCodecVP9) { |
688 decoder_.reset( | 692 decoder_.reset( |
689 new media::VpxVideoDecoder(base::ThreadTaskRunnerHandle::Get())); | 693 new media::VpxVideoDecoder(base::ThreadTaskRunnerHandle::Get())); |
690 } else | 694 } else |
691 #endif | 695 #endif |
| 696 |
| 697 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
692 { | 698 { |
693 scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( | 699 scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( |
694 new media::FFmpegVideoDecoder(base::ThreadTaskRunnerHandle::Get())); | 700 new media::FFmpegVideoDecoder(base::ThreadTaskRunnerHandle::Get())); |
695 ffmpeg_video_decoder->set_decode_nalus(true); | 701 ffmpeg_video_decoder->set_decode_nalus(true); |
696 decoder_ = ffmpeg_video_decoder.Pass(); | 702 decoder_ = ffmpeg_video_decoder.Pass(); |
697 } | 703 } |
| 704 #elif defined(MEDIA_DISABLE_LIBVPX) |
| 705 OnInitDone(false); |
| 706 return; |
| 707 #endif |
698 | 708 |
699 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() | 709 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() |
700 // request. | 710 // request. |
701 DCHECK_EQ(decoder_->GetMaxDecodeRequests(), 1); | 711 DCHECK_EQ(decoder_->GetMaxDecodeRequests(), 1); |
702 | 712 |
703 decoder_->Initialize( | 713 decoder_->Initialize( |
704 config, true /* low_delay */, media::SetCdmReadyCB(), | 714 config, true /* low_delay */, media::SetCdmReadyCB(), |
705 base::Bind(&VideoDecoderShim::DecoderImpl::OnInitDone, | 715 base::Bind(&VideoDecoderShim::DecoderImpl::OnInitDone, |
706 weak_ptr_factory_.GetWeakPtr()), | 716 weak_ptr_factory_.GetWeakPtr()), |
707 base::Bind(&VideoDecoderShim::DecoderImpl::OnOutputComplete, | 717 base::Bind(&VideoDecoderShim::DecoderImpl::OnOutputComplete, |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
1108 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
1109 gles2->DeleteTextures(1, &texture_id); | 1119 gles2->DeleteTextures(1, &texture_id); |
1110 } | 1120 } |
1111 | 1121 |
1112 void VideoDecoderShim::FlushCommandBuffer() { | 1122 void VideoDecoderShim::FlushCommandBuffer() { |
1113 context_provider_->ContextGL()->Flush(); | 1123 context_provider_->ContextGL()->Flush(); |
1114 } | 1124 } |
1115 | 1125 |
1116 } // namespace content | 1126 } // namespace content |
OLD | NEW |