summaryrefslogtreecommitdiffstats
path: root/media/player/movie.cc
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 18:31:35 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 18:31:35 +0000
commit2f31e009401121b71f03cc233aa2e6b360697fdb (patch)
treece91dedea61036dcbd758089125f69eef95805b1 /media/player/movie.cc
parent28c47ee963812e92e2eb921ed1778f5db74041bc (diff)
downloadchromium_src-2f31e009401121b71f03cc233aa2e6b360697fdb.zip
chromium_src-2f31e009401121b71f03cc233aa2e6b360697fdb.tar.gz
chromium_src-2f31e009401121b71f03cc233aa2e6b360697fdb.tar.bz2
Media Player mainfrm.h
This module contains all event handling for menus in the Media Player. The implementation is WTL (Windows Template Library) based. The main menu is: File Edit View Play Options Help File opens/closes movies and has print features. Edit has copy/paste features. View has spatial controls, such as scaling, and tool and status bars and a properties dialogue box. Play has temporal controls, such as play speed and pause. Options controls details such as Audio and Video on/off. Help is just an about box. Right clicking brings up a context menu with edit and view items. A tool bar exposes the most common menu items as buttons. Hotkeys (accelerators) are mapped to most menu items. A .RC file is used to edit the menus using the resource editor in visual studio. Dialogue boxes are each handled by a different .h. ie props.h for properties. Mainfrm.h does some minor dialogue boxes directly, such as the file selector and alert boxes for errors. Review URL: http://codereview.chromium.org/99087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/player/movie.cc')
-rw-r--r--media/player/movie.cc68
1 files changed, 67 insertions, 1 deletions
diff --git a/media/player/movie.cc b/media/player/movie.cc
index 08651cc..32594eb 100644
--- a/media/player/movie.cc
+++ b/media/player/movie.cc
@@ -2,6 +2,10 @@
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
#include "base/at_exit.h"
#include "base/string_util.h"
#include "media/base/factory.h"
@@ -30,6 +34,12 @@ namespace media {
Movie::Movie()
: enable_audio_(true),
+ enable_swscaler_(false),
+ enable_draw_(true),
+ enable_dump_yuv_file_(false),
+ enable_pause_(false),
+ enable_openmp_(false),
+ max_threads_(0),
play_rate_(1.0f),
movie_dib_(NULL),
movie_hwnd_(0) {
@@ -87,11 +97,27 @@ bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) {
void Movie::Play(float rate) {
// Begin playback.
if (pipeline_.get())
- pipeline_->SetPlaybackRate(rate);
+ pipeline_->SetPlaybackRate(enable_pause_ ? 0.0f : rate);
if (rate > 0.0f)
play_rate_ = rate;
}
+// Get playback rate.
+float Movie::GetPlayRate() {
+ return play_rate_;
+}
+
+// Set playback pause.
+void Movie::SetPause(bool pause) {
+ enable_pause_ = pause;
+ Play(play_rate_);
+}
+
+// Get playback pause state.
+bool Movie::GetPause() {
+ return enable_pause_;
+}
+
void Movie::SetAudioEnable(bool enable_audio) {
enable_audio_ = enable_audio;
}
@@ -100,6 +126,46 @@ bool Movie::GetAudioEnable() {
return enable_audio_;
}
+void Movie::SetDrawEnable(bool enable_draw) {
+ enable_draw_ = enable_draw;
+}
+
+bool Movie::GetDrawEnable() {
+ return enable_draw_;
+}
+
+void Movie::SetSwscalerEnable(bool enable_swscaler) {
+ enable_swscaler_ = enable_swscaler;
+}
+
+bool Movie::GetSwscalerEnable() {
+ return enable_swscaler_;
+}
+
+void Movie::SetDumpYuvFileEnable(bool enable_dump_yuv_file) {
+ enable_dump_yuv_file_ = enable_dump_yuv_file;
+}
+
+bool Movie::GetDumpYuvFileEnable() {
+ return enable_dump_yuv_file_;
+}
+
+// Enable/Disable OpenMP.
+void Movie::SetOpenMpEnable(bool enable_openmp) {
+#ifdef _OPENMP
+ if (!max_threads_)
+ max_threads_ = omp_get_max_threads();
+
+ enable_openmp_ = enable_openmp;
+ omp_set_num_threads(enable_openmp_ ? max_threads_ : 1);
+#endif
+}
+
+// Get Enable/Disable OpenMP state.
+bool Movie::GetOpenMpEnable() {
+ return enable_openmp_;
+}
+
// Teardown.
void Movie::Close() {
if (pipeline_.get()) {