1 /* GStreamer Intel MSDK plugin
2  * Copyright (c) 2016, Oblong Industries, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *    this list of conditions and the following disclaimer in the documentation
13  *    and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifdef HAVE_CONFIG_H
33 #  include <config.h>
34 #endif
35 
36 #include "gstmsdkh264enc.h"
37 
38 #include <gst/base/base.h>
39 #include <gst/pbutils/pbutils.h>
40 
41 GST_DEBUG_CATEGORY_EXTERN (gst_msdkh264enc_debug);
42 #define GST_CAT_DEFAULT gst_msdkh264enc_debug
43 
44 enum
45 {
46   PROP_CABAC = GST_MSDKENC_PROP_MAX,
47   PROP_LOW_POWER,
48   PROP_FRAME_PACKING,
49   PROP_RC_LA_DOWNSAMPLING,
50   PROP_TRELLIS,
51   PROP_MAX_SLICE_SIZE,
52   PROP_B_PYRAMID
53 };
54 
55 #define PROP_CABAC_DEFAULT              TRUE
56 #define PROP_LOWPOWER_DEFAULT           FALSE
57 #define PROP_FRAME_PACKING_DEFAULT      -1
58 #define PROP_RC_LA_DOWNSAMPLING_DEFAULT MFX_LOOKAHEAD_DS_UNKNOWN
59 #define PROP_TRELLIS_DEFAULT            _MFX_TRELLIS_NONE
60 #define PROP_MAX_SLICE_SIZE_DEFAULT     0
61 #define PROP_B_PYRAMID_DEFAULT          FALSE
62 
63 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
64     GST_PAD_SRC,
65     GST_PAD_ALWAYS,
66     GST_STATIC_CAPS ("video/x-h264, "
67         "framerate = (fraction) [0/1, MAX], "
68         "width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
69         "stream-format = (string) byte-stream , alignment = (string) au , "
70         "profile = (string) { high, main, baseline, constrained-baseline }")
71     );
72 
73 static GType
gst_msdkh264enc_frame_packing_get_type(void)74 gst_msdkh264enc_frame_packing_get_type (void)
75 {
76   static GType format_type = 0;
77   static const GEnumValue format_types[] = {
78     {GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE, "None (default)", "none"},
79     {GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE, "Side by Side",
80         "side-by-side"},
81     {GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM, "Top Bottom", "top-bottom"},
82     {0, NULL, NULL}
83   };
84 
85   if (!format_type) {
86     format_type =
87         g_enum_register_static ("GstMsdkH264EncFramePacking", format_types);
88   }
89 
90   return format_type;
91 }
92 
93 #define gst_msdkh264enc_parent_class parent_class
94 G_DEFINE_TYPE (GstMsdkH264Enc, gst_msdkh264enc, GST_TYPE_MSDKENC);
95 
96 static void
insert_frame_packing_sei(GstMsdkH264Enc * thiz,GstVideoCodecFrame * frame,GstVideoMultiviewMode mode)97 insert_frame_packing_sei (GstMsdkH264Enc * thiz, GstVideoCodecFrame * frame,
98     GstVideoMultiviewMode mode)
99 {
100   GstMapInfo map;
101   GstByteReader reader;
102   guint offset;
103 
104   if (mode != GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE
105       && mode != GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM) {
106     GST_ERROR_OBJECT (thiz, "Unsupported multiview mode %d", mode);
107     return;
108   }
109 
110   GST_DEBUG ("Inserting SEI Frame Packing for multiview mode %d", mode);
111 
112   gst_buffer_map (frame->output_buffer, &map, GST_MAP_READ);
113   gst_byte_reader_init (&reader, map.data, map.size);
114 
115   while ((offset =
116           gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100,
117               0, gst_byte_reader_get_remaining (&reader))) != -1) {
118     guint8 type;
119     guint offset2;
120 
121     gst_byte_reader_skip_unchecked (&reader, offset + 3);
122     if (!gst_byte_reader_get_uint8 (&reader, &type))
123       goto done;
124     type = type & 0x1f;
125 
126     offset2 =
127         gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100, 0,
128         gst_byte_reader_get_remaining (&reader));
129     if (offset2 == -1)
130       offset2 = gst_byte_reader_get_remaining (&reader);
131 
132     /* Slice, should really be an IDR slice (5) */
133     if (type >= 1 && type <= 5) {
134       GstBuffer *new_buffer;
135       GstMemory *mem;
136       static const guint8 sei_top_bottom[] =
137           { 0x00, 0x00, 0x01, 0x06, 0x2d, 0x07, 0x82, 0x01,
138         0x00, 0x00, 0x03, 0x00, 0x01, 0x20, 0x80
139       };
140       static const guint8 sei_side_by_side[] =
141           { 0x00, 0x00, 0x01, 0x06, 0x2d, 0x07, 0x81, 0x81,
142         0x00, 0x00, 0x03, 0x00, 0x01, 0x20, 0x80
143       };
144       const guint8 *sei;
145       guint sei_size;
146 
147       if (mode == GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE) {
148         sei = sei_side_by_side;
149         sei_size = sizeof (sei_side_by_side);
150       } else {
151         sei = sei_top_bottom;
152         sei_size = sizeof (sei_top_bottom);
153       }
154 
155       /* Create frame packing SEI
156        * FIXME: This assumes it does not exist in the stream, which is not
157        * going to be true anymore once this is fixed:
158        * https://github.com/Intel-Media-SDK/MediaSDK/issues/13
159        */
160       new_buffer = gst_buffer_new ();
161 
162       /* Copy all metadata */
163       gst_buffer_copy_into (new_buffer, frame->output_buffer,
164           GST_BUFFER_COPY_METADATA, 0, -1);
165 
166       /* Copy previous NALs */
167       gst_buffer_copy_into (new_buffer, frame->output_buffer,
168           GST_BUFFER_COPY_MEMORY, 0, gst_byte_reader_get_pos (&reader) - 4);
169 
170       mem =
171           gst_memory_new_wrapped (0, g_memdup (sei, sei_size), sei_size, 0,
172           sei_size, NULL, g_free);
173       gst_buffer_append_memory (new_buffer, mem);
174       gst_buffer_copy_into (new_buffer, frame->output_buffer,
175           GST_BUFFER_COPY_MEMORY, gst_byte_reader_get_pos (&reader) - 4, -1);
176 
177       gst_buffer_unmap (frame->output_buffer, &map);
178       gst_buffer_unref (frame->output_buffer);
179       frame->output_buffer = new_buffer;
180       return;
181     }
182   }
183 
184 done:
185   gst_buffer_unmap (frame->output_buffer, &map);
186 }
187 
188 static GstFlowReturn
gst_msdkh264enc_pre_push(GstVideoEncoder * encoder,GstVideoCodecFrame * frame)189 gst_msdkh264enc_pre_push (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
190 {
191   GstMsdkH264Enc *thiz = GST_MSDKH264ENC (encoder);
192 
193   if (GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame) &&
194       (thiz->frame_packing != GST_VIDEO_MULTIVIEW_MODE_NONE ||
195           ((GST_VIDEO_INFO_MULTIVIEW_MODE (&thiz->base.input_state->info) !=
196                   GST_VIDEO_MULTIVIEW_MODE_NONE)
197               && GST_VIDEO_INFO_MULTIVIEW_MODE (&thiz->base.
198                   input_state->info) != GST_VIDEO_MULTIVIEW_MODE_MONO))) {
199     insert_frame_packing_sei (thiz, frame,
200         thiz->frame_packing !=
201         GST_VIDEO_MULTIVIEW_MODE_NONE ? thiz->frame_packing :
202         GST_VIDEO_INFO_MULTIVIEW_MODE (&thiz->base.input_state->info));
203   }
204 
205   return GST_FLOW_OK;
206 }
207 
208 static gboolean
gst_msdkh264enc_set_format(GstMsdkEnc * encoder)209 gst_msdkh264enc_set_format (GstMsdkEnc * encoder)
210 {
211   GstMsdkH264Enc *thiz = GST_MSDKH264ENC (encoder);
212   GstCaps *template_caps;
213   GstCaps *allowed_caps = NULL;
214 
215   thiz->profile = 0;
216   thiz->level = 0;
217 
218   template_caps = gst_static_pad_template_get_caps (&src_factory);
219   allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
220 
221   /* If downstream has ANY caps let encoder decide profile and level */
222   if (allowed_caps == template_caps) {
223     GST_INFO_OBJECT (thiz,
224         "downstream has ANY caps, profile/level set to auto");
225   } else if (allowed_caps) {
226     GstStructure *s;
227     const gchar *profile;
228     const gchar *level;
229 
230     if (gst_caps_is_empty (allowed_caps)) {
231       gst_caps_unref (allowed_caps);
232       gst_caps_unref (template_caps);
233       return FALSE;
234     }
235 
236     allowed_caps = gst_caps_make_writable (allowed_caps);
237     allowed_caps = gst_caps_fixate (allowed_caps);
238     s = gst_caps_get_structure (allowed_caps, 0);
239 
240     profile = gst_structure_get_string (s, "profile");
241     if (profile) {
242       if (!strcmp (profile, "high")) {
243         thiz->profile = MFX_PROFILE_AVC_HIGH;
244       } else if (!strcmp (profile, "main")) {
245         thiz->profile = MFX_PROFILE_AVC_MAIN;
246       } else if (!strcmp (profile, "baseline")) {
247         thiz->profile = MFX_PROFILE_AVC_BASELINE;
248       } else if (!strcmp (profile, "constrained-baseline")) {
249         thiz->profile = MFX_PROFILE_AVC_CONSTRAINED_BASELINE;
250       } else {
251         g_assert_not_reached ();
252       }
253     }
254 
255     level = gst_structure_get_string (s, "level");
256     if (level) {
257       thiz->level = gst_codec_utils_h264_get_level_idc (level);
258     }
259 
260     gst_caps_unref (allowed_caps);
261   }
262 
263   gst_caps_unref (template_caps);
264 
265   return TRUE;
266 }
267 
268 static gboolean
gst_msdkh264enc_configure(GstMsdkEnc * encoder)269 gst_msdkh264enc_configure (GstMsdkEnc * encoder)
270 {
271   GstMsdkH264Enc *thiz = GST_MSDKH264ENC (encoder);
272 
273   encoder->param.mfx.LowPower =
274       (thiz->lowpower ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF);
275   encoder->param.mfx.CodecId = MFX_CODEC_AVC;
276   encoder->param.mfx.CodecProfile = thiz->profile;
277   encoder->param.mfx.CodecLevel = thiz->level;
278 
279   thiz->option.Header.BufferId = MFX_EXTBUFF_CODING_OPTION;
280   thiz->option.Header.BufferSz = sizeof (thiz->option);
281   if (thiz->profile == MFX_PROFILE_AVC_CONSTRAINED_BASELINE ||
282       thiz->profile == MFX_PROFILE_AVC_BASELINE ||
283       thiz->profile == MFX_PROFILE_AVC_EXTENDED) {
284     thiz->option.CAVLC = MFX_CODINGOPTION_ON;
285   } else {
286     thiz->option.CAVLC =
287         (thiz->cabac ? MFX_CODINGOPTION_OFF : MFX_CODINGOPTION_ON);
288   }
289 
290   gst_msdkenc_add_extra_param (encoder, (mfxExtBuffer *) & thiz->option);
291 
292   encoder->option2.Trellis = thiz->trellis ? thiz->trellis : MFX_TRELLIS_OFF;
293   encoder->option2.MaxSliceSize = thiz->max_slice_size;
294   if (encoder->rate_control == MFX_RATECONTROL_LA ||
295       encoder->rate_control == MFX_RATECONTROL_LA_HRD ||
296       encoder->rate_control == MFX_RATECONTROL_LA_ICQ)
297     encoder->option2.LookAheadDS = thiz->lookahead_ds;
298 
299   if (thiz->b_pyramid) {
300     encoder->option2.BRefType = MFX_B_REF_PYRAMID;
301     /* Don't define Gop structure for B-pyramid, otherwise EncodeInit
302      * will throw Invalid param error */
303     encoder->param.mfx.GopRefDist = 0;
304   }
305 
306   /* Enable Extended coding options */
307   gst_msdkenc_ensure_extended_coding_options (encoder);
308 
309   return TRUE;
310 }
311 
312 static inline const gchar *
profile_to_string(gint profile)313 profile_to_string (gint profile)
314 {
315   switch (profile) {
316     case MFX_PROFILE_AVC_HIGH:
317       return "high";
318     case MFX_PROFILE_AVC_MAIN:
319       return "main";
320     case MFX_PROFILE_AVC_BASELINE:
321       return "baseline";
322     case MFX_PROFILE_AVC_CONSTRAINED_BASELINE:
323       return "constrained-baseline";
324     default:
325       break;
326   }
327 
328   return NULL;
329 }
330 
331 static inline const gchar *
level_to_string(gint level)332 level_to_string (gint level)
333 {
334   switch (level) {
335     case MFX_LEVEL_AVC_1:
336       return "1";
337     case MFX_LEVEL_AVC_1b:
338       return "1.1";
339     case MFX_LEVEL_AVC_11:
340       return "1.1";
341     case MFX_LEVEL_AVC_12:
342       return "1.2";
343     case MFX_LEVEL_AVC_13:
344       return "1.3";
345     case MFX_LEVEL_AVC_2:
346       return "2";
347     case MFX_LEVEL_AVC_21:
348       return "2.1";
349     case MFX_LEVEL_AVC_22:
350       return "2.2";
351     case MFX_LEVEL_AVC_3:
352       return "3";
353     case MFX_LEVEL_AVC_31:
354       return "3.1";
355     case MFX_LEVEL_AVC_32:
356       return "3.2";
357     case MFX_LEVEL_AVC_4:
358       return "4";
359     case MFX_LEVEL_AVC_41:
360       return "4.1";
361     case MFX_LEVEL_AVC_42:
362       return "4.2";
363     case MFX_LEVEL_AVC_5:
364       return "5";
365     case MFX_LEVEL_AVC_51:
366       return "5.1";
367     case MFX_LEVEL_AVC_52:
368       return "5.2";
369     default:
370       break;
371   }
372 
373   return NULL;
374 }
375 
376 static GstCaps *
gst_msdkh264enc_set_src_caps(GstMsdkEnc * encoder)377 gst_msdkh264enc_set_src_caps (GstMsdkEnc * encoder)
378 {
379   GstCaps *caps;
380   GstStructure *structure;
381   const gchar *profile;
382   const gchar *level;
383 
384   caps = gst_caps_new_empty_simple ("video/x-h264");
385   structure = gst_caps_get_structure (caps, 0);
386 
387   gst_structure_set (structure, "stream-format", G_TYPE_STRING, "byte-stream",
388       NULL);
389 
390   gst_structure_set (structure, "alignment", G_TYPE_STRING, "au", NULL);
391 
392   profile = profile_to_string (encoder->param.mfx.CodecProfile);
393   if (profile)
394     gst_structure_set (structure, "profile", G_TYPE_STRING, profile, NULL);
395 
396   level = level_to_string (encoder->param.mfx.CodecLevel);
397   if (level)
398     gst_structure_set (structure, "level", G_TYPE_STRING, level, NULL);
399 
400   return caps;
401 }
402 
403 static void
gst_msdkh264enc_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)404 gst_msdkh264enc_set_property (GObject * object, guint prop_id,
405     const GValue * value, GParamSpec * pspec)
406 {
407   GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
408 
409   if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
410     return;
411 
412   GST_OBJECT_LOCK (thiz);
413 
414   switch (prop_id) {
415     case PROP_CABAC:
416       thiz->cabac = g_value_get_boolean (value);
417       break;
418     case PROP_LOW_POWER:
419       thiz->lowpower = g_value_get_boolean (value);
420       break;
421     case PROP_FRAME_PACKING:
422       thiz->frame_packing = g_value_get_enum (value);
423       break;
424     case PROP_RC_LA_DOWNSAMPLING:
425       thiz->lookahead_ds = g_value_get_enum (value);
426       break;
427     case PROP_TRELLIS:
428       thiz->trellis = g_value_get_flags (value);
429       break;
430     case PROP_MAX_SLICE_SIZE:
431       thiz->max_slice_size = g_value_get_uint (value);
432       break;
433     case PROP_B_PYRAMID:
434       thiz->b_pyramid = g_value_get_boolean (value);
435       break;
436     default:
437       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
438       break;
439   }
440   GST_OBJECT_UNLOCK (thiz);
441   return;
442 }
443 
444 static void
gst_msdkh264enc_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec)445 gst_msdkh264enc_get_property (GObject * object, guint prop_id, GValue * value,
446     GParamSpec * pspec)
447 {
448   GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
449 
450   if (gst_msdkenc_get_common_property (object, prop_id, value, pspec))
451     return;
452 
453   GST_OBJECT_LOCK (thiz);
454   switch (prop_id) {
455     case PROP_CABAC:
456       g_value_set_boolean (value, thiz->cabac);
457       break;
458     case PROP_LOW_POWER:
459       g_value_set_boolean (value, thiz->lowpower);
460       break;
461     case PROP_FRAME_PACKING:
462       g_value_set_enum (value, thiz->frame_packing);
463       break;
464     case PROP_RC_LA_DOWNSAMPLING:
465       g_value_set_enum (value, thiz->lookahead_ds);
466       break;
467     case PROP_TRELLIS:
468       g_value_set_flags (value, thiz->trellis);
469       break;
470     case PROP_MAX_SLICE_SIZE:
471       g_value_set_uint (value, thiz->max_slice_size);
472       break;
473     case PROP_B_PYRAMID:
474       g_value_set_boolean (value, thiz->b_pyramid);
475       break;
476     default:
477       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
478       break;
479   }
480   GST_OBJECT_UNLOCK (thiz);
481 }
482 
483 static void
gst_msdkh264enc_class_init(GstMsdkH264EncClass * klass)484 gst_msdkh264enc_class_init (GstMsdkH264EncClass * klass)
485 {
486   GObjectClass *gobject_class;
487   GstElementClass *element_class;
488   GstVideoEncoderClass *videoencoder_class;
489   GstMsdkEncClass *encoder_class;
490 
491   gobject_class = G_OBJECT_CLASS (klass);
492   element_class = GST_ELEMENT_CLASS (klass);
493   videoencoder_class = GST_VIDEO_ENCODER_CLASS (klass);
494   encoder_class = GST_MSDKENC_CLASS (klass);
495 
496   gobject_class->set_property = gst_msdkh264enc_set_property;
497   gobject_class->get_property = gst_msdkh264enc_get_property;
498 
499   videoencoder_class->pre_push = gst_msdkh264enc_pre_push;
500 
501   encoder_class->set_format = gst_msdkh264enc_set_format;
502   encoder_class->configure = gst_msdkh264enc_configure;
503   encoder_class->set_src_caps = gst_msdkh264enc_set_src_caps;
504 
505   gst_msdkenc_install_common_properties (encoder_class);
506 
507   g_object_class_install_property (gobject_class, PROP_CABAC,
508       g_param_spec_boolean ("cabac", "CABAC", "Enable CABAC entropy coding",
509           PROP_CABAC_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
510 
511   g_object_class_install_property (gobject_class, PROP_LOW_POWER,
512       g_param_spec_boolean ("low-power", "Low power", "Enable low power mode",
513           PROP_LOWPOWER_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
514 
515   g_object_class_install_property (gobject_class, PROP_FRAME_PACKING,
516       g_param_spec_enum ("frame-packing", "Frame Packing",
517           "Set frame packing mode for Stereoscopic content",
518           gst_msdkh264enc_frame_packing_get_type (), PROP_FRAME_PACKING_DEFAULT,
519           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
520 
521   g_object_class_install_property (gobject_class, PROP_RC_LA_DOWNSAMPLING,
522       g_param_spec_enum ("rc-lookahead-ds", "Look-ahead Downsampling",
523           "Down sampling mode in look ahead bitrate control",
524           gst_msdkenc_rc_lookahead_ds_get_type (),
525           PROP_RC_LA_DOWNSAMPLING_DEFAULT,
526           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
527 
528   g_object_class_install_property (gobject_class, PROP_TRELLIS,
529       g_param_spec_flags ("trellis", "Trellis",
530           "Enable Trellis Quantization",
531           gst_msdkenc_trellis_quantization_get_type (), _MFX_TRELLIS_NONE,
532           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
533 
534   g_object_class_install_property (gobject_class, PROP_MAX_SLICE_SIZE,
535       g_param_spec_uint ("max-slice-size", "Max Slice Size",
536           "Maximum slice size in bytes (if enabled MSDK will ignore the control over num-slices)",
537           0, G_MAXUINT32, PROP_MAX_SLICE_SIZE_DEFAULT,
538           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
539 
540   g_object_class_install_property (gobject_class, PROP_B_PYRAMID,
541       g_param_spec_boolean ("b-pyramid", "B-pyramid",
542           "Enable B-Pyramid Referene structure", FALSE,
543           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
544 
545   gst_element_class_set_static_metadata (element_class,
546       "Intel MSDK H264 encoder", "Codec/Encoder/Video/Hardware",
547       "H264 video encoder based on Intel Media SDK",
548       "Josep Torra <jtorra@oblong.com>");
549   gst_element_class_add_static_pad_template (element_class, &src_factory);
550 }
551 
552 static void
gst_msdkh264enc_init(GstMsdkH264Enc * thiz)553 gst_msdkh264enc_init (GstMsdkH264Enc * thiz)
554 {
555   thiz->cabac = PROP_CABAC_DEFAULT;
556   thiz->lowpower = PROP_LOWPOWER_DEFAULT;
557   thiz->frame_packing = PROP_FRAME_PACKING_DEFAULT;
558   thiz->lookahead_ds = PROP_RC_LA_DOWNSAMPLING_DEFAULT;
559   thiz->trellis = PROP_TRELLIS_DEFAULT;
560   thiz->max_slice_size = PROP_MAX_SLICE_SIZE_DEFAULT;
561   thiz->b_pyramid = PROP_B_PYRAMID_DEFAULT;
562 }
563