diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-11-15 08:40:07 -0800 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-11-15 08:40:07 -0800 |
commit | 1b58fa487e5b194b20192b805e993504ec3d07e5 (patch) | |
tree | 90c1b00281b25e22c2b63d6c2e29afee713dda8e /omx/gstomxh264enc.c | |
parent | 22ba4e1b9eb4153f0cbc080cd0665e5a4bb6608e (diff) |
omxh264enc: Detect bytestream stream format and don't put SPS/PPS into the caps for this format
Diffstat (limited to 'omx/gstomxh264enc.c')
-rw-r--r-- | omx/gstomxh264enc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c index 0b82a23..af1ad6c 100644 --- a/omx/gstomxh264enc.c +++ b/omx/gstomxh264enc.c @@ -35,6 +35,8 @@ static gboolean gst_omx_h264_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port, GstVideoState * state); static GstCaps *gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port, GstVideoState * state); +static GstFlowReturn gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * + self, GstOMXPort * port, GstOMXBuffer * buf, GstVideoFrame * frame); enum { @@ -81,6 +83,8 @@ gst_omx_h264_enc_class_init (GstOMXH264EncClass * klass) videoenc_class->default_src_template_caps = "video/x-h264, " "width=(int) [ 16, 4096 ], " "height=(int) [ 16, 4096 ]"; + videoenc_class->handle_output_frame = + GST_DEBUG_FUNCPTR (gst_omx_h264_enc_handle_output_frame); } static void @@ -324,3 +328,23 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port, return caps; } + +static GstFlowReturn +gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port, + GstOMXBuffer * buf, GstVideoFrame * frame) +{ + if (buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { + /* The codec data is SPS/PPS with a startcode => bytestream stream format + * For bytestream stream format the SPS/PPS is only in-stream and not + * in the caps! + */ + if (buf->omx_buf->nFilledLen >= 4 && + GST_READ_UINT32_BE (buf->omx_buf->pBuffer + + buf->omx_buf->nOffset) == 0x00000001) { + buf->omx_buf->nFlags &= ~OMX_BUFFERFLAG_CODECCONFIG; + } + } + + return GST_OMX_VIDEO_ENC_CLASS (parent_class)->handle_output_frame (self, + port, buf, frame); +} |