OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Stand alone media player application used for testing the media library. | |
6 | |
7 // ATL compatibility with Chrome build settings. | |
8 #undef NOMINMAX | |
9 #undef WIN32_LEAN_AND_MEAN | |
10 | |
11 #undef min | |
12 #undef max | |
13 #define NOMINMAX | |
14 | |
15 // Note this header must come before other ATL headers. | |
16 #include "media/player/stdafx.h" | |
scherkus (not reviewing)
2009/04/29 05:29:09
usually stdafx.h is your precompiled header, so it
| |
17 #include <atlcrack.h> | |
18 #include <atlctrls.h> | |
19 #include <atlctrlw.h> | |
20 #include <atldlgs.h> | |
21 #include <atlframe.h> | |
22 #include <atlmisc.h> | |
23 #include <atlprint.h> | |
24 #include <atlscrl.h> | |
25 | |
26 // Note these headers are order sensitive. | |
27 #include "base/at_exit.h" | |
28 #include "media/base/factory.h" | |
29 #include "media/base/pipeline_impl.h" | |
30 #include "media/player/movie.h" | |
31 #include "media/player/resource.h" | |
32 #include "media/player/wtl_renderer.h" | |
33 #include "media/player/view.h" | |
34 #include "media/player/props.h" | |
35 #include "media/player/list.h" | |
36 #include "media/player/mainfrm.h" | |
37 | |
38 // Note these headers are NOT order sensitive. | |
39 #include "media/filters/audio_renderer_impl.h" | |
40 #include "media/filters/ffmpeg_audio_decoder.h" | |
41 #include "media/filters/ffmpeg_demuxer.h" | |
42 #include "media/filters/ffmpeg_video_decoder.h" | |
43 #include "media/filters/file_data_source.h" | |
44 | |
45 CAppModule g_module; | |
scherkus (not reviewing)
2009/04/29 05:29:09
given that this is used in other files, it'd be go
| |
46 | |
47 int Run(wchar_t* cmd_line, int cmd_show) { | |
48 CMessageLoop the_loop; | |
scherkus (not reviewing)
2009/04/29 05:29:09
nit: the_loop is a bit of a funny name :)
most of
| |
49 g_module.AddMessageLoop(&the_loop); | |
50 | |
51 CMainFrame wnd_main; | |
52 if (wnd_main.CreateEx() == NULL) { | |
53 DCHECK(false) << "Main window creation failed!"; | |
54 return 0; | |
55 } | |
56 | |
57 wnd_main.ShowWindow(cmd_show); | |
58 | |
59 base::AtExitManager exit_manager; | |
scherkus (not reviewing)
2009/04/29 05:29:09
just realized.. this declaration should actually g
| |
60 | |
61 wchar_t* url = NULL; | |
62 if (cmd_line && *cmd_line) { | |
63 url = cmd_line; | |
64 } | |
65 | |
66 if (url) { | |
67 wnd_main.MovieOpenFile(url); | |
scherkus (not reviewing)
2009/04/29 05:29:09
you never use url again, so you may want to rewrit
| |
68 } | |
69 | |
70 int result = the_loop.Run(); | |
71 | |
72 media::Movie::get()->Close(); | |
73 | |
74 g_module.RemoveMessageLoop(); | |
75 return result; | |
76 } | |
77 | |
78 int WINAPI _tWinMain(HINSTANCE instance, HINSTANCE /*previous_instance*/, | |
79 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...
| |
80 INITCOMMONCONTROLSEX iccx; | |
81 iccx.dwSize = sizeof(iccx); | |
82 iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES; | |
83 if (!::InitCommonControlsEx(&iccx)) { | |
84 DCHECK(false) << "Failed to initialize common controls"; | |
85 return 1; | |
86 } | |
87 if (FAILED(g_module.Init(NULL, instance))) { | |
88 DCHECK(false) << "Failed to initialize application module"; | |
89 return 1; | |
90 } | |
91 int result = Run(cmd_line, cmd_show); | |
92 | |
93 g_module.Term(); | |
94 return result; | |
95 } | |
96 | |
OLD | NEW |