Chromium Code Reviews| Index: media/player/player_wtl.cc |
| =================================================================== |
| --- media/player/player_wtl.cc (revision 0) |
| +++ media/player/player_wtl.cc (revision 0) |
| @@ -0,0 +1,96 @@ |
| +// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Stand alone media player application used for testing the media library. |
| + |
| +// ATL compatibility with Chrome build settings. |
| +#undef NOMINMAX |
| +#undef WIN32_LEAN_AND_MEAN |
| + |
| +#undef min |
| +#undef max |
| +#define NOMINMAX |
| + |
| +// Note this header must come before other ATL headers. |
| +#include "media/player/stdafx.h" |
|
scherkus (not reviewing)
2009/04/29 05:29:09
usually stdafx.h is your precompiled header, so it
|
| +#include <atlcrack.h> |
| +#include <atlctrls.h> |
| +#include <atlctrlw.h> |
| +#include <atldlgs.h> |
| +#include <atlframe.h> |
| +#include <atlmisc.h> |
| +#include <atlprint.h> |
| +#include <atlscrl.h> |
| + |
| +// Note these headers are order sensitive. |
| +#include "base/at_exit.h" |
| +#include "media/base/factory.h" |
| +#include "media/base/pipeline_impl.h" |
| +#include "media/player/movie.h" |
| +#include "media/player/resource.h" |
| +#include "media/player/wtl_renderer.h" |
| +#include "media/player/view.h" |
| +#include "media/player/props.h" |
| +#include "media/player/list.h" |
| +#include "media/player/mainfrm.h" |
| + |
| +// Note these headers are NOT order sensitive. |
| +#include "media/filters/audio_renderer_impl.h" |
| +#include "media/filters/ffmpeg_audio_decoder.h" |
| +#include "media/filters/ffmpeg_demuxer.h" |
| +#include "media/filters/ffmpeg_video_decoder.h" |
| +#include "media/filters/file_data_source.h" |
| + |
| +CAppModule g_module; |
|
scherkus (not reviewing)
2009/04/29 05:29:09
given that this is used in other files, it'd be go
|
| + |
| +int Run(wchar_t* cmd_line, int cmd_show) { |
| + CMessageLoop the_loop; |
|
scherkus (not reviewing)
2009/04/29 05:29:09
nit: the_loop is a bit of a funny name :)
most of
|
| + g_module.AddMessageLoop(&the_loop); |
| + |
| + CMainFrame wnd_main; |
| + if (wnd_main.CreateEx() == NULL) { |
| + DCHECK(false) << "Main window creation failed!"; |
| + return 0; |
| + } |
| + |
| + wnd_main.ShowWindow(cmd_show); |
| + |
| + base::AtExitManager exit_manager; |
|
scherkus (not reviewing)
2009/04/29 05:29:09
just realized.. this declaration should actually g
|
| + |
| + wchar_t* url = NULL; |
| + if (cmd_line && *cmd_line) { |
| + url = cmd_line; |
| + } |
| + |
| + if (url) { |
| + wnd_main.MovieOpenFile(url); |
|
scherkus (not reviewing)
2009/04/29 05:29:09
you never use url again, so you may want to rewrit
|
| + } |
| + |
| + int result = the_loop.Run(); |
| + |
| + media::Movie::get()->Close(); |
| + |
| + g_module.RemoveMessageLoop(); |
| + return result; |
| +} |
| + |
| +int WINAPI _tWinMain(HINSTANCE instance, HINSTANCE /*previous_instance*/, |
| + wchar_t* cmd_line, int cmd_show) { |
|
scherkus (not reviewing)
2009/04/29 05:29:09
just a bit of a nit regarding TCHAR vs. wchar_t...
|
| + INITCOMMONCONTROLSEX iccx; |
| + iccx.dwSize = sizeof(iccx); |
| + iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES; |
| + if (!::InitCommonControlsEx(&iccx)) { |
| + DCHECK(false) << "Failed to initialize common controls"; |
| + return 1; |
| + } |
| + if (FAILED(g_module.Init(NULL, instance))) { |
| + DCHECK(false) << "Failed to initialize application module"; |
| + return 1; |
| + } |
| + int result = Run(cmd_line, cmd_show); |
| + |
| + g_module.Term(); |
| + return result; |
| +} |
| + |