mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
flvmux: Add metadatacreator property
Allow users to set metadatacreator value in the meta packet https://bugzilla.gnome.org/show_bug.cgi?id=774131
This commit is contained in:
parent
bbd4dd2fb1
commit
2f707370d4
2 changed files with 33 additions and 15 deletions
|
@ -49,11 +49,13 @@ GST_DEBUG_CATEGORY_STATIC (flvmux_debug);
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_STREAMABLE
|
PROP_STREAMABLE,
|
||||||
|
PROP_METADATACREATOR
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_STREAMABLE FALSE
|
#define DEFAULT_STREAMABLE FALSE
|
||||||
#define MAX_INDEX_ENTRIES 128
|
#define MAX_INDEX_ENTRIES 128
|
||||||
|
#define DEFAULT_METADATACREATOR "GStreamer " PACKAGE_VERSION " FLV muxer"
|
||||||
|
|
||||||
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
|
@ -194,6 +196,10 @@ gst_flv_mux_class_init (GstFlvMuxClass * klass)
|
||||||
"If set to true, the output should be as if it is to be streamed "
|
"If set to true, the output should be as if it is to be streamed "
|
||||||
"and hence no indexes written or duration written.",
|
"and hence no indexes written or duration written.",
|
||||||
DEFAULT_STREAMABLE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
DEFAULT_STREAMABLE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_METADATACREATOR,
|
||||||
|
g_param_spec_string ("metadatacreator", "metadatacreator",
|
||||||
|
"The value of metadatacreator in the meta packet.",
|
||||||
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_flv_mux_change_state);
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_flv_mux_change_state);
|
||||||
gstelement_class->request_new_pad =
|
gstelement_class->request_new_pad =
|
||||||
|
@ -222,6 +228,7 @@ gst_flv_mux_init (GstFlvMux * mux)
|
||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
mux->streamable = DEFAULT_STREAMABLE;
|
mux->streamable = DEFAULT_STREAMABLE;
|
||||||
|
mux->metadatacreator = g_strdup (DEFAULT_METADATACREATOR);
|
||||||
|
|
||||||
mux->new_tags = FALSE;
|
mux->new_tags = FALSE;
|
||||||
|
|
||||||
|
@ -242,6 +249,7 @@ gst_flv_mux_finalize (GObject * object)
|
||||||
GstFlvMux *mux = GST_FLV_MUX (object);
|
GstFlvMux *mux = GST_FLV_MUX (object);
|
||||||
|
|
||||||
gst_object_unref (mux->collect);
|
gst_object_unref (mux->collect);
|
||||||
|
g_free (mux->metadatacreator);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -960,21 +968,18 @@ tags:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
_gst_buffer_new_and_alloc (2 + 15 + 1 + 2 + strlen (mux->metadatacreator),
|
||||||
const gchar *s = "GStreamer FLV muxer";
|
&tmp, &data);
|
||||||
|
|
||||||
_gst_buffer_new_and_alloc (2 + 15 + 1 + 2 + strlen (s), &tmp, &data);
|
|
||||||
data[0] = 0; /* 15 bytes name */
|
data[0] = 0; /* 15 bytes name */
|
||||||
data[1] = 15;
|
data[1] = 15;
|
||||||
memcpy (&data[2], "metadatacreator", 15);
|
memcpy (&data[2], "metadatacreator", 15);
|
||||||
data[17] = 2; /* string */
|
data[17] = 2; /* string */
|
||||||
data[18] = (strlen (s) >> 8) & 0xff;
|
data[18] = (strlen (mux->metadatacreator) >> 8) & 0xff;
|
||||||
data[19] = (strlen (s)) & 0xff;
|
data[19] = (strlen (mux->metadatacreator)) & 0xff;
|
||||||
memcpy (&data[20], s, strlen (s));
|
memcpy (&data[20], mux->metadatacreator, strlen (mux->metadatacreator));
|
||||||
script_tag = gst_buffer_append (script_tag, tmp);
|
script_tag = gst_buffer_append (script_tag, tmp);
|
||||||
|
|
||||||
tags_written++;
|
tags_written++;
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
GTimeVal tv = { 0, };
|
GTimeVal tv = { 0, };
|
||||||
|
@ -1682,6 +1687,9 @@ gst_flv_mux_get_property (GObject * object,
|
||||||
case PROP_STREAMABLE:
|
case PROP_STREAMABLE:
|
||||||
g_value_set_boolean (value, mux->streamable);
|
g_value_set_boolean (value, mux->streamable);
|
||||||
break;
|
break;
|
||||||
|
case PROP_METADATACREATOR:
|
||||||
|
g_value_set_string (value, mux->metadatacreator);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -1704,6 +1712,15 @@ gst_flv_mux_set_property (GObject * object,
|
||||||
gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (mux),
|
gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (mux),
|
||||||
GST_TAG_MERGE_KEEP);
|
GST_TAG_MERGE_KEEP);
|
||||||
break;
|
break;
|
||||||
|
case PROP_METADATACREATOR:
|
||||||
|
g_free (mux->metadatacreator);
|
||||||
|
if (!g_value_get_string (value)) {
|
||||||
|
GST_WARNING_OBJECT (mux, "metadatacreator property can not be NULL");
|
||||||
|
mux->metadatacreator = g_strdup (DEFAULT_METADATACREATOR);
|
||||||
|
} else {
|
||||||
|
mux->metadatacreator = g_value_dup_string (value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -76,6 +76,7 @@ typedef struct _GstFlvMux {
|
||||||
gboolean have_audio;
|
gboolean have_audio;
|
||||||
gboolean have_video;
|
gboolean have_video;
|
||||||
gboolean streamable;
|
gboolean streamable;
|
||||||
|
gchar *metadatacreator;
|
||||||
|
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
gboolean new_tags;
|
gboolean new_tags;
|
||||||
|
|
Loading…
Reference in a new issue