#endif
#define GST_OMX_H264_VIDEO_ENC_PERIODICITY_OF_IDR_FRAMES_DEFAULT (0xffffffff)
#define GST_OMX_H264_VIDEO_ENC_INTERVAL_OF_CODING_INTRA_FRAMES_DEFAULT (0xffffffff)
+#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
+#define GST_OMX_H264_VIDEO_ENC_B_FRAMES_DEFAULT (0)
+#define ALIGNMENT "{ au, nal }"
+#else
#define GST_OMX_H264_VIDEO_ENC_B_FRAMES_DEFAULT (0xffffffff)
+#define ALIGNMENT "au"
+#endif
#define GST_OMX_H264_VIDEO_ENC_ENTROPY_MODE_DEFAULT (0xffffffff)
#define GST_OMX_H264_VIDEO_ENC_CONSTRAINED_INTRA_PREDICTION_DEFAULT (FALSE)
#define GST_OMX_H264_VIDEO_ENC_LOOP_FILTER_MODE_DEFAULT (0xffffffff)
basevideoenc_class->stop = gst_omx_h264_enc_stop;
videoenc_class->cdata.default_src_template_caps = "video/x-h264, "
- "width=(int) [ 16, 4096 ], " "height=(int) [ 16, 4096 ]";
+ "width = (int) [ 16, 4096 ], height = (int) [ 16, 4096 ], "
+ "framerate = (fraction) [0, MAX], stream-format=(string) byte-stream, "
+ "alignment = (string) " ALIGNMENT;
videoenc_class->handle_output_frame =
GST_DEBUG_FUNCPTR (gst_omx_h264_enc_handle_output_frame);
const gchar *profile_string, *level_string;
OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileMax;
OMX_VIDEO_AVCLEVELTYPE level = OMX_VIDEO_AVCLevelMax;
+ gboolean enable_subframe = FALSE;
#ifdef USE_OMX_TARGET_RPI
GST_OMX_INIT_STRUCT (&config_inline_header);
gst_pad_get_pad_template_caps (GST_VIDEO_ENCODER_SRC_PAD (enc)));
if (peercaps) {
GstStructure *s;
+ const gchar *alignment_string;
if (gst_caps_is_empty (peercaps)) {
gst_caps_unref (peercaps);
goto unsupported_level;
}
+ alignment_string = gst_structure_get_string (s, "alignment");
+ if (alignment_string && g_str_equal (alignment_string, "nal"))
+ enable_subframe = TRUE;
+
gst_caps_unref (peercaps);
}
return FALSE;
}
+ gst_omx_port_set_subframe (GST_OMX_VIDEO_ENC (self)->enc_out_port,
+ enable_subframe);
+
if (!update_param_avc (self, profile, level))
return FALSE;
GstCaps *caps;
OMX_ERRORTYPE err;
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
- const gchar *profile, *level;
+ const gchar *profile, *level, *alignment;
GST_OMX_INIT_STRUCT (¶m);
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index;
if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex)
return NULL;
+ if (gst_omx_port_get_subframe (GST_OMX_VIDEO_ENC (self)->enc_out_port))
+ alignment = "nal";
+ else
+ alignment = "au";
+
caps = gst_caps_new_simple ("video/x-h264",
"stream-format", G_TYPE_STRING, "byte-stream",
- "alignment", G_TYPE_STRING, "au", NULL);
+ "alignment", G_TYPE_STRING, alignment, NULL);
if (err == OMX_ErrorNone) {
profile = gst_omx_h264_utils_get_profile_from_enum (param.eProfile);
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
/* zynqultrascaleplus's OMX uses a param struct different of Android's one */
#define INDEX_PARAM_VIDEO_HEVC OMX_ALG_IndexParamVideoHevc
+#define ALIGNMENT "{ au, nal }"
#else
#define INDEX_PARAM_VIDEO_HEVC OMX_IndexParamVideoHevc
+#define ALIGNMENT "au"
#endif
/* class initialization */
videoenc_class->cdata.default_src_template_caps = "video/x-h265, "
"width=(int) [ 1, MAX ], " "height=(int) [ 1, MAX ], "
- "framerate = (fraction) [0, MAX], "
- "stream-format=(string) byte-stream, alignment=(string) au ";
+ "framerate = (fraction) [0, MAX], stream-format=(string) byte-stream, "
+ "aligmment = (string) " ALIGNMENT;
gst_element_class_set_static_metadata (element_class,
"OpenMAX H.265 Video Encoder",
const gchar *profile_string, *level_string, *tier_string;
OMX_VIDEO_HEVCPROFILETYPE profile = OMX_VIDEO_HEVCProfileUnknown;
OMX_VIDEO_HEVCLEVELTYPE level = OMX_VIDEO_HEVCLevelUnknown;
+ gboolean enable_subframe = FALSE;
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
if (self->periodicity_idr !=
gst_pad_get_pad_template_caps (GST_VIDEO_ENCODER_SRC_PAD (enc)));
if (peercaps) {
GstStructure *s;
+ const gchar *alignment_string;
if (gst_caps_is_empty (peercaps)) {
gst_caps_unref (peercaps);
goto unsupported_level;
}
+ alignment_string = gst_structure_get_string (s, "alignment");
+ if (alignment_string && g_str_equal (alignment_string, "nal"))
+ enable_subframe = TRUE;
+
gst_caps_unref (peercaps);
}
if (!update_param_hevc (self, profile, level))
return FALSE;
+ gst_omx_port_set_subframe (GST_OMX_VIDEO_ENC (self)->enc_out_port,
+ enable_subframe);
+
return TRUE;
unsupported_profile:
GstCaps *caps;
OMX_ERRORTYPE err;
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
- const gchar *profile, *level, *tier;
+ const gchar *profile, *level, *tier, *alignment;
GST_OMX_INIT_STRUCT (¶m);
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index;
if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex)
return NULL;
+ if (gst_omx_port_get_subframe (GST_OMX_VIDEO_ENC (self)->enc_out_port))
+ alignment = "nal";
+ else
+ alignment = "au";
+
caps = gst_caps_new_simple ("video/x-h265",
"stream-format", G_TYPE_STRING, "byte-stream",
- "alignment", G_TYPE_STRING, "au", NULL);
+ "alignment", G_TYPE_STRING, alignment, NULL);
if (err == OMX_ErrorNone) {
profile = gst_omx_h265_utils_get_profile_from_enum (param.eProfile);