Skip to content

Commit b24f312

Browse files
committed
Merge branch 'pr/n665_mrvux' into master_integration
2 parents 624f343 + f596c65 commit b24f312

File tree

5 files changed

+111
-1
lines changed

5 files changed

+111
-1
lines changed

Source/SharpDX.MediaFoundation/Activate.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1818
// THE SOFTWARE.
1919
using System;
20+
using System.Reflection;
2021

2122
namespace SharpDX.MediaFoundation
2223
{
@@ -61,5 +62,27 @@ public T ActivateObject<T>(System.Guid riid) where T : SharpDX.ComObject
6162
return ComObject.FromPointer<T>(objectRef);
6263
}
6364
}
65+
66+
/// <summary>
67+
/// <p> Creates the object associated with this activation object. Riid is provided via reflection on the COM object type </p>
68+
/// </summary>
69+
/// <returns><dd> <p> A reference to the requested interface. The caller must release the interface. </p> </dd></returns>
70+
/// <remarks>
71+
/// <p>Some Microsoft Media Foundation objects must be shut down before being released. If so, the caller is responsible for shutting down the object that is returned in <em>ppv</em>. To shut down the object, do one of the following:</p><ul> <li>Call <strong><see cref="SharpDX.MediaFoundation.Activate.ShutdownObject"/></strong> on the activation object, or</li> <li>Call the object-specific shutdown method. This method will depend on the type of object. Possibilities include:<ul> <li>Media sources: Call <strong><see cref="SharpDX.MediaFoundation.MediaSource.Shutdown"/></strong>.</li> <li>Media sinks: Call <strong><see cref="SharpDX.MediaFoundation.MediaSink.Shutdown"/></strong>.</li> <li>Any object that supports the <strong><see cref="SharpDX.MediaFoundation.Shutdownable"/></strong> interface: Call <strong><see cref="SharpDX.MediaFoundation.Shutdownable.Shutdown"/></strong>.</li> </ul> </li> </ul><p>The <strong><see cref="SharpDX.MediaFoundation.Activate.ShutdownObject"/></strong> method is generic to all object types. If the object does not require a shutdown method, <strong>ShutdownObject</strong> succeeds and has no effect. If you do not know the specific shutdown method for the object (or do not know the object type), call <strong><see cref="SharpDX.MediaFoundation.Activate.ShutdownObject"/></strong>.</p><p> After the first call to <strong>ActivateObject</strong>, subsequent calls return a reference to the same instance, until the client calls either <strong>ShutdownObject</strong> or <strong><see cref="SharpDX.MediaFoundation.Activate.DetachObject"/></strong>. </p>
72+
/// </remarks>
73+
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFActivate::ActivateObject']/*"/>
74+
/// <msdn-id>ms694292</msdn-id>
75+
/// <unmanaged>HRESULT IMFActivate::ActivateObject([In] const GUID&amp; riid,[Out] void** ppv)</unmanaged>
76+
/// <unmanaged-short>IMFActivate::ActivateObject</unmanaged-short>
77+
public T ActivateObject<T>() where T : SharpDX.ComObject
78+
{
79+
unsafe
80+
{
81+
IntPtr objectRef;
82+
Guid riid = typeof(T).GetTypeInfo().GUID;
83+
ActivateObject(riid, out objectRef);
84+
return ComObject.FromPointer<T>(objectRef);
85+
}
86+
}
6487
}
6588
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SharpDX.MediaFoundation
8+
{
9+
public partial class MediaTypeHandler
10+
{
11+
/// <summary>
12+
/// <p> </p><p>Retrieves a media type from the object's list of supported media types.</p>
13+
/// </summary>
14+
/// <param name="dwIndex"><dd> <p> Zero-based index of the media type to retrieve. To get the number of media types in the list, call <strong><see cref="SharpDX.MediaFoundation.MediaTypeHandler.GetMediaTypeCount"/></strong>. </p> </dd></param>
15+
/// <param name="typeOut"><dd> <p> Receives a reference to the <strong><see cref="SharpDX.MediaFoundation.MediaType"/></strong> interface. The caller must release the interface. </p> </dd></param>
16+
/// <returns><p>The method returns an <strong><see cref="SharpDX.Result"/></strong>. Possible values include, but are not limited to, those in the following table.</p><table> <tr><th>Return code</th><th>Description</th></tr> <tr><td> <dl> <dt><strong><see cref="SharpDX.Result.Ok"/></strong></dt> </dl> </td><td> <p> The method succeeded. </p> </td></tr> <tr><td> <dl> <dt><strong><see cref="SharpDX.MediaFoundation.ResultCode.NoMoreTypes"/></strong></dt> </dl> </td><td> <p> The <em>dwIndex</em> parameter is out of range. </p> </td></tr> </table><p>?</p></returns>
17+
/// <remarks>
18+
/// <p>Media types are returned in the approximate order of preference. The list of supported types is not guaranteed to be complete. To test whether a particular media type is supported, call <strong><see cref="SharpDX.MediaFoundation.MediaTypeHandler.IsMediaTypeSupported"/></strong>.</p><p>This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:</p><ul> <li>Windows?XP with Service Pack?2 (SP2) and later.</li> <li>Windows?XP Media Center Edition?2005 with KB900325 (Windows?XP Media Center Edition?2005) and KB925766 (October 2006 Update Rollup for Windows?XP Media Center Edition) installed.</li> </ul>
19+
/// </remarks>
20+
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFMediaTypeHandler::GetMediaTypeByIndex']/*"/>
21+
/// <msdn-id>bb970473</msdn-id>
22+
/// <unmanaged>HRESULT IMFMediaTypeHandler::GetMediaTypeByIndex([In] unsigned int dwIndex,[Out] IMFMediaType** ppType)</unmanaged>
23+
/// <unmanaged-short>IMFMediaTypeHandler::GetMediaTypeByIndex</unmanaged-short>
24+
public MediaType GetMediaTypeByIndex(int dwIndex)
25+
{
26+
MediaType mediaType;
27+
this.GetMediaTypeByIndex(dwIndex, out mediaType);
28+
return mediaType;
29+
}
30+
}
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SharpDX.MediaFoundation
8+
{
9+
public partial class PresentationDescriptor
10+
{
11+
/// <summary>
12+
/// <p> </p><p>Retrieves a stream descriptor for a stream in the presentation. The stream descriptor contains information about the stream.</p>
13+
/// </summary>
14+
/// <param name="dwIndex"><dd> <p>Zero-based index of the stream. To find the number of streams in the presentation, call the <strong><see cref="SharpDX.MediaFoundation.PresentationDescriptor.GetStreamDescriptorCount"/></strong> method.</p> </dd></param>
15+
/// <param name="fSelectedRef"><dd> <p>Receives a Boolean value. The value is <strong>TRUE</strong> if the stream is currently selected, or <strong><see cref="SharpDX.Result.False"/></strong> if the stream is currently deselected. If a stream is selected, the media source generates data for that stream when <strong><see cref="SharpDX.MediaFoundation.MediaSource.Start"/></strong> is called. The media source will not generated data for deselected streams. To select a stream, call <strong><see cref="SharpDX.MediaFoundation.PresentationDescriptor.SelectStream"/></strong>.To deselect a stream, call <strong><see cref="SharpDX.MediaFoundation.PresentationDescriptor.DeselectStream"/></strong>.</p> </dd></param>
16+
/// <param name="descriptorOut"><dd> <p>Receives a reference to the stream descriptor's <strong><see cref="SharpDX.MediaFoundation.StreamDescriptor"/></strong> interface. The caller must release the interface.</p> </dd></param>
17+
/// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
18+
/// <remarks>
19+
/// <p>This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:</p><ul> <li>Windows?XP with Service Pack?2 (SP2) and later.</li> <li>Windows?XP Media Center Edition?2005 with KB900325 (Windows?XP Media Center Edition?2005) and KB925766 (October 2006 Update Rollup for Windows?XP Media Center Edition) installed.</li> </ul>
20+
/// </remarks>
21+
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFPresentationDescriptor::GetStreamDescriptorByIndex']/*"/>
22+
/// <msdn-id>ms694924</msdn-id>
23+
/// <unmanaged>HRESULT IMFPresentationDescriptor::GetStreamDescriptorByIndex([In] unsigned int dwIndex,[Out] BOOL* pfSelected,[Out] IMFStreamDescriptor** ppDescriptor)</unmanaged>
24+
/// <unmanaged-short>IMFPresentationDescriptor::GetStreamDescriptorByIndex</unmanaged-short>
25+
public StreamDescriptor GetStreamDescriptorByIndex(int dwIndex, out SharpDX.Mathematics.Interop.RawBool fSelectedRef)
26+
{
27+
StreamDescriptor streamDescriptor;
28+
this.GetStreamDescriptorByIndex(dwIndex, out fSelectedRef, out streamDescriptor);
29+
return streamDescriptor;
30+
}
31+
}
32+
}

Source/SharpDX.MediaFoundation/SharpDX.MediaFoundation.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<Compile Include="AsyncCallbackShadow.cs" />
2525
<Compile Include="ClockStateSink.cs" />
2626
<Compile Include="ClockStateSinkShadow.cs" />
27+
<Compile Include="MediaTypeHandler.cs" />
28+
<Compile Include="PresentationDescriptor.cs" />
2729
<Compile Include="SampleGrabberSinkCallbackShadow2.cs" />
2830
<Compile Include="SampleGrabberSinkCallback2.cs" />
2931
<Compile Include="DXGIDeviceManager.cs" />
@@ -57,6 +59,7 @@
5759
<Compile Include="SourceReader.cs" />
5860
<Compile Include="SourceResolver.cs" />
5961
<Compile Include="Transform.cs" />
62+
<Compile Include="VideoFormatGuids.cs" />
6063
<Compile Include="VideoPresenter.cs" />
6164
<Compile Include="VideoPresenterShadow.cs" />
6265
<Compile Include="WorkQueueId.cs" />
@@ -95,4 +98,4 @@
9598
<Target Name="AfterBuild">
9699
</Target>
97100
-->
98-
</Project>
101+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SharpDX.MediaFoundation
8+
{
9+
public static partial class VideoFormatGuids
10+
{
11+
/// <summary>
12+
/// Returns a standard Media foundation GUID format from a FourCC input
13+
/// </summary>
14+
/// <param name="fourCC">FourCC input</param>
15+
/// <returns>Media foundation unique ID</returns>
16+
public static Guid FromFourCC(SharpDX.Multimedia.FourCC fourCC)
17+
{
18+
return new Guid(string.Concat(fourCC.ToString(), "-0000-0010-8000-00aa00389b71"));
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)