summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 672c1ab)
raw | patch | inline | side by side (parent: 672c1ab)
author | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | |
Tue, 14 Jun 2011 02:24:27 +0000 (23:24 -0300) | ||
committer | Nikhil Devshatwar <a0132237@ti.com> | |
Fri, 17 May 2013 09:40:35 +0000 (15:10 +0530) |
Makes x264 select its stream-format based on what's available
on caps, the user selected option will be chosen as a fallback
when both options are available.
https://bugzilla.gnome.org/show_bug.cgi?id=644233
on caps, the user selected option will be chosen as a fallback
when both options are available.
https://bugzilla.gnome.org/show_bug.cgi?id=644233
ext/x264/gstx264enc.c | patch | blob | history | |
ext/x264/gstx264enc.h | patch | blob | history |
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index f3377bda982a9bbc9afc628b9a4be8e3ae102ae9..f8cde40f8a8d88b1e1dac50a91bf767ac7e91eb5 100644 (file)
--- a/ext/x264/gstx264enc.c
+++ b/ext/x264/gstx264enc.c
#define ARG_PSY_TUNE_DEFAULT 0 /* no psy tuning */
#define ARG_TUNE_DEFAULT 0 /* no tuning */
+enum
+{
+ GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY,
+ GST_X264_ENC_STREAM_FORMAT_AVC,
+ GST_X264_ENC_STREAM_FORMAT_BYTE_STREAM
+};
+
enum
{
GST_X264_ENC_PASS_CBR = 0,
encoder->x264enc = NULL;
encoder->width = 0;
encoder->height = 0;
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
GST_OBJECT_LOCK (encoder);
encoder->i_type = X264_TYPE_AUTO;
@@ -1445,7 +1453,14 @@ gst_x264_enc_set_src_caps (GstX264Enc * encoder, GstPad * pad, GstCaps * caps)
structure = gst_caps_get_structure (outcaps, 0);
- if (!encoder->byte_stream) {
+ if (encoder->current_byte_stream == GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY) {
+ if (encoder->byte_stream) {
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_BYTE_STREAM;
+ } else {
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_AVC;
+ }
+ }
+ if (encoder->current_byte_stream == GST_X264_ENC_STREAM_FORMAT_AVC) {
buf = gst_x264_enc_header_buf (encoder);
if (buf != NULL) {
gst_caps_set_simple (outcaps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
GstStructure *s;
const gchar *profile;
const gchar *level;
+ const gchar *bytestream;
if (gst_caps_is_empty (allowed_caps)) {
gst_caps_unref (allowed_caps);
}
}
+ bytestream = gst_structure_get_string (s, "stream-format");
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
+ if (bytestream) {
+ if (!strcmp (bytestream, "avc")) {
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_AVC;
+ } else if (!strcmp (profile, "byte-stream")) {
+ encoder->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_BYTE_STREAM;
+ } else {
+ /* means we have both in caps and _FROM_PROPERTY should be the option */
+ }
+ }
+
gst_caps_unref (allowed_caps);
}
nal_size =
x264_nal_encode (encoder->buffer + i_size + 4, &i_data, 0, &nal[i]);
- if (encoder->byte_stream)
+ g_assert (encoder->current_byte_stream !=
+ GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY);
+ if (encoder->current_byte_stream == GST_X264_ENC_STREAM_FORMAT_BYTE_STREAM)
GST_WRITE_UINT32_BE (encoder->buffer + i_size, 1);
else
GST_WRITE_UINT32_BE (encoder->buffer + i_size, nal_size);
diff --git a/ext/x264/gstx264enc.h b/ext/x264/gstx264enc.h
index e779a5e893f079d5ea793382844790b7514ac25f..a2f1145b97c5c1bd53c3ac2fa71544d395bccb37 100644 (file)
--- a/ext/x264/gstx264enc.h
+++ b/ext/x264/gstx264enc.h
x264_t *x264enc;
x264_param_t x264param;
+ gint current_byte_stream;
/* properties */
guint threads;