Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
81406047
Commit
81406047
authored
Jun 22, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Implement MFCreateMFVideoFormatFromMFMediaType().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a7d18392
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
1 deletion
+120
-1
mediatype.c
dlls/mfplat/mediatype.c
+98
-0
mfplat.spec
dlls/mfplat/mfplat.spec
+1
-1
mfplat.c
dlls/mfplat/tests/mfplat.c
+20
-0
mfapi.h
include/mfapi.h
+1
-0
No files found.
dlls/mfplat/mediatype.c
View file @
81406047
...
...
@@ -2640,3 +2640,101 @@ HRESULT WINAPI MFCreateVideoMediaTypeFromSubtype(const GUID *subtype, IMFVideoMe
return
S_OK
;
}
static
void
media_type_get_ratio
(
UINT64
value
,
UINT32
*
numerator
,
UINT32
*
denominator
)
{
*
numerator
=
value
>>
32
;
*
denominator
=
value
;
}
/***********************************************************************
* MFCreateMFVideoFormatFromMFMediaType (mfplat.@)
*/
HRESULT
WINAPI
MFCreateMFVideoFormatFromMFMediaType
(
IMFMediaType
*
media_type
,
MFVIDEOFORMAT
**
video_format
,
UINT32
*
size
)
{
UINT32
flags
,
palette_size
=
0
,
avgrate
;
MFVIDEOFORMAT
*
format
;
UINT64
value
;
INT32
stride
;
GUID
guid
;
TRACE
(
"%p, %p, %p.
\n
"
,
media_type
,
video_format
,
size
);
*
size
=
sizeof
(
*
format
);
if
(
SUCCEEDED
(
IMFMediaType_GetBlobSize
(
media_type
,
&
MF_MT_PALETTE
,
&
palette_size
)))
*
size
+=
palette_size
;
if
(
!
(
format
=
CoTaskMemAlloc
(
*
size
)))
return
E_OUTOFMEMORY
;
*
video_format
=
format
;
memset
(
format
,
0
,
sizeof
(
*
format
));
format
->
dwSize
=
*
size
;
if
(
SUCCEEDED
(
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
)))
{
memcpy
(
&
format
->
guidFormat
,
&
guid
,
sizeof
(
guid
));
format
->
surfaceInfo
.
Format
=
guid
.
Data1
;
}
if
(
SUCCEEDED
(
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value
)))
media_type_get_ratio
(
value
,
&
format
->
videoInfo
.
dwWidth
,
&
format
->
videoInfo
.
dwHeight
);
if
(
SUCCEEDED
(
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value
)))
{
media_type_get_ratio
(
value
,
&
format
->
videoInfo
.
PixelAspectRatio
.
Numerator
,
&
format
->
videoInfo
.
PixelAspectRatio
.
Denominator
);
}
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_VIDEO_CHROMA_SITING
,
&
format
->
videoInfo
.
SourceChromaSubsampling
);
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
format
->
videoInfo
.
InterlaceMode
);
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_TRANSFER_FUNCTION
,
&
format
->
videoInfo
.
TransferFunction
);
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_VIDEO_PRIMARIES
,
&
format
->
videoInfo
.
ColorPrimaries
);
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_YUV_MATRIX
,
&
format
->
videoInfo
.
TransferMatrix
);
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_VIDEO_LIGHTING
,
&
format
->
videoInfo
.
SourceLighting
);
if
(
SUCCEEDED
(
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_RATE
,
&
value
)))
{
media_type_get_ratio
(
value
,
&
format
->
videoInfo
.
FramesPerSecond
.
Numerator
,
&
format
->
videoInfo
.
FramesPerSecond
.
Denominator
);
}
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_VIDEO_NOMINAL_RANGE
,
&
format
->
videoInfo
.
NominalRange
);
IMFMediaType_GetBlob
(
media_type
,
&
MF_MT_GEOMETRIC_APERTURE
,
(
UINT8
*
)
&
format
->
videoInfo
.
GeometricAperture
,
sizeof
(
format
->
videoInfo
.
GeometricAperture
),
NULL
);
IMFMediaType_GetBlob
(
media_type
,
&
MF_MT_MINIMUM_DISPLAY_APERTURE
,
(
UINT8
*
)
&
format
->
videoInfo
.
MinimumDisplayAperture
,
sizeof
(
format
->
videoInfo
.
MinimumDisplayAperture
),
NULL
);
/* Video flags. */
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_PAD_CONTROL_FLAGS
,
&
flags
)))
format
->
videoInfo
.
VideoFlags
|=
flags
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SOURCE_CONTENT_HINT
,
&
flags
)))
format
->
videoInfo
.
VideoFlags
|=
flags
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DRM_FLAGS
,
&
flags
)))
format
->
videoInfo
.
VideoFlags
|=
flags
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_PAN_SCAN_ENABLED
,
&
flags
))
&&
!!
flags
)
{
format
->
videoInfo
.
VideoFlags
|=
MFVideoFlag_PanScanEnabled
;
IMFMediaType_GetBlob
(
media_type
,
&
MF_MT_PAN_SCAN_APERTURE
,
(
UINT8
*
)
&
format
->
videoInfo
.
PanScanAperture
,
sizeof
(
format
->
videoInfo
.
PanScanAperture
),
NULL
);
}
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
(
UINT32
*
)
&
stride
))
&&
stride
<
0
)
format
->
videoInfo
.
VideoFlags
|=
MFVideoFlag_BottomUpLinearRep
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_AVG_BITRATE
,
&
avgrate
)))
format
->
compressedInfo
.
AvgBitrate
=
avgrate
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_AVG_BIT_ERROR_RATE
,
&
avgrate
)))
format
->
compressedInfo
.
AvgBitErrorRate
=
avgrate
;
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_MAX_KEYFRAME_SPACING
,
&
format
->
compressedInfo
.
MaxKeyFrameSpacing
);
/* Palette. */
if
(
palette_size
)
{
format
->
surfaceInfo
.
PaletteEntries
=
palette_size
/
sizeof
(
*
format
->
surfaceInfo
.
Palette
);
IMFMediaType_GetBlob
(
media_type
,
&
MF_MT_PALETTE
,
(
UINT8
*
)
format
->
surfaceInfo
.
Palette
,
palette_size
,
NULL
);
}
return
S_OK
;
}
dlls/mfplat/mfplat.spec
View file @
81406047
...
...
@@ -52,7 +52,7 @@
@ stdcall MFCreateMFByteStreamOnStream(ptr ptr)
@ stdcall MFCreateMFByteStreamOnStreamEx(ptr ptr)
@ stdcall MFCreateMFByteStreamWrapper(ptr ptr)
@ st
ub MFCreateMFVideoFormatFromMFMediaType
@ st
dcall MFCreateMFVideoFormatFromMFMediaType(ptr ptr ptr)
@ stdcall MFCreateMediaBufferFromMediaType(ptr int64 long long ptr)
@ stub MFCreateMediaBufferWrapper
@ stdcall MFCreateMediaEvent(long ptr long ptr ptr)
...
...
dlls/mfplat/tests/mfplat.c
View file @
81406047
...
...
@@ -5262,6 +5262,25 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void)
IMFMediaType_Release
(
mediatype
);
}
static
void
test_MFCreateMFVideoFormatFromMFMediaType
(
void
)
{
MFVIDEOFORMAT
*
video_format
;
IMFMediaType
*
media_type
;
UINT32
size
;
HRESULT
hr
;
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"Failed to create media type, hr %#x.
\n
"
,
hr
);
hr
=
MFCreateMFVideoFormatFromMFMediaType
(
media_type
,
&
video_format
,
&
size
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!!
video_format
,
"Unexpected format.
\n
"
);
ok
(
video_format
->
dwSize
==
size
&&
size
==
sizeof
(
*
video_format
),
"Unexpected size %u.
\n
"
,
size
);
CoTaskMemFree
(
video_format
);
IMFMediaType_Release
(
media_type
);
}
START_TEST
(
mfplat
)
{
char
**
argv
;
...
...
@@ -5317,6 +5336,7 @@ START_TEST(mfplat)
test_MFCreate2DMediaBuffer
();
test_MFCreateMediaBufferFromMediaType
();
test_MFInitMediaTypeFromWaveFormatEx
();
test_MFCreateMFVideoFormatFromMFMediaType
();
CoUninitialize
();
}
include/mfapi.h
View file @
81406047
...
...
@@ -509,6 +509,7 @@ HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLO
HRESULT
WINAPI
MFCreateMediaEvent
(
MediaEventType
type
,
REFGUID
extended_type
,
HRESULT
status
,
const
PROPVARIANT
*
value
,
IMFMediaEvent
**
event
);
HRESULT
WINAPI
MFCreateMediaType
(
IMFMediaType
**
type
);
HRESULT
WINAPI
MFCreateMFVideoFormatFromMFMediaType
(
IMFMediaType
*
media_type
,
MFVIDEOFORMAT
**
video_format
,
UINT32
*
size
);
HRESULT
WINAPI
MFCreateSample
(
IMFSample
**
sample
);
HRESULT
WINAPI
MFCreateVideoMediaTypeFromSubtype
(
const
GUID
*
subtype
,
IMFVideoMediaType
**
media_type
);
HRESULT
WINAPI
MFCreateMemoryBuffer
(
DWORD
max_length
,
IMFMediaBuffer
**
buffer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment