changeset 130:b3df8b8185db

video in a widget, with a basic solution (not optimal)
author benoitrigolleau
date Thu, 08 Nov 2007 14:27:36 +0000
parents 587ad94d6ac2
children b5087d5a7814
files data/fileio/VideoFileReader.cpp data/svdata.vcproj sv/filter/FilterStack.cpp sv/main/MainWindow.cpp sv/main/MainWindow.h sv/videoio/SDL_ffmpeg.cpp
diffstat 6 files changed, 77 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/VideoFileReader.cpp	Thu Nov 08 13:29:48 2007 +0000
+++ b/data/fileio/VideoFileReader.cpp	Thu Nov 08 14:27:36 2007 +0000
@@ -190,10 +190,10 @@
     // we get the size from our active video stream, if no active video stream
     // exists, width and height are set to default values (320x240)
     SDL_ffmpegGetVideoSize(file, &w, &h);
-	
+	SDL_Init(SDL_INIT_VIDEO);
     // Open the Video device
     screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE);
-	SDL_WM_SetCaption("EASAIER Video Player", "EASAIER Video Player");
+	//SDL_WM_SetCaption("EASAIER Video Player", "EASAIER Video Player");
     if(!screen) {
         printf("Couldn't open video: %s\n", SDL_GetError());
         return false;
--- a/data/svdata.vcproj	Thu Nov 08 13:29:48 2007 +0000
+++ b/data/svdata.vcproj	Thu Nov 08 14:27:36 2007 +0000
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8.00"
+	Version="8,00"
 	Name="svdata"
 	ProjectGUID="{7FA04762-1A96-4830-8549-A2A5FBCC95E7}"
 	>
@@ -306,6 +306,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\model\SDLWidget.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\fileio\SparqlResultsReader.cpp"
 				>
 			</File>
@@ -918,6 +922,21 @@
 					</FileConfiguration>
 				</File>
 				<File
+					RelativePath=".\model\SDLWidget.h"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+							Description="MOC $(InputFileName)"
+							CommandLine="$(QTDIR)\bin\moc.exe -DBUILD_DEBUG -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB  -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include&quot; -I &quot;.&quot; -I &quot;..&quot; -I &quot;$(QTDIR)\include\ActiveQt&quot; -I &quot;tmp_moc&quot; -I &quot;.&quot; -I&quot;$(QTDIR)\mkspecs\win32-msvc2005&quot; $(InputPath) -o tmp_moc\moc_$(InputName).cpp"
+							AdditionalDependencies="$(QTDIR)\bin\moc.exe"
+							Outputs="tmp_moc\moc_$(InputName).cpp"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath=".\model\WaveFileModel.h"
 					>
 					<FileConfiguration
@@ -1048,6 +1067,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\tmp_moc\moc_SDLWidget.cpp"
+				>
+			</File>
+			<File
 				RelativePath="tmp_moc\moc_WaveFileModel.cpp"
 				>
 			</File>
--- a/sv/filter/FilterStack.cpp	Thu Nov 08 13:29:48 2007 +0000
+++ b/sv/filter/FilterStack.cpp	Thu Nov 08 14:27:36 2007 +0000
@@ -124,7 +124,7 @@
 	{
 		Filter * filter = iter->second;
 		size_t required = filter->getRequiredInputSamples(outputSamplesNeeded);
-		if (required > max)
+		if ( (required > max) && (filter->isFilterEnabled()) )
 		{
 			max = required;
 		}
@@ -145,7 +145,9 @@
 		if (filter->objectName() == "Pitch-Time Stretching")
 		{
 			TimeStretchFilter * timefilter = (TimeStretchFilter *) filter;
-			skip = timefilter->getRequiredSkipSamples();
+			if (filter->isFilterEnabled()) {
+				skip = timefilter->getRequiredSkipSamples();
+			}
 		}
 	}
 	return skip;
--- a/sv/main/MainWindow.cpp	Thu Nov 08 13:29:48 2007 +0000
+++ b/sv/main/MainWindow.cpp	Thu Nov 08 14:27:36 2007 +0000
@@ -108,6 +108,8 @@
 #include <cstdio>
 #include <errno.h>
 
+#include "data/model/SDLWidget.h"
+
 using std::cerr;
 using std::endl;
 
@@ -153,6 +155,8 @@
     m_abandoning(false),
     m_preferencesDialog(0)
 {
+
+	m_videoWidget = 0;
 	m_instance = this;
 
     setWindowTitle(tr("Sound Access"));
@@ -275,7 +279,7 @@
 	m_qtabwidget->addTab(new QWidget, tr("Related media"));
 
 	QGridLayout *auxlayout = new QGridLayout;
-	auxlayout->addWidget(m_paneStack, 0, 0, 1, 5);
+	auxlayout->addWidget(m_paneStack, 0, 0, 1, 2);
     auxlayout->addWidget(m_overview, 1, 0);
     auxlayout->addWidget(m_fader, 1, 1);
     //auxlayout->addWidget(m_playSpeed, 1, 2);
@@ -312,6 +316,27 @@
 	widgetAuxForLogo->setLayout(logoLayout);
 	/****************************/
 
+	/************video***********/
+	SDLWidget* tt = new SDLWidget();
+	QHBoxLayout *videoHLayout= new QHBoxLayout;
+	videoHLayout->addStretch();
+	videoHLayout->addWidget(tt);
+	videoHLayout->addStretch();
+	QVBoxLayout *videoVLayout= new QVBoxLayout;
+	videoVLayout->addStretch();
+	videoVLayout->addLayout(videoHLayout);
+	videoVLayout->addStretch();
+
+	QWidget *ttaux = new QWidget;
+	ttaux->setLayout(videoVLayout);
+	QPalette palette;
+	palette.setColor(QPalette::Background,palette.color(QPalette::Dark));
+	ttaux->setPalette(palette);
+
+	m_qtabwidget->addTab(ttaux, tr("Video"));
+
+	/****************************/
+
 	m_rightExpandWidget = new ExpandWidget();
 	m_rightExpandWidget->setWidgetLocation(ExpandWidget::Location_Right);
 	m_rightExpandWidget->setPanes(m_leftExpandWidget, widgetAuxForLogo);
@@ -389,6 +414,10 @@
 	m_instance = 0;
 }
 
+QWidget* MainWindow::getVideoWidget(){
+	return m_videoWidget;
+}
+
 QString
 MainWindow::getOpenFileName(FileFinder::FileType type)
 {
@@ -2307,11 +2336,14 @@
 {
     QString path = getOpenFileName(FileFinder::VideoFile);
 
+	m_qtabwidget->setCurrentIndex(Video);
+
     if (path != "") {
-	if (openVideoFile(path, ReplaceMainModel) == FileOpenFailed) {
-	    QMessageBox::critical(this, tr("Failed to open file"),
-				  tr("Video file \"%1\" could not be opened").arg(path));
-	 }
+		if (openVideoFile(path, ReplaceMainModel) == FileOpenFailed) {
+			QMessageBox::critical(this, tr("Failed to open file"),
+					  tr("Video file \"%1\" could not be opened").arg(path));
+		}
+
     }
 }
 //
--- a/sv/main/MainWindow.h	Thu Nov 08 13:29:48 2007 +0000
+++ b/sv/main/MainWindow.h	Thu Nov 08 14:27:36 2007 +0000
@@ -96,7 +96,8 @@
 		Search, 
 		Result, 
 		Info, 
-		RelatedMedia, 
+		RelatedMedia,
+		Video
     };
 
     FileOpenStatus openSomeFile(QString path, AudioFileOpenMode = AskUser);
@@ -121,6 +122,10 @@
 	bool openEasaierSessionFile(QString path);
 	bool saveEasaierSessionFile(QString path);
 
+
+	QWidget* getVideoWidget();
+
+
 signals:
     // Used to toggle the availability of menu actions
     void canAddPane(bool);
@@ -300,7 +305,10 @@
 
 	void exit();
 
+
+
 protected:
+	QWidget					*m_videoWidget;
     QString                  m_sessionFile;
     QString                  m_audioFile;
 // Ivan Damnjanovic 09-10/2007 added video file import	
--- a/sv/videoio/SDL_ffmpeg.cpp	Thu Nov 08 13:29:48 2007 +0000
+++ b/sv/videoio/SDL_ffmpeg.cpp	Thu Nov 08 14:27:36 2007 +0000
@@ -37,6 +37,7 @@
 #include <SDL/SDL.h>
 #include <SDL/SDL_thread.h>
 #endif
+#undef main
 #ifdef __cplusplus
 }
 #endif