Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/winegstreamer/mfplat.c | 64 +++++++++++++++++++++++++++++++++++++ include/codecapi.h | 38 ++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 include/codecapi.h
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 4af50624e0..2ac0f7fd13 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -26,6 +26,7 @@ #include "gst_private.h" #include "mfapi.h" #include "mfidl.h" +#include "codecapi.h"
#include "wine/debug.h" #include "wine/heap.h" @@ -488,6 +489,69 @@ IMFMediaType* media_type_from_caps(GstCaps *caps) else ERR("uncompressed video has no stream-format\n"); } + else if (!(strcmp(mime_type, "video/x-h264"))) + { + const char *profile, *level; + + IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_H264); + IMFMediaType_SetUINT32(media_type, &MF_MT_COMPRESSED, TRUE); + + if ((profile = gst_structure_get_string(info, "profile"))) + { + if (!(strcmp(profile, "main"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_Main); + else if (!(strcmp(profile, "high"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_High); + else if (!(strcmp(profile, "high-4:4:4"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_444); + else + ERR("Unrecognized profile %s\n", profile); + } + if ((level = gst_structure_get_string(info, "level"))) + { + if (!(strcmp(level, "1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel1); + else if (!(strcmp(level, "1.1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel1_1); + else if (!(strcmp(level, "1.2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel1_2); + else if (!(strcmp(level, "1.3"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel1_3); + else if (!(strcmp(level, "2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel2); + else if (!(strcmp(level, "2.1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel2_1); + else if (!(strcmp(level, "2.2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel2_2); + else if (!(strcmp(level, "3"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel3); + else if (!(strcmp(level, "3.1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel3_1); + else if (!(strcmp(level, "3.2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel3_2); + else if (!(strcmp(level, "4"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel4); + else if (!(strcmp(level, "4.1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel4_1); + else if (!(strcmp(level, "4.2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel4_2); + else if (!(strcmp(level, "5"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel5); + else if (!(strcmp(level, "5.1"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel5_1); + else if (!(strcmp(level, "5.2"))) + IMFMediaType_SetUINT32(media_type, &MF_MT_MPEG2_LEVEL, eAVEncH264VLevel5_2); + else + ERR("Unrecognized level %s\n", level); + } + gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "byte-stream", NULL); + gst_caps_set_simple(caps, "alignment", G_TYPE_STRING, "au", NULL); + for (unsigned int i = 0; i < gst_caps_get_size(caps); i++) + { + GstStructure *structure = gst_caps_get_structure (caps, i); + gst_structure_remove_field(structure, "codec_data"); + } + } else ERR("Unrecognized video format %s\n", mime_type); } diff --git a/include/codecapi.h b/include/codecapi.h new file mode 100644 index 0000000000..307f40cb27 --- /dev/null +++ b/include/codecapi.h @@ -0,0 +1,38 @@ +#ifndef __WINE_CODECAPI_H +#define __WINE_CODECAPI_H + +enum eAVEncH264VProfile +{ + eAVEncH264VProfile_unknown = 0, + eAVEncH264VProfile_Simple = 66, + eAVEncH264VProfile_Base = 66, + eAVEncH264VProfile_Main = 77, + eAVEncH264VProfile_High = 100, + eAVEncH264VProfile_422 = 122, + eAVEncH264VProfile_High10 = 110, + eAVEncH264VProfile_444 = 244, + eAVEncH264VProfile_Extended = 88, +}; + +enum eAVEncH264VLevel +{ + eAVEncH264VLevel1 = 10, + eAVEncH264VLevel1_b = 11, + eAVEncH264VLevel1_1 = 11, + eAVEncH264VLevel1_2 = 12, + eAVEncH264VLevel1_3 = 13, + eAVEncH264VLevel2 = 20, + eAVEncH264VLevel2_1 = 21, + eAVEncH264VLevel2_2 = 22, + eAVEncH264VLevel3 = 30, + eAVEncH264VLevel3_1 = 31, + eAVEncH264VLevel3_2 = 32, + eAVEncH264VLevel4 = 40, + eAVEncH264VLevel4_1 = 41, + eAVEncH264VLevel4_2 = 42, + eAVEncH264VLevel5 = 50, + eAVEncH264VLevel5_1 = 51, + eAVEncH264VLevel5_2 = 52 +}; + +#endif \ No newline at end of file