mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
Merge branch 'master' into 0.11
Conflicts: gst-libs/gst/tag/gstxmptag.c gst/encoding/gststreamsplitter.c
This commit is contained in:
commit
26cc33cb62
5 changed files with 115 additions and 41 deletions
|
@ -1324,7 +1324,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
|
|||
if (*xp1 != '>')
|
||||
goto missing_header;
|
||||
|
||||
max_ft_len = 1 + strlen ("<?xpacket end=\".\"?>\n");
|
||||
max_ft_len = 1 + strlen ("<?xpacket end=\".\"?>");
|
||||
if (len < max_ft_len)
|
||||
goto missing_footer;
|
||||
|
||||
|
@ -1859,10 +1859,10 @@ gst_tag_list_to_xmp_buffer_full (const GstTagList * list, gboolean read_only,
|
|||
" " " " "\n");
|
||||
}
|
||||
}
|
||||
g_string_append_printf (data, "<?xpacket end=\"%c\"?>\n",
|
||||
g_string_append_printf (data, "<?xpacket end=\"%c\"?>",
|
||||
(read_only ? 'r' : 'w'));
|
||||
|
||||
bsize = data->len + 1;
|
||||
bsize = data->len;
|
||||
bdata = g_string_free (data, FALSE);
|
||||
|
||||
buffer = gst_buffer_new ();
|
||||
|
|
|
@ -118,6 +118,15 @@
|
|||
#define fast_pad_link(a,b) gst_pad_link_full((a),(b),GST_PAD_LINK_CHECK_NOTHING)
|
||||
#define fast_element_link(a,b) gst_element_link_pads_full((a),"src",(b),"sink",GST_PAD_LINK_CHECK_NOTHING)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GST_ENC_FLAG_NATIVE_AUDIO = (1 << 0),
|
||||
GST_ENC_FLAG_NATIVE_VIDEO = (1 << 1)
|
||||
} GstEncFlags;
|
||||
|
||||
#define GST_TYPE_ENC_FLAGS (gst_enc_flags_get_type())
|
||||
GType gst_enc_flags_get_type (void);
|
||||
|
||||
/* generic templates */
|
||||
static GstStaticPadTemplate muxer_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||
|
@ -180,6 +189,8 @@ struct _GstEncodeBin
|
|||
|
||||
guint64 tolerance;
|
||||
gboolean avoid_reencoding;
|
||||
|
||||
GstEncFlags flags;
|
||||
};
|
||||
|
||||
struct _GstEncodeBinClass
|
||||
|
@ -216,6 +227,7 @@ struct _StreamGroup
|
|||
#define DEFAULT_QUEUE_TIME_MAX GST_SECOND
|
||||
#define DEFAULT_AUDIO_JITTER_TOLERANCE 20 * GST_MSECOND
|
||||
#define DEFAULT_AVOID_REENCODING FALSE
|
||||
#define DEFAULT_FLAGS 0
|
||||
|
||||
#define DEFAULT_RAW_CAPS \
|
||||
"video/x-raw; " \
|
||||
|
@ -236,6 +248,7 @@ enum
|
|||
PROP_QUEUE_TIME_MAX,
|
||||
PROP_AUDIO_JITTER_TOLERANCE,
|
||||
PROP_AVOID_REENCODING,
|
||||
PROP_FLAGS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
|
@ -246,6 +259,31 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
#define C_FLAGS(v) ((guint) v)
|
||||
|
||||
GType
|
||||
gst_enc_flags_get_type (void)
|
||||
{
|
||||
static const GFlagsValue values[] = {
|
||||
{C_FLAGS (GST_ENC_FLAG_NATIVE_AUDIO), "Only use native audio formats",
|
||||
"native-audio"},
|
||||
{C_FLAGS (GST_ENC_FLAG_NATIVE_VIDEO), "Only use native video formats",
|
||||
"native-video"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
static volatile GType id = 0;
|
||||
|
||||
if (g_once_init_enter ((gsize *) & id)) {
|
||||
GType _id;
|
||||
|
||||
_id = g_flags_register_static ("GstEncFlags", values);
|
||||
|
||||
g_once_init_leave ((gsize *) & id, _id);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static guint gst_encode_bin_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS);
|
||||
|
@ -337,6 +375,16 @@ gst_encode_bin_class_init (GstEncodeBinClass * klass)
|
|||
DEFAULT_AVOID_REENCODING,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GstEncodeBin:flags
|
||||
*
|
||||
* Control the behaviour of encodebin.
|
||||
*/
|
||||
g_object_class_install_property (gobject_klass, PROP_FLAGS,
|
||||
g_param_spec_flags ("flags", "Flags", "Flags to control behaviour",
|
||||
GST_TYPE_ENC_FLAGS, DEFAULT_FLAGS,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/* Signals */
|
||||
/**
|
||||
* GstEncodeBin::request-pad
|
||||
|
@ -444,6 +492,7 @@ gst_encode_bin_init (GstEncodeBin * encode_bin)
|
|||
encode_bin->queue_time_max = DEFAULT_QUEUE_TIME_MAX;
|
||||
encode_bin->tolerance = DEFAULT_AUDIO_JITTER_TOLERANCE;
|
||||
encode_bin->avoid_reencoding = DEFAULT_AVOID_REENCODING;
|
||||
encode_bin->flags = DEFAULT_FLAGS;
|
||||
|
||||
tmpl = gst_static_pad_template_get (&muxer_src_template);
|
||||
encode_bin->srcpad = gst_ghost_pad_new_no_target_from_template ("src", tmpl);
|
||||
|
@ -477,6 +526,9 @@ gst_encode_bin_set_property (GObject * object, guint prop_id,
|
|||
case PROP_AVOID_REENCODING:
|
||||
ebin->avoid_reencoding = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_FLAGS:
|
||||
ebin->flags = g_value_get_flags (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -508,6 +560,9 @@ gst_encode_bin_get_property (GObject * object, guint prop_id,
|
|||
case PROP_AVOID_REENCODING:
|
||||
g_value_set_boolean (value, ebin->avoid_reencoding);
|
||||
break;
|
||||
case PROP_FLAGS:
|
||||
g_value_set_flags (value, ebin->flags);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -1207,37 +1262,40 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||
/* 3.2. restriction elements */
|
||||
/* FIXME : Once we have properties for specific converters, use those */
|
||||
if (GST_IS_ENCODING_VIDEO_PROFILE (sprof)) {
|
||||
GstElement *cspace, *scale, *vrate, *cspace2;
|
||||
const gboolean native_video = !!(ebin->flags & GST_ENC_FLAG_NATIVE_VIDEO);
|
||||
GstElement *cspace = NULL, *scale, *vrate, *cspace2 = NULL;
|
||||
|
||||
GST_LOG ("Adding conversion elements for video stream");
|
||||
|
||||
cspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
||||
scale = gst_element_factory_make ("videoscale", NULL);
|
||||
if (!scale) {
|
||||
missing_element_name = "videoscale";
|
||||
goto missing_element;
|
||||
if (!native_video) {
|
||||
cspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
||||
scale = gst_element_factory_make ("videoscale", NULL);
|
||||
if (!scale) {
|
||||
missing_element_name = "videoscale";
|
||||
goto missing_element;
|
||||
}
|
||||
/* 4-tap scaling and black borders */
|
||||
g_object_set (scale, "method", 2, "add-borders", TRUE, NULL);
|
||||
cspace2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
||||
|
||||
if (!cspace || !cspace2) {
|
||||
missing_element_name = "ffmpegcolorspace";
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
gst_bin_add_many ((GstBin *) ebin, cspace, scale, cspace2, NULL);
|
||||
tosync = g_list_append (tosync, cspace);
|
||||
tosync = g_list_append (tosync, scale);
|
||||
tosync = g_list_append (tosync, cspace2);
|
||||
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, cspace);
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, scale);
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, cspace2);
|
||||
|
||||
if (!fast_element_link (cspace, scale) ||
|
||||
!fast_element_link (scale, cspace2))
|
||||
goto converter_link_failure;
|
||||
}
|
||||
/* 4-tap scaling and black borders */
|
||||
g_object_set (scale, "method", 2, "add-borders", TRUE, NULL);
|
||||
cspace2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
||||
|
||||
if (!cspace || !cspace2) {
|
||||
missing_element_name = "ffmpegcolorspace";
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
gst_bin_add_many ((GstBin *) ebin, cspace, scale, cspace2, NULL);
|
||||
tosync = g_list_append (tosync, cspace);
|
||||
tosync = g_list_append (tosync, scale);
|
||||
tosync = g_list_append (tosync, cspace2);
|
||||
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, cspace);
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, scale);
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, cspace2);
|
||||
|
||||
if (!fast_element_link (cspace, scale) ||
|
||||
!fast_element_link (scale, cspace2))
|
||||
goto converter_link_failure;
|
||||
|
||||
if (!gst_encoding_video_profile_get_variableframerate
|
||||
(GST_ENCODING_VIDEO_PROFILE (sprof))) {
|
||||
|
@ -1250,15 +1308,23 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||
gst_bin_add ((GstBin *) ebin, vrate);
|
||||
tosync = g_list_prepend (tosync, vrate);
|
||||
sgroup->converters = g_list_prepend (sgroup->converters, vrate);
|
||||
if (!fast_element_link (cspace2, vrate) ||
|
||||
!fast_element_link (vrate, last))
|
||||
|
||||
if ((!native_video && !fast_element_link (cspace2, vrate))
|
||||
|| !fast_element_link (vrate, last))
|
||||
goto converter_link_failure;
|
||||
} else if (!fast_element_link (cspace2, last))
|
||||
goto converter_link_failure;
|
||||
|
||||
last = cspace;
|
||||
if (!native_video)
|
||||
last = cspace;
|
||||
else
|
||||
last = vrate;
|
||||
} else if (!native_video) {
|
||||
if (!fast_element_link (cspace2, last))
|
||||
goto converter_link_failure;
|
||||
last = cspace;
|
||||
}
|
||||
|
||||
} else if (GST_IS_ENCODING_AUDIO_PROFILE (sprof)) {
|
||||
} else if (GST_IS_ENCODING_AUDIO_PROFILE (sprof)
|
||||
&& !(ebin->flags & GST_ENC_FLAG_NATIVE_AUDIO)) {
|
||||
GstElement *aconv, *ares, *arate, *aconv2;
|
||||
|
||||
GST_LOG ("Adding conversion elements for audio stream");
|
||||
|
|
|
@ -280,10 +280,13 @@ resync:
|
|||
GstPad *srcpad = (GstPad *) tmp->data;
|
||||
|
||||
STREAMS_UNLOCK (stream_splitter);
|
||||
if (res)
|
||||
gst_caps_merge (res, gst_pad_peer_get_caps (srcpad, filter));
|
||||
else
|
||||
if (res) {
|
||||
GstCaps *peercaps = gst_pad_peer_get_caps (srcpad, filter);
|
||||
if (peercaps)
|
||||
gst_caps_merge (res, gst_caps_make_writable (peercaps));
|
||||
} else {
|
||||
res = gst_pad_peer_get_caps (srcpad, filter);
|
||||
}
|
||||
STREAMS_LOCK (stream_splitter);
|
||||
|
||||
if (G_UNLIKELY (cookie != stream_splitter->cookie)) {
|
||||
|
|
|
@ -4077,6 +4077,8 @@ degas_type_find (GstTypeFind * tf, gpointer private)
|
|||
if (len < 34) /* smallest header of the lot */
|
||||
return;
|
||||
data = gst_type_find_peek (tf, 0, 4);
|
||||
if (G_UNLIKELY (data == NULL))
|
||||
return;
|
||||
resolution = GST_READ_UINT16_BE (data);
|
||||
if (len == 32034) {
|
||||
/* could be DEGAS */
|
||||
|
@ -4087,6 +4089,8 @@ degas_type_find (GstTypeFind * tf, gpointer private)
|
|||
/* could be DEGAS Elite */
|
||||
if (resolution <= 2) {
|
||||
data = gst_type_find_peek (tf, len - 16, 8);
|
||||
if (G_UNLIKELY (data == NULL))
|
||||
return;
|
||||
for (n = 0; n < 4; n++) {
|
||||
if (GST_READ_UINT16_BE (data + n * 2) > 2)
|
||||
return;
|
||||
|
@ -4099,6 +4103,8 @@ degas_type_find (GstTypeFind * tf, gpointer private)
|
|||
it does have 4 16 bytes values near the end that are 0-2 though. */
|
||||
if ((resolution & 0x8000) && (resolution & 0x7fff) <= 2) {
|
||||
data = gst_type_find_peek (tf, len - 16, 8);
|
||||
if (G_UNLIKELY (data == NULL))
|
||||
return;
|
||||
for (n = 0; n < 4; n++) {
|
||||
if (GST_READ_UINT16_BE (data + n * 2) > 2)
|
||||
return;
|
||||
|
|
|
@ -804,8 +804,7 @@ GST_START_TEST (test_xmp_parsing)
|
|||
"<?xpacket begin=\"\xEF\xBB\xBF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>"
|
||||
"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"GStreamer\">"
|
||||
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";
|
||||
const gchar *xmp_footer =
|
||||
"</rdf:RDF>" "</x:xmpmeta>" "<?xpacket end=\"r\"?>\n";
|
||||
const gchar *xmp_footer = "</rdf:RDF>" "</x:xmpmeta>" "<?xpacket end=\"r\"?>";
|
||||
struct
|
||||
{
|
||||
const gchar *xmp_data;
|
||||
|
|
Loading…
Reference in a new issue