| 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 <signal.h> | 5 #include <signal.h> |
| 6 | 6 |
| 7 #include <iostream> // NOLINT | 7 #include <iostream> // NOLINT |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 message_loop->PostTask(FROM_HERE, base::Bind( | 87 message_loop->PostTask(FROM_HERE, base::Bind( |
| 88 &Paint, message_loop, paint_cb, video_frame)); | 88 &Paint, message_loop, paint_cb, video_frame)); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 | 91 |
| 92 paint_cb.Run(video_frame); | 92 paint_cb.Run(video_frame); |
| 93 } | 93 } |
| 94 | 94 |
| 95 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {} | 95 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {} |
| 96 | 96 |
| 97 static void NeedKey(const std::string& type, scoped_array<uint8> init_data, |
| 98 int init_data_size) { |
| 99 std::cout << "File is encrypted." << std::endl; |
| 100 } |
| 101 |
| 97 // TODO(vrk): Re-enabled audio. (crbug.com/112159) | 102 // TODO(vrk): Re-enabled audio. (crbug.com/112159) |
| 98 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, | 103 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 99 const scoped_refptr<media::DataSource>& data_source, | 104 const scoped_refptr<media::DataSource>& data_source, |
| 100 const PaintCB& paint_cb, | 105 const PaintCB& paint_cb, |
| 101 bool /* enable_audio */, | 106 bool /* enable_audio */, |
| 102 scoped_refptr<media::Pipeline>* pipeline, | 107 scoped_refptr<media::Pipeline>* pipeline, |
| 103 MessageLoop* paint_message_loop) { | 108 MessageLoop* paint_message_loop) { |
| 104 // Create our filter factories. | 109 // Create our filter factories. |
| 105 scoped_ptr<media::FilterCollection> collection( | 110 scoped_ptr<media::FilterCollection> collection( |
| 106 new media::FilterCollection()); | 111 new media::FilterCollection()); |
| 107 collection->SetDemuxer(new media::FFmpegDemuxer(message_loop, data_source)); | 112 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey); |
| 113 collection->SetDemuxer(new media::FFmpegDemuxer(message_loop, data_source, |
| 114 need_key_cb)); |
| 108 collection->GetAudioDecoders()->push_back(new media::FFmpegAudioDecoder( | 115 collection->GetAudioDecoders()->push_back(new media::FFmpegAudioDecoder( |
| 109 message_loop)); | 116 message_loop)); |
| 110 collection->GetVideoDecoders()->push_back(new media::FFmpegVideoDecoder( | 117 collection->GetVideoDecoders()->push_back(new media::FFmpegVideoDecoder( |
| 111 message_loop)); | 118 message_loop)); |
| 112 | 119 |
| 113 // Create our video renderer and save a reference to it for painting. | 120 // Create our video renderer and save a reference to it for painting. |
| 114 scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererBase( | 121 scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererBase( |
| 115 message_loop, | 122 message_loop, |
| 116 media::SetDecryptorReadyCB(), | 123 media::SetDecryptorReadyCB(), |
| 117 base::Bind(&Paint, paint_message_loop, paint_cb), | 124 base::Bind(&Paint, paint_message_loop, paint_cb), |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // Release callback which releases video renderer. Do this before cleaning up | 298 // Release callback which releases video renderer. Do this before cleaning up |
| 292 // X below since the video renderer has some X cleanup duties as well. | 299 // X below since the video renderer has some X cleanup duties as well. |
| 293 paint_cb.Reset(); | 300 paint_cb.Reset(); |
| 294 | 301 |
| 295 XDestroyWindow(g_display, g_window); | 302 XDestroyWindow(g_display, g_window); |
| 296 XCloseDisplay(g_display); | 303 XCloseDisplay(g_display); |
| 297 g_audio_manager = NULL; | 304 g_audio_manager = NULL; |
| 298 | 305 |
| 299 return 0; | 306 return 0; |
| 300 } | 307 } |
| OLD | NEW |