HEVC: gstvaapiprofile: Add profile definitions

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
Sreerenj Balachandran 2015-04-13 14:52:53 +03:00
parent c253c22276
commit 23bf2ff9e5
2 changed files with 47 additions and 0 deletions

View file

@ -66,6 +66,7 @@ static const GstVaapiCodecMap gst_vaapi_codecs[] = {
{ GST_VAAPI_CODEC_VC1, "vc1" }, { GST_VAAPI_CODEC_VC1, "vc1" },
{ GST_VAAPI_CODEC_JPEG, "jpeg" }, { GST_VAAPI_CODEC_JPEG, "jpeg" },
{ GST_VAAPI_CODEC_VP8, "vp8" }, { GST_VAAPI_CODEC_VP8, "vp8" },
{ GST_VAAPI_CODEC_H265, "h265" },
{ 0, } { 0, }
}; };
@ -138,6 +139,14 @@ static const GstVaapiProfileMap gst_vaapi_profiles[] = {
{ GST_VAAPI_PROFILE_VP8, VAProfileVP8Version0_3, { GST_VAAPI_PROFILE_VP8, VAProfileVP8Version0_3,
"video/x-vp8", NULL "video/x-vp8", NULL
}, },
#endif
#if VA_CHECK_VERSION(0,37,0)
{ GST_VAAPI_PROFILE_H265_MAIN, VAProfileHEVCMain,
"video/x-h265", "main"
},
{ GST_VAAPI_PROFILE_H265_MAIN10, VAProfileHEVCMain10,
"video/x-h265", "main10"
},
#endif #endif
{ 0, } { 0, }
}; };
@ -292,6 +301,29 @@ gst_vaapi_profile_from_codec_data_h264(GstBuffer *buffer)
return 0; return 0;
} }
static GstVaapiProfile
gst_vaapi_profile_from_codec_data_h265(GstBuffer *buffer)
{
/* ISO/IEC 14496-15: HEVC file format */
guchar buf[3];
if (gst_buffer_extract(buffer, 0, buf, sizeof(buf)) != sizeof(buf))
return 0;
if (buf[0] != 1) /* configurationVersion = 1 */
return 0;
if (buf[1] & 0xc0) /* general_profile_space = 0 */
return 0;
switch (buf[1] & 0x1f) { /* HEVCProfileIndication */
case 1: return GST_VAAPI_PROFILE_H265_MAIN;
case 2: return GST_VAAPI_PROFILE_H265_MAIN10;
case 3: return GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE;
}
return 0;
}
static GstVaapiProfile static GstVaapiProfile
gst_vaapi_profile_from_codec_data(GstVaapiCodec codec, GstBuffer *buffer) gst_vaapi_profile_from_codec_data(GstVaapiCodec codec, GstBuffer *buffer)
{ {
@ -304,6 +336,9 @@ gst_vaapi_profile_from_codec_data(GstVaapiCodec codec, GstBuffer *buffer)
case GST_VAAPI_CODEC_H264: case GST_VAAPI_CODEC_H264:
profile = gst_vaapi_profile_from_codec_data_h264(buffer); profile = gst_vaapi_profile_from_codec_data_h264(buffer);
break; break;
case GST_VAAPI_CODEC_H265:
profile = gst_vaapi_profile_from_codec_data_h265(buffer);
break;
default: default:
profile = 0; profile = 0;
break; break;

View file

@ -39,6 +39,7 @@ G_BEGIN_DECLS
* @GST_VAAPI_CODEC_WMV3: Windows Media Video 9. VC-1 Simple or Main profile (SMPTE 421M) * @GST_VAAPI_CODEC_WMV3: Windows Media Video 9. VC-1 Simple or Main profile (SMPTE 421M)
* @GST_VAAPI_CODEC_VC1: VC-1 Advanced profile (SMPTE 421M) * @GST_VAAPI_CODEC_VC1: VC-1 Advanced profile (SMPTE 421M)
* @GST_VAAPI_CODEC_JPEG: JPEG (ITU-T 81) * @GST_VAAPI_CODEC_JPEG: JPEG (ITU-T 81)
* @GST_VAAPI_CODEC_H265: H.265 aka MPEG-H Part 2 (ITU-T H.265)
* *
* The set of all codecs for #GstVaapiCodec. * The set of all codecs for #GstVaapiCodec.
*/ */
@ -52,6 +53,7 @@ typedef enum {
GST_VAAPI_CODEC_VC1 = GST_MAKE_FOURCC('V','C','1',0), GST_VAAPI_CODEC_VC1 = GST_MAKE_FOURCC('V','C','1',0),
GST_VAAPI_CODEC_JPEG = GST_MAKE_FOURCC('J','P','G',0), GST_VAAPI_CODEC_JPEG = GST_MAKE_FOURCC('J','P','G',0),
GST_VAAPI_CODEC_VP8 = GST_MAKE_FOURCC('V','P','8',0), GST_VAAPI_CODEC_VP8 = GST_MAKE_FOURCC('V','P','8',0),
GST_VAAPI_CODEC_H265 = GST_MAKE_FOURCC('2','6','5',0),
} GstVaapiCodec; } GstVaapiCodec;
/** /**
@ -121,6 +123,12 @@ typedef enum {
* VC-1 advanced profile * VC-1 advanced profile
* @GST_VAAPI_PROFILE_JPEG_BASELINE: * @GST_VAAPI_PROFILE_JPEG_BASELINE:
* JPEG baseline profile * JPEG baseline profile
* @GST_VAAPI_PROFILE_H265_MAIN:
* H.265 main profile [A.3.2]
* @GST_VAAPI_PROFILE_H265_MAIN10:
* H.265 main 10 profile [A.3.3]
* @GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE:
* H.265 main still picture profile [A.3.4]
* *
* The set of all profiles for #GstVaapiProfile. * The set of all profiles for #GstVaapiProfile.
*/ */
@ -153,6 +161,10 @@ typedef enum {
GST_VAAPI_PROFILE_VC1_ADVANCED = GST_VAAPI_MAKE_PROFILE(VC1,3), GST_VAAPI_PROFILE_VC1_ADVANCED = GST_VAAPI_MAKE_PROFILE(VC1,3),
GST_VAAPI_PROFILE_JPEG_BASELINE = GST_VAAPI_MAKE_PROFILE(JPEG,1), GST_VAAPI_PROFILE_JPEG_BASELINE = GST_VAAPI_MAKE_PROFILE(JPEG,1),
GST_VAAPI_PROFILE_VP8 = GST_VAAPI_MAKE_PROFILE(VP8,1), GST_VAAPI_PROFILE_VP8 = GST_VAAPI_MAKE_PROFILE(VP8,1),
GST_VAAPI_PROFILE_H265_MAIN = GST_VAAPI_MAKE_PROFILE(H265,1),
GST_VAAPI_PROFILE_H265_MAIN10 = GST_VAAPI_MAKE_PROFILE(H265,2),
GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE =
GST_VAAPI_MAKE_PROFILE(H265,3),
} GstVaapiProfile; } GstVaapiProfile;
/** /**