Skip to content

Commit

Permalink
URL source playback
Browse files Browse the repository at this point in the history
  • Loading branch information
aliakseis committed Apr 9, 2017
1 parent 2ed1a31 commit 442a894
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 103 deletions.
3 changes: 0 additions & 3 deletions Player.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
MinSizeRel|Win32 = MinSizeRel|Win32
Expand Down
36 changes: 36 additions & 0 deletions Player/DialogOpenURL.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// DialogOpenURL.cpp : implementation file
//

#include "stdafx.h"
#include "Player.h"
#include "DialogOpenURL.h"
#include "afxdialogex.h"


// CDialogOpenURL dialog

IMPLEMENT_DYNAMIC(CDialogOpenURL, CDialog)

CDialogOpenURL::CDialogOpenURL(CWnd* pParent /*=NULL*/)
: CDialog(IDD_DIALOG_OPEN_URL, pParent)
, m_URL(_T(""))
{

}

CDialogOpenURL::~CDialogOpenURL()
{
}

void CDialogOpenURL::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_URL, m_URL);
}


BEGIN_MESSAGE_MAP(CDialogOpenURL, CDialog)
END_MESSAGE_MAP()


// CDialogOpenURL message handlers
25 changes: 25 additions & 0 deletions Player/DialogOpenURL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once


// CDialogOpenURL dialog

class CDialogOpenURL : public CDialog
{
DECLARE_DYNAMIC(CDialogOpenURL)

public:
CDialogOpenURL(CWnd* pParent = NULL); // standard constructor
virtual ~CDialogOpenURL();

// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_DIALOG_OPEN_URL };
#endif

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

DECLARE_MESSAGE_MAP()
public:
CString m_URL;
};
24 changes: 24 additions & 0 deletions Player/Player.rc
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ BEGIN
PUSHBUTTON "",IDC_FULL_SCREEN,339,0,26,22,BS_ICON
END

IDD_DIALOG_OPEN_URL DIALOGEX 0, 0, 309, 61
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Open URL"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,198,40,50,14
PUSHBUTTON "Cancel",IDCANCEL,252,40,50,14
LTEXT "Enter a URL to play:",IDC_STATIC,7,7,66,8
EDITTEXT IDC_EDIT_URL,7,20,295,14,ES_AUTOHSCROLL
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -282,6 +293,14 @@ BEGIN
RIGHTMARGIN, 365
TOPMARGIN, 7
END

IDD_DIALOG_OPEN_URL, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 54
END
END
#endif // APSTUDIO_INVOKED

Expand All @@ -303,6 +322,11 @@ BEGIN
100, 50, 0, 0
END

IDD_DIALOG_OPEN_URL AFX_DIALOG_LAYOUT
BEGIN
0
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down
2 changes: 2 additions & 0 deletions Player/Player.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<ClInclude Include="AudioPlayerWasapi.h" />
<ClInclude Include="D3DFONT.H" />
<ClInclude Include="DialogBarPlayerControl.h" />
<ClInclude Include="DialogOpenURL.h" />
<ClInclude Include="I420Effect.h" />
<ClInclude Include="IEraseableArea.h" />
<ClInclude Include="MainFrm.h" />
Expand All @@ -137,6 +138,7 @@
<ClCompile Include="AudioPlayerWasapi.cpp" />
<ClCompile Include="D3DFONT.CPP" />
<ClCompile Include="DialogBarPlayerControl.cpp" />
<ClCompile Include="DialogOpenURL.cpp" />
<ClCompile Include="I420Effect.cpp" />
<ClCompile Include="MainFrm.cpp" />
<ClCompile Include="Player.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Player/Player.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<ClInclude Include="D3DFONT.H">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DialogOpenURL.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
Expand Down Expand Up @@ -98,6 +101,9 @@
<ClCompile Include="D3DFONT.CPP">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DialogOpenURL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Player.rc">
Expand Down
19 changes: 18 additions & 1 deletion Player/PlayerDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "AudioPlayerImpl.h"
#include "AudioPlayerWasapi.h"

#include "DialogOpenURL.h"

#include <propkey.h>
#include <memory>

Expand Down Expand Up @@ -62,9 +64,24 @@ BOOL CPlayerDoc::OnNewDocument()
if (!CDocument::OnNewDocument())
return FALSE;

// TODO: add reinitialization code here
// (SDI documents will reuse this document)

if (AfxGetApp()->m_pMainWnd) // false if the document is being initialized for the first time
{
CDialogOpenURL dlg;
if (dlg.DoModal() == IDOK && !dlg.m_URL.IsEmpty())
{
m_frameDecoder->close();
UpdateAllViews(nullptr, UPDATE_HINT_CLOSING, nullptr);
const std::string url(CT2A(dlg.m_URL, CP_UTF8));
if (m_frameDecoder->openUrl(url))
{
m_frameDecoder->play();
}

}
}

return TRUE;
}

Expand Down
15 changes: 9 additions & 6 deletions Player/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,29 @@
#define IDI_AUDIO 313
#define IDI_AUDIO_OFF 314
#define IDI_FULL_SCREEN 315
#define IDD_DIALOG_OPEN_URL 317
#define IDC_PROGRESS_SLIDER 1000
#define IDC_PLAY_PAUSE 1001
#define IDC_AUDIO_ON_OFF 1002
#define IDC_PROGRESS_SLIDER2 1003
#define IDC_VOLUME_SLIDER 1003
#define IDC_CURRENT_TIME 1004
#define IDC_TOTAL_TIME 1005
#define IDC_EDIT1 1005
#define IDC_EDIT_URL 1005
#define IDC_FULL_SCREEN 1006
#define ID_TRACK1 32771
#define ID_TRACK2 32772
#define ID_TRACK3 32773
#define ID_TRACK4 32774
#define ID_TRACK1 32771
#define ID_TRACK2 32772
#define ID_TRACK3 32773
#define ID_TRACK4 32774

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 316
#define _APS_NEXT_RESOURCE_VALUE 319
#define _APS_NEXT_COMMAND_VALUE 32775
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 310
#endif
#endif
Loading

0 comments on commit 442a894

Please sign in to comment.