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/filter_helpers.h" | 5 #include "webkit/media/filter_helpers.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "media/base/filter_collection.h" | 9 #include "media/base/filter_collection.h" |
10 #include "media/base/media_switches.h" | 10 #include "media/base/media_switches.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 // Constructs and adds the default video decoders to |filter_collection|. | 32 // Constructs and adds the default video decoders to |filter_collection|. |
33 // | 33 // |
34 // Note that decoders in the |filter_collection| are initialized in order. | 34 // Note that decoders in the |filter_collection| are initialized in order. |
35 static void AddDefaultDecodersToCollection( | 35 static void AddDefaultDecodersToCollection( |
36 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 36 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
37 media::FilterCollection* filter_collection) { | 37 media::FilterCollection* filter_collection) { |
38 | 38 |
39 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | |
40 new media::FFmpegVideoDecoder(message_loop); | |
41 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | |
42 | |
43 // TODO(phajdan.jr): Remove ifdefs when libvpx with vp9 support is released | 39 // TODO(phajdan.jr): Remove ifdefs when libvpx with vp9 support is released |
44 // (http://crbug.com/174287) . | 40 // (http://crbug.com/174287) . |
45 #if !defined(MEDIA_DISABLE_LIBVPX) | 41 #if !defined(MEDIA_DISABLE_LIBVPX) |
46 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 42 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
47 if (cmd_line->HasSwitch(switches::kEnableVp9Playback)) { | 43 if (cmd_line->HasSwitch(switches::kEnableVp9Playback) || |
| 44 cmd_line->HasSwitch(switches::kEnableVp8AlphaPlayback) ) { |
48 scoped_refptr<media::VpxVideoDecoder> vpx_video_decoder = | 45 scoped_refptr<media::VpxVideoDecoder> vpx_video_decoder = |
49 new media::VpxVideoDecoder(message_loop); | 46 new media::VpxVideoDecoder(message_loop); |
50 filter_collection->GetVideoDecoders()->push_back(vpx_video_decoder); | 47 filter_collection->GetVideoDecoders()->push_back(vpx_video_decoder); |
51 } | 48 } |
52 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 49 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
| 50 |
| 51 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
| 52 new media::FFmpegVideoDecoder(message_loop); |
| 53 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
53 } | 54 } |
54 | 55 |
55 void BuildMediaSourceCollection( | 56 void BuildMediaSourceCollection( |
56 const scoped_refptr<media::ChunkDemuxer>& demuxer, | 57 const scoped_refptr<media::ChunkDemuxer>& demuxer, |
57 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 58 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
58 media::FilterCollection* filter_collection) { | 59 media::FilterCollection* filter_collection) { |
59 DCHECK(demuxer); | 60 DCHECK(demuxer); |
60 filter_collection->SetDemuxer(demuxer); | 61 filter_collection->SetDemuxer(demuxer); |
61 | 62 |
62 // Remove GPUVideoDecoder until it supports codec config changes. | 63 // Remove GPUVideoDecoder until it supports codec config changes. |
63 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed. | 64 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed. |
64 DCHECK_LE(filter_collection->GetVideoDecoders()->size(), 1u); | 65 DCHECK_LE(filter_collection->GetVideoDecoders()->size(), 1u); |
65 filter_collection->GetVideoDecoders()->clear(); | 66 filter_collection->GetVideoDecoders()->clear(); |
66 | 67 |
67 AddDefaultDecodersToCollection(message_loop, filter_collection); | 68 AddDefaultDecodersToCollection(message_loop, filter_collection); |
68 } | 69 } |
69 | 70 |
70 void BuildDefaultCollection( | 71 void BuildDefaultCollection( |
71 const scoped_refptr<media::DataSource>& data_source, | 72 const scoped_refptr<media::DataSource>& data_source, |
72 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 73 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
73 media::FilterCollection* filter_collection, | 74 media::FilterCollection* filter_collection, |
74 const media::FFmpegNeedKeyCB& need_key_cb) { | 75 const media::FFmpegNeedKeyCB& need_key_cb) { |
75 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 76 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
76 message_loop, data_source, need_key_cb)); | 77 message_loop, data_source, need_key_cb)); |
77 | 78 |
78 AddDefaultDecodersToCollection(message_loop, filter_collection); | 79 AddDefaultDecodersToCollection(message_loop, filter_collection); |
79 } | 80 } |
80 | 81 |
81 } // webkit_media | 82 } // webkit_media |
OLD | NEW |