Commit 340f5a87 authored by Kellen Sunderland's avatar Kellen Sunderland

Moved some references to be relative. Added Audio devices register

parent 5f9e7e36
......@@ -34,3 +34,5 @@ _ReSharper*/
*.vspx
*.psess
app/packages
app/VLC_WINRT.sln.DotSettings
vlc/plugins/plugins.dat
MainPackage=C:\winrt\app\UI\bin\x86\Debug\VLC_WINRT_0.0.1.3_Bundle\VLC_WINRT_0.0.1.3_x86_Debug.appx
SymbolPackage=C:\winrt\app\UI\AppPackages\VLC_WINRT_0.0.1.3_Debug_Test\VLC_WINRT_0.0.1.3_x86_Debug.appxsym
ResourcePack=C:\winrt\app\UI\bin\x86\Debug\VLC_WINRT_0.0.1.3_Bundle\VLC_WINRT_0.0.1.3_language-de.appx
ResourcePack=C:\winrt\app\UI\bin\x86\Debug\VLC_WINRT_0.0.1.3_Bundle\VLC_WINRT_0.0.1.3_language-fr.appx
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VLC_WINRT.Common">
<!-- Default style for Windows.UI.Xaml.Controls.Slider -->
<Style TargetType="Slider" x:Name="VlcSlider">
<Setter Property="Background" Value="{StaticResource SliderTrackBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource SliderBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource SliderBorderThemeThickness}" />
<Setter Property="Foreground" Value="#F09609" />
<Setter Property="ManipulationMode" Value="None" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Grid Margin="{TemplateBinding Padding}">
<Grid.Resources>
<Style TargetType="Thumb" x:Key="SliderThumbStyle">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{StaticResource SliderThumbBorderThemeBrush}" />
<Setter Property="Background" Value="{StaticResource SliderThumbBackgroundThemeBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalBorder"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalBorder"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDecreaseDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDecreaseDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkOutsideDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalInlineTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkInlineDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkOutsideDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LeftTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkOutsideDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalInlineTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkInlineDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RightTickBar"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTickMarkOutsideDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDecreasePointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackDecreasePointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderTrackPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>-->
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SliderThumbPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhiteHorizontal"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlackHorizontal"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualWhiteVertical"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlackVertical"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="HorizontalTemplate" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="17" />
<RowDefinition Height="Auto" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Rectangle x:Name="HorizontalTrackRect"
Fill="{TemplateBinding Background}"
Grid.Row="1"
Grid.ColumnSpan="3" />
<Rectangle x:Name="HorizontalDecreaseRect"
Fill="{TemplateBinding Foreground}"
Grid.Row="1" />
<TickBar x:Name="TopTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickmarkOutsideBackgroundThemeBrush}"
Height="{StaticResource SliderOutsideTickBarThemeHeight}"
VerticalAlignment="Bottom"
Margin="0,0,0,2"
Grid.ColumnSpan="3" />
<TickBar x:Name="HorizontalInlineTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickMarkInlineBackgroundThemeBrush}"
Height="{StaticResource SliderTrackThemeHeight}"
Grid.Row="1"
Grid.ColumnSpan="3" />
<TickBar x:Name="BottomTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickmarkOutsideBackgroundThemeBrush}"
Height="{StaticResource SliderOutsideTickBarThemeHeight}"
VerticalAlignment="Top"
Margin="0,2,0,0"
Grid.Row="2"
Grid.ColumnSpan="3" />
<Rectangle x:Name="HorizontalBorder"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}"
Grid.Row="1"
Grid.ColumnSpan="3" />
<Thumb x:Name="HorizontalThumb"
Background="{StaticResource SliderThumbBackgroundThemeBrush}"
Style="{StaticResource SliderThumbStyle}"
DataContext="{TemplateBinding Value}"
Height="{StaticResource SliderTrackThemeHeight}"
Width="{StaticResource SliderTrackThemeHeight}"
Grid.Row="1"
Grid.Column="1" />
<Rectangle x:Name="FocusVisualWhiteHorizontal"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Grid.RowSpan="3"
Grid.ColumnSpan="3" />
<Rectangle x:Name="FocusVisualBlackHorizontal"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Grid.RowSpan="3"
Grid.ColumnSpan="3" />
</Grid>
<Grid x:Name="VerticalTemplate" Visibility="Collapsed" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="17" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="17" />
</Grid.ColumnDefinitions>
<Rectangle x:Name="VerticalTrackRect"
Fill="{TemplateBinding Background}"
Grid.Column="1"
Grid.RowSpan="3" />
<Rectangle x:Name="VerticalDecreaseRect"
Fill="{TemplateBinding Foreground}"
Grid.Column="1"
Grid.Row="2" />
<TickBar x:Name="LeftTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickmarkOutsideBackgroundThemeBrush}"
Width="{StaticResource SliderOutsideTickBarThemeHeight}"
HorizontalAlignment="Right"
Margin="0,0,2,0"
Grid.RowSpan="3" />
<TickBar x:Name="VerticalInlineTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickMarkInlineBackgroundThemeBrush}"
Width="{StaticResource SliderTrackThemeHeight}"
Grid.Column="1"
Grid.RowSpan="3" />
<TickBar x:Name="RightTickBar"
Visibility="Collapsed"
Fill="{StaticResource SliderTickmarkOutsideBackgroundThemeBrush}"
Width="{StaticResource SliderOutsideTickBarThemeHeight}"
HorizontalAlignment="Left"
Margin="2,0,0,0"
Grid.Column="2"
Grid.RowSpan="3" />
<Rectangle x:Name="VerticalBorder"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}"
Grid.Column="1"
Grid.RowSpan="3" />
<Thumb x:Name="VerticalThumb"
Background="{StaticResource SliderThumbBackgroundThemeBrush}"
Style="{StaticResource SliderThumbStyle}"
DataContext="{TemplateBinding Value}"
Width="{StaticResource SliderTrackThemeHeight}"
Height="{StaticResource SliderTrackThemeHeight}"
Grid.Row="1"
Grid.Column="1" />
<Rectangle x:Name="FocusVisualWhiteVertical"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Grid.RowSpan="3"
Grid.ColumnSpan="3" />
<Rectangle x:Name="FocusVisualBlackVertical"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Grid.RowSpan="3"
Grid.ColumnSpan="3" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
......@@ -150,7 +150,6 @@
<Compile Include="ViewModels\MainPage\ThumbnailsViewModel.cs" />
<Compile Include="ViewModels\MainPage\ThumbnailViewModel.cs" />
<Compile Include="ViewModels\MainPage\ViewedVideoViewModel.cs" />
<Compile Include="ViewModels\NavSupportingViewModel.cs" />
<Compile Include="ViewModels\PlayVideo\PlayVideoViewModel.cs" />
<Compile Include="ViewModels\ViewModelLocator.cs" />
<Compile Include="Views\Addition.xaml.cs">
......@@ -193,10 +192,6 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\Users\Kellen\Documents\Visual Studio 2013\Projects\libaccess_winrt_plugin\Debug\libaccess_winrt_plugin\libaccess_winrt_plugin.dll">
<Link>plugins\access\libaccess_winrt_plugin.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\vlc\libvlc.dll">
<Link>libvlc.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......@@ -1006,6 +1001,7 @@
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="plugins\access\libaccess_winrt_plugin.dll" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
......
using System;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.AccessCache;
using Windows.Storage.FileProperties;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using VLC_WINRT.Common;
......@@ -47,9 +49,35 @@ namespace VLC_WINRT.ViewModels.PlayVideo
set
{
SetProperty(ref _currentFile, value);
string token = StorageApplicationPermissions.FutureAccessList.Add(value);
string token = StorageApplicationPermissions.FutureAccessList.Add(_currentFile);
// Tell the player to play the video based on its token
_vlcPlayer.Open("winrt://" + token);
int height = (int)Window.Current.Bounds.Height;
int width = (int)Window.Current.Bounds.Width;
VideoProperties props = null;
try
{
var videoTask = _currentFile.Properties.GetVideoPropertiesAsync().AsTask();
videoTask.Wait();
if (videoTask.Status == TaskStatus.RanToCompletion)
{
props = videoTask.Result;
}
}
catch (Exception ex)
{
}
if (props != null && props.Height > 0 && props.Width > 0)
{
height = (int)props.Height;
width = (int)props.Width;
}
_vlcPlayer.Open("winrt://" + token, height, width);
Title = _currentFile.Name;
}
}
......
#include "pch.h"
#include "MMDeviceLocator.h"
HRESULT MMDeviceLocator::RegisterForWASAPI(){
HRESULT hr = S_OK;
IActivateAudioInterfaceAsyncOperation *asyncOp;
Platform::String^ id = MediaDevice::GetDefaultAudioRenderId(Windows::Media::Devices::AudioDeviceRole::Default);
hr = ActivateAudioInterfaceAsync(id->Data(), __uuidof(IAudioClient), nullptr, this, &asyncOp);
SafeRelease(&asyncOp);
return hr;
}
HRESULT MMDeviceLocator::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *operation)
{
HRESULT hr = S_OK;
HRESULT hrActivateResult = S_OK;
IUnknown *audioInterface = nullptr;
hr = operation->GetActivateResult(&hrActivateResult, &audioInterface);
if (SUCCEEDED(hr) && SUCCEEDED(hrActivateResult))
{
audioInterface->QueryInterface(IID_PPV_ARGS(&m_AudioClient));
if (nullptr == m_AudioClient)
{
hr = E_FAIL;
}
}
return hr;
}
#pragma once
#include <Windows.h>
#include <mfapi.h>
#include <AudioClient.h>
#include <mmdeviceapi.h>
#include <wrl\implements.h>
using namespace Microsoft::WRL;
using namespace Windows::Media::Devices;
using namespace Windows::Storage::Streams;
template <class T> void SafeRelease(T **ppT)
{
if (*ppT)
{
(*ppT)->Release();
*ppT = NULL;
}
}
class MMDeviceLocator :
public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler >
{
public:
HRESULT RegisterForWASAPI();
STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
private:
IAudioClient *m_AudioClient;
};
......@@ -43,10 +43,11 @@ static HANDLE xamlLock = CreateSemaphoreExW( NULL, // default security
L"xamlsem",0,SYNCHRONIZE|SEMAPHORE_MODIFY_STATE);
static byte* pixelData;
static VLCD2dImageSource^ vlcImageSource;
static const UINT frameWidth = 1280;
static const UINT frameHeight = 534;
static UINT frameWidth = 1024;
static UINT frameHeight = 768;
static UINT pitch;
static int pixelBufferSize;
Windows::UI::Xaml::Media::ImageBrush^ target;
void *Player::Lock(void* opqaue, void** planes){
......@@ -80,6 +81,12 @@ void Player::Display(void* opaque, void* picture){
Player::Player(Windows::UI::Xaml::Media::ImageBrush^ brush)
{
OutputDebugStringW(L"Hello, Player!");
ComPtr<MMDeviceLocator> audioReg = Make<MMDeviceLocator>();
audioReg->RegisterForWASAPI();
//do some stuff
audioReg = nullptr;
/* Don't add any invalid options, otherwise it causes LibVLC to fail */
static const char *argv[] = {
"-I", "dummy",
......@@ -98,20 +105,25 @@ Player::Player(Windows::UI::Xaml::Media::ImageBrush^ brush)
return;
}
vlcImageSource = ref new VLCD2dImageSource(frameWidth, frameHeight, true);
brush->ImageSource = vlcImageSource;
target = brush;
}
void Player::Open(Platform::String^ mrl) {
void Player::Open(Platform::String^ mrl, int width, int height) {
frameHeight = height;
frameWidth = width;
size_t len = WideCharToMultiByte (CP_UTF8, 0, mrl->Data(), -1, NULL, 0, NULL, NULL);
char* p_mrl = new char[len];
WideCharToMultiByte (CP_UTF8, 0, mrl->Data(), -1, p_mrl, len, NULL, NULL);
// add a hard-coded http source for videos to play
libvlc_media_t* m = libvlc_media_new_location(this->p_instance, p_mrl);
p_mp = libvlc_media_player_new_from_media(m);
vlcImageSource = ref new VLCD2dImageSource(frameWidth, frameHeight, true);
target->ImageSource = vlcImageSource;
//we're using vmem so format is always RGB
unsigned int bitsPerPixel = 32; // hard coded for RV32 videos
pitch = (frameWidth*bitsPerPixel)/8;
......
......@@ -19,29 +19,40 @@
*****************************************************************************/
#pragma once
#include <vlc/vlc.h>
#include "VLCD2dImageSource.h"
#include "MMDeviceLocator.h"
#include <Windows.h>
#include <mfapi.h>
#include <AudioClient.h>
#include <mmdeviceapi.h>
#include <wrl\implements.h>
using namespace Microsoft::WRL;
using namespace Windows::Media::Devices;
namespace VLC_Wrapper {
public ref class Player sealed
{
public:
Player::Player(Windows::UI::Xaml::Media::ImageBrush^ brush);
void Open(Platform::String^ mrl);
void Stop();
void Pause();
void Play();
void Seek(float position);
float GetPosition();
int64 GetLength();
virtual ~Player();
Player(Windows::UI::Xaml::Media::ImageBrush^ brush);
void Open(Platform::String^ mrl, int width, int height);
void Stop();
void Pause();
void Play();
void Seek(float position);
float GetPosition();
int64 GetLength();
virtual ~Player();
private:
libvlc_instance_t *p_instance;
libvlc_media_player_t *p_mp;
static void *Lock(void* opaque, void** planes);
static void Unlock(void* opaque, void* picture, void** planes);
static void Display(void* opaque, void* picture);
libvlc_instance_t *p_instance;
libvlc_media_player_t *p_mp;
static void *Lock(void* opaque, void** planes);
static void Unlock(void* opaque, void* picture, void** planes);
static void Display(void* opaque, void* picture);
};
}
......@@ -118,11 +118,11 @@
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>C:\vlc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\vlc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>runtimeobject.lib;libvlc.lib;d3d11.lib;d2d1.lib;dxgi.lib;WindowsCodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>runtimeobject.lib;libvlc.lib;d3d11.lib;d2d1.lib;dxgi.lib;MMDevAPI.lib;MFuuid.lib;MFReadWrite.lib;MFplat.lib;uuid.lib;WindowsCodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalLibraryDirectories>$(ProjectDir)\..\..\vlc;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
......@@ -210,6 +210,7 @@
<ClInclude Include="pch.h" />
<ClInclude Include="Math.h" />
<ClInclude Include="VLCD2dImageSource.h" />
<ClInclude Include="MMDeviceLocator.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp" />
......@@ -223,6 +224,7 @@
</ClCompile>
<ClCompile Include="Math.cpp" />
<ClCompile Include="VLCD2dImageSource.cpp" />
<ClCompile Include="MMDeviceLocator.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\vlc\libvlc.dll" />
......
......@@ -11,6 +11,7 @@
<ClCompile Include="Math.cpp" />
<ClCompile Include="Player.cpp" />
<ClCompile Include="VLCD2dImageSource.cpp" />
<ClCompile Include="MMDeviceLocator.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
......@@ -18,6 +19,7 @@
<ClInclude Include="Player.h" />
<ClInclude Include="VLCD2dImageSource.h" />
<ClInclude Include="DirectXHelper.h" />
<ClInclude Include="MMDeviceLocator.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\vlc\libvlc.dll">
......
......@@ -27,6 +27,8 @@
#include <wrl.h>
#include <wrl/client.h>
//#include <collection.h>
//#include <ppltasks.h>
#include <dxgi.h>
#include <dxgi1_2.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment