From: <thi...@ke...> - 2010-01-13 14:08:58
|
Module: gst-plugins-ugly Branch: master Commit: c77dfa7b9fd350825ab5de445fafc5ace10ddd17 URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=c77dfa7b9fd350825ab5de445fafc5ace10ddd17 Author: Thiago Santos <thi...@co...> Date: Mon Jan 11 16:14:44 2010 -0300 x264enc: Add stream-format to output caps Adds stream-format to output caps of x264enc that informs if the stream is in bytestream of avc format. Fixes #606662 --- ext/x264/gstx264enc.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index e76adf2..59a14ef 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -220,7 +220,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-h264, " "framerate = (fraction) [0/1, MAX], " - "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") + "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ], " + "stream-format = (string) { byte-stream, avc-sample }") ); static void gst_x264_enc_finalize (GObject * object); @@ -788,6 +789,7 @@ gst_x264_enc_set_src_caps (GstX264Enc * encoder, GstPad * pad, GstCaps * caps) { GstBuffer *buf; GstCaps *outcaps; + GstStructure *structure; gboolean res; outcaps = gst_caps_new_simple ("video/x-h264", @@ -795,12 +797,19 @@ gst_x264_enc_set_src_caps (GstX264Enc * encoder, GstPad * pad, GstCaps * caps) "height", G_TYPE_INT, encoder->height, "framerate", GST_TYPE_FRACTION, encoder->fps_num, encoder->fps_den, NULL); + structure = gst_caps_get_structure (outcaps, 0); + if (!encoder->byte_stream) { buf = gst_x264_enc_header_buf (encoder); if (buf != NULL) { gst_caps_set_simple (outcaps, "codec_data", GST_TYPE_BUFFER, buf, NULL); gst_buffer_unref (buf); } + gst_structure_set (structure, "stream-format", G_TYPE_STRING, "avc-sample", + NULL); + } else { + gst_structure_set (structure, "stream-format", G_TYPE_STRING, "byte-stream", + NULL); } res = gst_pad_set_caps (pad, outcaps); |