diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 21:26:27 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 21:26:27 +0000 |
commit | 1d0b87b629345a8b14240d863ee0ab840bb4c2b6 (patch) | |
tree | e412f69075932db81f803fa803b481927a02767a /media | |
parent | d37231fa18e0978822c6aa2c9d03e7a56e61810b (diff) | |
download | chromium_src-1d0b87b629345a8b14240d863ee0ab840bb4c2b6.zip chromium_src-1d0b87b629345a8b14240d863ee0ab840bb4c2b6.tar.gz chromium_src-1d0b87b629345a8b14240d863ee0ab840bb4c2b6.tar.bz2 |
add filtering to player_wtl
BUG=19113
TEST=none
Review URL: http://codereview.chromium.org/1576030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/tools/player_wtl/mainfrm.h | 16 | ||||
-rw-r--r-- | media/tools/player_wtl/player_wtl.h | 2 | ||||
-rw-r--r-- | media/tools/player_wtl/player_wtl.rc | 48 | ||||
-rw-r--r-- | media/tools/player_wtl/resource.h | 5 | ||||
-rw-r--r-- | media/tools/player_wtl/view.h | 32 |
5 files changed, 76 insertions, 27 deletions
diff --git a/media/tools/player_wtl/mainfrm.h b/media/tools/player_wtl/mainfrm.h index 7379f71..f92a97d 100644 --- a/media/tools/player_wtl/mainfrm.h +++ b/media/tools/player_wtl/mainfrm.h @@ -89,6 +89,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, UIEnable(ID_VIEW_ROTATE90, true); UIEnable(ID_VIEW_ROTATE180, true); UIEnable(ID_VIEW_ROTATE270, true); + UIEnable(ID_VIEW_FILTER, true); UIEnable(ID_VIEW_MIRROR_HORIZONTAL, true); UIEnable(ID_VIEW_MIRROR_VERTICAL, true); UIEnable(ID_PLAY_PLAY_PAUSE, bMovieOpen); // If no movie open. @@ -226,6 +227,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, COMMAND_ID_HANDLER_EX(ID_VIEW_STATUS_BAR, OnViewStatusBar) COMMAND_RANGE_HANDLER_EX(ID_VIEW_ROTATE0, ID_VIEW_MIRROR_VERTICAL, OnViewRotate) + COMMAND_ID_HANDLER_EX(ID_VIEW_FILTER, OnViewFilter) COMMAND_ID_HANDLER_EX(ID_VIEW_PROPERTIES, OnViewProperties) COMMAND_ID_HANDLER_EX(ID_PLAY_PLAY_PAUSE, OnPlayPlayPause) COMMAND_ID_HANDLER_EX(ID_PLAY_STEP_FORWARD, OnPlayStepForward) @@ -265,6 +267,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, UPDATE_ELEMENT(ID_VIEW_ROTATE90, UPDUI_MENUPOPUP) UPDATE_ELEMENT(ID_VIEW_ROTATE180, UPDUI_MENUPOPUP) UPDATE_ELEMENT(ID_VIEW_ROTATE270, UPDUI_MENUPOPUP) + UPDATE_ELEMENT(ID_VIEW_FILTER, UPDUI_MENUPOPUP) UPDATE_ELEMENT(ID_VIEW_MIRROR_HORIZONTAL, UPDUI_MENUPOPUP) UPDATE_ELEMENT(ID_VIEW_MIRROR_VERTICAL, UPDUI_MENUPOPUP) UPDATE_ELEMENT(ID_VIEW_PROPERTIES, UPDUI_MENUPOPUP | UPDUI_TOOLBAR) @@ -323,6 +326,11 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, UISetCheck(ID_VIEW_MIRROR_VERTICAL, (view_rotate == 5)); } + void UpdateFilterUICheck() { + int view_filter = m_view.GetViewFilter(); + UISetCheck(ID_VIEW_FILTER, (view_filter == 1)); + } + int OnCreate(LPCREATESTRUCT /*lpCreateStruct*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, @@ -370,6 +378,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UISetCheck(ID_VIEW_ROTATE0, 1); + UISetCheck(ID_VIEW_FILTER, 0); UISetCheck(ID_OPTIONS_EXIT, 0); UISetCheck(ID_OPTIONS_DRAW, 1); UISetCheck(ID_OPTIONS_AUDIO, 1); @@ -599,6 +608,13 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, UpdateLayout(); } + void OnViewFilter(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) { + int view_filter = (m_view.GetViewFilter() == 1) ? 0 : 1; + m_view.SetViewFilter(view_filter); + UpdateFilterUICheck(); + UpdateLayout(); + } + void OnViewToolBar(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { static BOOL bNew = TRUE; // initially visible bNew = !bNew; diff --git a/media/tools/player_wtl/player_wtl.h b/media/tools/player_wtl/player_wtl.h index 96a866c..6c0747a 100644 --- a/media/tools/player_wtl/player_wtl.h +++ b/media/tools/player_wtl/player_wtl.h @@ -8,7 +8,7 @@ #define MEDIA_TOOLS_PLAYER_WTL_PLAYER_WTL_H_ // Enable timing code by turning on TESTING macro. -//#define TESTING 1 +#define TESTING 1 // ATL and WTL require order dependent includes. #include <atlbase.h> // NOLINT diff --git a/media/tools/player_wtl/player_wtl.rc b/media/tools/player_wtl/player_wtl.rc index d3b0f2f..389ff8d 100644 --- a/media/tools/player_wtl/player_wtl.rc +++ b/media/tools/player_wtl/player_wtl.rc @@ -26,17 +26,17 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""../third_party/wtl/include/atlres.h\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\0" END @@ -81,7 +81,7 @@ IDR_MAINFRAME4 BITMAP "Toolbar.bmp" // Menu // -IDR_MAINFRAME MENU +IDR_MAINFRAME MENU BEGIN POPUP "&File" BEGIN @@ -123,6 +123,7 @@ BEGIN MENUITEM "Rotate &90", ID_VIEW_ROTATE90 MENUITEM "Rotate &180", ID_VIEW_ROTATE180 MENUITEM "Rotate &270", ID_VIEW_ROTATE270 + MENUITEM "Filter", ID_VIEW_FILTER MENUITEM "&Mirror Horizontally", ID_VIEW_MIRROR_HORIZONTAL MENUITEM "Mirror &Vertically", ID_VIEW_MIRROR_VERTICAL MENUITEM SEPARATOR @@ -158,7 +159,7 @@ BEGIN END END -IDR_CONTEXTMENU MENU +IDR_CONTEXTMENU MENU BEGIN POPUP "" BEGIN @@ -268,7 +269,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_ABOUTBOX, DIALOG BEGIN @@ -318,7 +319,7 @@ END // Accelerator // -IDR_MAINFRAME2 ACCELERATORS +IDR_MAINFRAME2 ACCELERATORS BEGIN VK_F4, ID_EDIT_CLEAR, VIRTKEY, CONTROL, NOINVERT "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT @@ -395,12 +396,12 @@ END // String Table // -STRINGTABLE +STRINGTABLE BEGIN IDR_MAINFRAME "Media Player" END -STRINGTABLE +STRINGTABLE BEGIN ID_FILE_NEW "Create a new document\nNew" ID_FILE_OPEN "Open a movie\nOpen" @@ -413,7 +414,7 @@ BEGIN ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" END -STRINGTABLE +STRINGTABLE BEGIN ID_VIEW_HALFSIZE "View movie at half normal size." ID_VIEW_NORMALSIZE "View movie at normal size." @@ -433,44 +434,45 @@ BEGIN ID_PLAY_STEP_BACKWARD "Step backward one frame." END -STRINGTABLE +STRINGTABLE BEGIN ID_FILE_LAST "Replay last movie\nOpen" ID_VIEW_ROTATE0 "Turn off rotation." ID_VIEW_ROTATE90 "Rotate movie by 90 degrees clockwise." ID_VIEW_ROTATE180 "Rotate movie by 180 degrees." ID_VIEW_ROTATE270 "Rotate movie by 270 degrees clockwise." + ID_VIEW_FILTER "Turn on bilinear filtering." ID_VIEW_MIRROR_HORIZONTAL "Mirror movie horizontally." ID_VIEW_MIRROR_VERTICAL "Mirror movie vertically." ID_VIEW_QUARTERSIZE "View movie at quarter normal size." END -STRINGTABLE +STRINGTABLE BEGIN ID_RECENT_BTN "\nRecent Files" ID_VIEW_PROPERTIES "Displays movie properties\nProperties" ID_PLAY_PLAY_PAUSE "Start or pause movie playback" END -STRINGTABLE +STRINGTABLE BEGIN ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" END -STRINGTABLE +STRINGTABLE BEGIN ID_APP_ABOUT "Display program information, version number and copyright\nAbout" ID_APP_EXIT "Quit the application; prompts to save documents\nExit" END -STRINGTABLE +STRINGTABLE BEGIN ID_NEXT_PANE "Switch to the next window pane\nNext Pane" ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" END -STRINGTABLE +STRINGTABLE BEGIN ID_WINDOW_NEW "Open another window for the movie\nNew Window" ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" @@ -480,7 +482,7 @@ BEGIN ID_WINDOW_SPLIT "Split the active window into panes\nSplit" END -STRINGTABLE +STRINGTABLE BEGIN ID_EDIT_CLEAR "Removes the movie\nClear" ID_EDIT_CLEAR_ALL "Erase everything\nErase All" @@ -495,7 +497,7 @@ BEGIN ID_EDIT_REDO "Redo the previously undone action\nRedo" END -STRINGTABLE +STRINGTABLE BEGIN ATL_IDS_SCSIZE "Change the window size" ATL_IDS_SCMOVE "Change the window position" @@ -506,24 +508,24 @@ BEGIN ATL_IDS_SCCLOSE "Close the active window and prompts to save the documents" END -STRINGTABLE +STRINGTABLE BEGIN ATL_IDS_SCRESTORE "Restore the window to normal size" ATL_IDS_SCTASKLIST "Activate Task List" ATL_IDS_MDICHILD "Activate this window" END -STRINGTABLE +STRINGTABLE BEGIN ATL_IDS_IDLEMESSAGE "Ready" END -STRINGTABLE +STRINGTABLE BEGIN ATL_IDS_MRU_FILE "Open this document" END -STRINGTABLE +STRINGTABLE BEGIN ID_PLAY_GOTO_FRAME "Goto a specified frame in the movie." ID_PLAY_GOTO_START "Goto to start of movie." @@ -531,7 +533,7 @@ BEGIN ID_OPTIONS_EXIT "Exit player at end of movie." END -STRINGTABLE +STRINGTABLE BEGIN ID_OPTIONS_DRAW "Enable/Disable Draws" ID_OPTIONS_AUDIO "Enable/Disable Audio" diff --git a/media/tools/player_wtl/resource.h b/media/tools/player_wtl/resource.h index 1f35447..b3e3d07 100644 --- a/media/tools/player_wtl/resource.h +++ b/media/tools/player_wtl/resource.h @@ -46,6 +46,7 @@ #define ID_VIEW_ROTATE90 32808 #define ID_VIEW_ROTATE180 32809 #define ID_VIEW_ROTATE270 32810 +#define ID_VIEW_FILTER 32842 #define ID_VIEW_MIRROR_HORIZONTAL 32811 #define ID_VIEW_MIRROR_VERTICAL 32812 #define ID_VIEW_QUARTERSIZE 32815 @@ -71,11 +72,11 @@ // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 206 -#define _APS_NEXT_COMMAND_VALUE 32842 +#define _APS_NEXT_COMMAND_VALUE 32843 #define _APS_NEXT_CONTROL_VALUE 1014 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/media/tools/player_wtl/view.h b/media/tools/player_wtl/view.h index 00e7382..4e16837 100644 --- a/media/tools/player_wtl/view.h +++ b/media/tools/player_wtl/view.h @@ -40,6 +40,7 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { size_.cy = 0; view_size_ = 2; // Normal size. view_rotate_ = media::ROTATE_0; + view_filter_ = media::FILTER_NONE; renderer_ = new WtlVideoRenderer(this); last_frame_ = NULL; hbmp_ = NULL; @@ -323,6 +324,32 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { return view_rotate; } + void SetViewFilter(int view_filter) { + switch (view_filter) { + default: + case 0: + view_filter_ = media::FILTER_NONE; + break; + case 1: + view_filter_ = media::FILTER_BILINEAR; + break; + } + } + + int GetViewFilter() { + int view_scalefilter = 0; + switch (view_filter_) { + default: + case media::FILTER_NONE: + view_scalefilter = 0; + break; + case media::FILTER_BILINEAR: + view_scalefilter = 1; + break; + } + return view_scalefilter; + } + void SetBitmap(HBITMAP hbmp) { hbmp_ = hbmp; } @@ -339,6 +366,9 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { // View Rotate 0-5 for ID_VIEW_ROTATE0 to ID_VIEW_MIRROR_VERTICAL media::Rotate view_rotate_; + // View Filter 0=FILTER_NONE, 1=FILTER_BILINEAR + media::ScaleFilter view_filter_; + // Draw a frame of YUV to an RGB buffer with scaling. // Handles different YUV formats. void DrawYUV(const media::VideoFrame* video_frame, @@ -377,7 +407,7 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { dibrowbytes, yuv_type, view_rotate_, - media::FILTER_BILINEAR); + view_filter_); } } |