mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 06:38:19 +00:00
omxvideoenc: Add support for setting codec_data on the srcpad caps
This commit is contained in:
parent
182a488f49
commit
644fa35789
1 changed files with 32 additions and 5 deletions
|
@ -482,16 +482,43 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
|
||||||
buf->omx_buf->nTimeStamp);
|
buf->omx_buf->nTimeStamp);
|
||||||
|
|
||||||
frame = _find_nearest_frame (self, buf);
|
frame = _find_nearest_frame (self, buf);
|
||||||
if (buf->omx_buf->nFilledLen > 0) {
|
if ((buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG)
|
||||||
|
&& buf->omx_buf->nFilledLen > 0) {
|
||||||
|
GstCaps *caps;
|
||||||
|
GstBuffer *codec_data;
|
||||||
|
|
||||||
|
caps = gst_caps_copy (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (self)));
|
||||||
|
codec_data = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
|
||||||
|
memcpy (GST_BUFFER_DATA (codec_data),
|
||||||
|
buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
|
||||||
|
buf->omx_buf->nFilledLen);
|
||||||
|
|
||||||
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data, NULL);
|
||||||
|
if (!gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (self), caps)) {
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
if (buf)
|
||||||
|
gst_omx_port_release_buffer (self->out_port, buf);
|
||||||
|
goto caps_failed;
|
||||||
|
}
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
flow_ret = GST_FLOW_OK;
|
||||||
|
} else if (!(buf->omx_buf->nFlags & OMX_BUFFERFLAG_EOS)
|
||||||
|
|| buf->omx_buf->nFilledLen > 0) {
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
|
if (buf->omx_buf->nFilledLen > 0) {
|
||||||
|
outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
|
||||||
|
|
||||||
|
memcpy (GST_BUFFER_DATA (outbuf),
|
||||||
|
buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
|
||||||
|
buf->omx_buf->nFilledLen);
|
||||||
|
} else {
|
||||||
|
outbuf = gst_buffer_new ();
|
||||||
|
}
|
||||||
|
|
||||||
gst_buffer_set_caps (outbuf,
|
gst_buffer_set_caps (outbuf,
|
||||||
GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (self)));
|
GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (self)));
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (outbuf),
|
|
||||||
buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
|
|
||||||
buf->omx_buf->nFilledLen);
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||||
gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND,
|
gst_util_uint64_scale (buf->omx_buf->nTimeStamp, GST_SECOND,
|
||||||
OMX_TICKS_PER_SECOND);
|
OMX_TICKS_PER_SECOND);
|
||||||
|
|
Loading…
Reference in a new issue