jifmux: Avoid adding 2 xmp packets
jifmux was only appending a new xmp packet to the stream, it should replace if there is already one.
This commit is contained in:
parent
33b17318f2
commit
0d637e4f09
@ -216,6 +216,15 @@ gst_jif_mux_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_jif_mux_marker_free (GstJifMuxMarker * m)
|
||||||
|
{
|
||||||
|
if (m->owned)
|
||||||
|
g_free ((gpointer) m->data);
|
||||||
|
|
||||||
|
g_slice_free (GstJifMuxMarker, m);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_jif_mux_reset (GstJifMux * self)
|
gst_jif_mux_reset (GstJifMux * self)
|
||||||
{
|
{
|
||||||
@ -224,11 +233,7 @@ gst_jif_mux_reset (GstJifMux * self)
|
|||||||
|
|
||||||
for (node = self->priv->markers; node; node = g_list_next (node)) {
|
for (node = self->priv->markers; node; node = g_list_next (node)) {
|
||||||
m = (GstJifMuxMarker *) node->data;
|
m = (GstJifMuxMarker *) node->data;
|
||||||
|
gst_jif_mux_marker_free (m);
|
||||||
if (m->owned)
|
|
||||||
g_free ((gpointer) m->data);
|
|
||||||
|
|
||||||
g_slice_free (GstJifMuxMarker, m);
|
|
||||||
}
|
}
|
||||||
g_list_free (self->priv->markers);
|
g_list_free (self->priv->markers);
|
||||||
self->priv->markers = NULL;
|
self->priv->markers = NULL;
|
||||||
@ -459,15 +464,22 @@ gst_jif_mux_mangle_markers (GstJifMux * self)
|
|||||||
memcpy (&data[29], xmp, size);
|
memcpy (&data[29], xmp, size);
|
||||||
m = gst_jif_mux_new_marker (APP1, size + 29, data, TRUE);
|
m = gst_jif_mux_new_marker (APP1, size + 29, data, TRUE);
|
||||||
|
|
||||||
pos = file_hdr;
|
/* replace the old xmp marker and not add a new one */
|
||||||
if (app1_exif)
|
if (app1_xmp) {
|
||||||
pos = app1_exif;
|
gst_jif_mux_marker_free ((GstJifMuxMarker *) app1_xmp->data);
|
||||||
else if (app0_jfif)
|
app1_xmp->data = m;
|
||||||
pos = app0_jfif;
|
} else {
|
||||||
pos = g_list_next (pos);
|
|
||||||
|
|
||||||
self->priv->markers = g_list_insert_before (self->priv->markers, pos, m);
|
pos = file_hdr;
|
||||||
|
if (app1_exif)
|
||||||
|
pos = app1_exif;
|
||||||
|
else if (app0_jfif)
|
||||||
|
pos = app0_jfif;
|
||||||
|
pos = g_list_next (pos);
|
||||||
|
|
||||||
|
self->priv->markers = g_list_insert_before (self->priv->markers, pos, m);
|
||||||
|
|
||||||
|
}
|
||||||
gst_buffer_unref (xmp_data);
|
gst_buffer_unref (xmp_data);
|
||||||
modified = TRUE;
|
modified = TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user