Message info
 
To:gstreamer-commits@lists.freedesktop.org From:Thibault Saunier Subject:gst-plugins-bad: hls: Minor GstFragment cleanup Date:Thu, 5 Apr 2012 14:15:51 -0700 (PDT)
 

Module: gst-plugins-bad
Branch: master
Commit: fdaa60c44fb9b27d75193b69c030c08f5b7f7740
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=fdaa60c44fb9b27d75193b69c030c08f5b7f7740

Author: Thibault Saunier <thibault.saunier@collabora.com>
Date: Tue Mar 13 15:18:22 2012 -0400

hls: Minor GstFragment cleanup

---

gst/hls/gstfragment.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/gst/hls/gstfragment.c b/gst/hls/gstfragment.c
index 210a930..2e09e34 100644
--- a/gst/hls/gstfragment.c
+++ b/gst/hls/gstfragment.c
@@ -42,8 +42,7 @@ struct _GstFragmentPrivate
{
GstBufferList *buffer_list;
GstBufferListIterator *buffer_iterator;
- gboolean can_set_headers;
- gboolean has_headers;
+ gboolean headers_set;
};

G_DEFINE_TYPE (GstFragment, gst_fragment, G_TYPE_OBJECT);
@@ -125,12 +124,11 @@ gst_fragment_init (GstFragment * fragment)
GstFragmentPrivate *priv;

fragment->priv = priv = GST_FRAGMENT_GET_PRIVATE (fragment);
- fragment->priv->buffer_list = gst_buffer_list_new ();
- fragment->priv->buffer_iterator =
- gst_buffer_list_iterate (fragment->priv->buffer_list);
- gst_buffer_list_iterator_add_group (fragment->priv->buffer_iterator);
- fragment->priv->can_set_headers = TRUE;
- fragment->priv->has_headers = FALSE;
+
+ priv->buffer_list = gst_buffer_list_new ();
+ priv->buffer_iterator = gst_buffer_list_iterate (priv->buffer_list);
+ gst_buffer_list_iterator_add_group (priv->buffer_iterator);
+ priv->headers_set = FALSE;
fragment->download_start_time = g_get_real_time ();
fragment->start_time = 0;
fragment->stop_time = 0;
@@ -159,12 +157,12 @@ gst_fragment_finalize (GObject * gobject)
void
gst_fragment_dispose (GObject * object)
{
- GstFragment *fragment = GST_FRAGMENT (object);
+ GstFragmentPrivate *priv = GST_FRAGMENT (object)->priv;

- if (fragment->priv->buffer_list != NULL) {
- gst_buffer_list_iterator_free (fragment->priv->buffer_iterator);
- gst_buffer_list_unref (fragment->priv->buffer_list);
- fragment->priv->buffer_list = NULL;
+ if (priv->buffer_list != NULL) {
+ gst_buffer_list_iterator_free (priv->buffer_iterator);
+ gst_buffer_list_unref (priv->buffer_list);
+ priv->buffer_list = NULL;
}

G_OBJECT_CLASS (gst_fragment_parent_class)->dispose (object);
@@ -191,7 +189,7 @@ gst_fragment_set_headers (GstFragment * fragment, GstBuffer ** buffer,
g_return_val_if_fail (fragment != NULL, FALSE);
g_return_val_if_fail (buffer != NULL, FALSE);

- if (!fragment->priv->can_set_headers)
+ if (fragment->priv->headers_set)
return FALSE;

for (i = 0; i < count; i++) {
@@ -199,7 +197,6 @@ gst_fragment_set_headers (GstFragment * fragment, GstBuffer ** buffer,
gst_buffer_list_iterator_add (fragment->priv->buffer_iterator, buffer[i]);
gst_buffer_list_iterator_add_group (fragment->priv->buffer_iterator);
}
- fragment->priv->has_headers = TRUE;
return TRUE;
}

@@ -215,9 +212,8 @@ gst_fragment_add_buffer (GstFragment * fragment, GstBuffer * buffer)
}

/* if this is the first buffer forbid setting the headers anymore */
- if (G_UNLIKELY (fragment->priv->can_set_headers)) {
- fragment->priv->can_set_headers = FALSE;
- }
+ if (G_UNLIKELY (fragment->priv->headers_set == FALSE))
+ fragment->priv->headers_set = TRUE;

GST_DEBUG ("Adding new buffer to the fragment");
gst_buffer_ref (buffer);

_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits