[xiph-commits] r7070 - in trunk/oggdsf/src:
illiminable at dactyl.lonelymoon.com
illiminable
Fri Jul 9 02:15:19 PDT 2004
lib/player/libDSPlayDotNET tools/DNPlay
Message-ID: <20040709091519.A091D9AAAB at dactyl.lonelymoon.com>
Author: illiminable
Date: Fri Jul 9 02:15:19 2004
New Revision: 7070
Modified:
trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h
trunk/oggdsf/src/tools/DNPlay/frmDNPlay.cs
trunk/oggdsf/src/tools/DNPlay/frmDNPlay.resx
Log:
* Added stop and pause and open file dialog to player.
Modified: trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
===================================================================
--- trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp 2004-07-09 08:42:40 UTC (rev 7069)
+++ trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp 2004-07-09 09:15:18 UTC (rev 7070)
@@ -17,6 +17,7 @@
DSPlay::DSPlay(void)
: mGraphBuilder(NULL)
, mMediaControl(NULL)
+ , mMediaSeeking(NULL)
{
CoInitialize(NULL);
}
@@ -76,9 +77,15 @@
return false;
} else {
mIsLoaded = true;
- return true;
}
+ IMediaSeeking* locMediaSeeking = NULL;
+ locHR = mGraphBuilder->QueryInterface(IID_IMediaSeeking, (void**)&locMediaSeeking);
+ mMediaSeeking = locMediaSeeking;
+
+ return true;
+
+
}
bool DSPlay::isLoaded() {
@@ -123,13 +130,34 @@
}
}
-bool DSPlay::seek(Int64 inTime) {
- return true;
+Int64 DSPlay::seek(Int64 inTime) {
+ /*if (mIsLoaded && (mMediaSeeking != NULL) {
+ HRESULT locHR = mMediaSeeking->SetPositions(
+ }*/
+ return 0;
}
Int64 DSPlay::queryPosition() {
return 0;
}
+Int64 DSPlay::fileSize() {
+ return -1;
+}
+Int64 DSPlay::fileDuration() {
+ if (mIsLoaded && (mMediaSeeking != NULL)) {
+ LONGLONG locDuration = 0;
+ HRESULT locHR = mMediaSeeking->GetDuration(&locDuration);
+
+ if (locHR != S_OK) {
+ return -1;
+ } else {
+ return locDuration;
+ }
+ } else {
+ return -1;
+ }
+}
+
} //end namespace libDSPlayDotNET
} //end namespace illiminable
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h
===================================================================
--- trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h 2004-07-09 08:42:40 UTC (rev 7069)
+++ trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h 2004-07-09 09:15:18 UTC (rev 7070)
@@ -22,10 +22,12 @@
bool play();
bool pause();
bool stop();
- bool seek(Int64 inTime);
+ Int64 seek(Int64 inTime);
Int64 queryPosition();
bool isLoaded();
+ Int64 fileSize();
+ Int64 fileDuration();
void releaseInterfaces();
@@ -33,6 +35,7 @@
//static wstring toWStr(std::string inString);
IGraphBuilder* mGraphBuilder;
IMediaControl* mMediaControl;
+ IMediaSeeking* mMediaSeeking;
bool mIsLoaded;
};
}
Modified: trunk/oggdsf/src/tools/DNPlay/frmDNPlay.cs
===================================================================
--- trunk/oggdsf/src/tools/DNPlay/frmDNPlay.cs 2004-07-09 08:42:40 UTC (rev 7069)
+++ trunk/oggdsf/src/tools/DNPlay/frmDNPlay.cs 2004-07-09 09:15:18 UTC (rev 7070)
@@ -22,15 +22,20 @@
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.Button cmdPlay;
- private System.Windows.Forms.TextBox txtFilename;
- private System.Windows.Forms.Button cmdLoad;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
+ private System.Windows.Forms.Label lblFileLocation;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.OpenFileDialog dlgOpenFile;
+ private System.Windows.Forms.Button cmdStop;
+ private System.Windows.Forms.Button cmdPause;
//My Variables...
protected DSPlay mPlayer;
+ private System.Windows.Forms.Label lblDuration;
+ protected Int64 mFileDuration;
//
public frmDNPlay()
@@ -77,8 +82,12 @@
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.cmdPlay = new System.Windows.Forms.Button();
- this.txtFilename = new System.Windows.Forms.TextBox();
- this.cmdLoad = new System.Windows.Forms.Button();
+ this.lblFileLocation = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.dlgOpenFile = new System.Windows.Forms.OpenFileDialog();
+ this.cmdStop = new System.Windows.Forms.Button();
+ this.cmdPause = new System.Windows.Forms.Button();
+ this.lblDuration = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// mainMenu1
@@ -108,6 +117,7 @@
//
this.menuItem3.Index = 0;
this.menuItem3.Text = "&Open...";
+ this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
@@ -138,34 +148,66 @@
this.cmdPlay.Text = "&Play";
this.cmdPlay.Click += new System.EventHandler(this.cmdPlay_Click);
//
- // txtFilename
+ // lblFileLocation
//
- this.txtFilename.Location = new System.Drawing.Point(24, 16);
- this.txtFilename.Name = "txtFilename";
- this.txtFilename.Size = new System.Drawing.Size(288, 20);
- this.txtFilename.TabIndex = 1;
- this.txtFilename.Text = "";
+ this.lblFileLocation.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.lblFileLocation.Location = new System.Drawing.Point(96, 8);
+ this.lblFileLocation.Name = "lblFileLocation";
+ this.lblFileLocation.Size = new System.Drawing.Size(368, 16);
+ this.lblFileLocation.TabIndex = 3;
//
- // cmdLoad
+ // label2
//
- this.cmdLoad.Location = new System.Drawing.Point(128, 72);
- this.cmdLoad.Name = "cmdLoad";
- this.cmdLoad.Size = new System.Drawing.Size(104, 32);
- this.cmdLoad.TabIndex = 2;
- this.cmdLoad.Text = "&Load";
- this.cmdLoad.Click += new System.EventHandler(this.cmdLoad_Click);
+ this.label2.Location = new System.Drawing.Point(8, 8);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(80, 16);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "File Location";
//
+ // dlgOpenFile
+ //
+ this.dlgOpenFile.Title = "Select a file to play...";
+ //
+ // cmdStop
+ //
+ this.cmdStop.Location = new System.Drawing.Point(120, 80);
+ this.cmdStop.Name = "cmdStop";
+ this.cmdStop.Size = new System.Drawing.Size(72, 24);
+ this.cmdStop.TabIndex = 5;
+ this.cmdStop.Text = "&Stop";
+ this.cmdStop.Click += new System.EventHandler(this.cmdStop_Click);
+ //
+ // cmdPause
+ //
+ this.cmdPause.Location = new System.Drawing.Point(208, 80);
+ this.cmdPause.Name = "cmdPause";
+ this.cmdPause.Size = new System.Drawing.Size(72, 24);
+ this.cmdPause.TabIndex = 6;
+ this.cmdPause.Text = "Pa&use";
+ this.cmdPause.Click += new System.EventHandler(this.cmdPause_Click);
+ //
+ // lblDuration
+ //
+ this.lblDuration.Location = new System.Drawing.Point(344, 32);
+ this.lblDuration.Name = "lblDuration";
+ this.lblDuration.Size = new System.Drawing.Size(112, 24);
+ this.lblDuration.TabIndex = 7;
+ //
// frmDNPlay
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(472, 129);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.cmdLoad,
- this.txtFilename,
+ this.lblDuration,
+ this.cmdPause,
+ this.cmdStop,
+ this.label2,
+ this.lblFileLocation,
this.cmdPlay});
this.Menu = this.mainMenu1;
this.Name = "frmDNPlay";
this.Text = "DNPlay";
+ this.Load += new System.EventHandler(this.frmDNPlay_Load);
this.ResumeLayout(false);
}
@@ -185,10 +227,36 @@
mPlayer.play();
}
- private void cmdLoad_Click(object sender, System.EventArgs e)
+
+ private void menuItem3_Click(object sender, System.EventArgs e)
{
- String locFileName = txtFilename.Text;
- mPlayer.loadFile(locFileName);
+ //File->Open
+ dlgOpenFile.CheckFileExists = true;
+ DialogResult locResult = dlgOpenFile.ShowDialog();
+ if (locResult == DialogResult.OK)
+ {
+ lblFileLocation.Text = dlgOpenFile.FileName;
+ bool locRes = mPlayer.loadFile(dlgOpenFile.FileName);
+ //Error check
+ mFileDuration = mPlayer.fileDuration();
+ lblDuration.Text = mFileDuration.ToString();
+ }
+
}
+
+ private void cmdStop_Click(object sender, System.EventArgs e)
+ {
+ mPlayer.stop();
+ }
+
+ private void cmdPause_Click(object sender, System.EventArgs e)
+ {
+ mPlayer.pause();
+ }
+
+ private void frmDNPlay_Load(object sender, System.EventArgs e)
+ {
+
+ }
}
}
Modified: trunk/oggdsf/src/tools/DNPlay/frmDNPlay.resx
===================================================================
--- trunk/oggdsf/src/tools/DNPlay/frmDNPlay.resx 2004-07-09 08:42:40 UTC (rev 7069)
+++ trunk/oggdsf/src/tools/DNPlay/frmDNPlay.resx 2004-07-09 09:15:18 UTC (rev 7070)
@@ -99,6 +99,9 @@
<data name="mainMenu1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
+ <data name="dlgOpenFile.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>126, 17</value>
+ </data>
<data name="$this.Name">
<value>frmDNPlay</value>
</data>
More information about the commits
mailing list