From: Gwenole Beauchesne Date: Thu, 19 Jul 2012 15:41:25 +0000 (+0200) Subject: Drop obsolete GstVaapiTSB. X-Git-Tag: accepted/trunk/20120822.173359~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=562d98ec56d28956a618d3ef06c46ffc7ceecc96;p=profile%2Fivi%2Fgstreamer-vaapi.git Drop obsolete GstVaapiTSB. It has been replaced with a GstAdapter and gst_adapter_prev_pts(). --- diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am index 27145b0..49f95c5 100644 --- a/gst-libs/gst/vaapi/Makefile.am +++ b/gst-libs/gst/vaapi/Makefile.am @@ -53,7 +53,6 @@ libgstvaapi_source_c = \ gstvaapisurfacepool.c \ gstvaapisurfaceproxy.c \ gstvaapiutils.c \ - gstvaapiutils_tsb.c \ gstvaapivalue.c \ gstvaapivideobuffer.c \ gstvaapivideopool.c \ @@ -101,7 +100,6 @@ libgstvaapi_source_priv_h = \ gstvaapiobject_priv.h \ gstvaapisurface_priv.h \ gstvaapiutils.h \ - gstvaapiutils_tsb.h \ gstvaapivideobuffer_priv.h \ gstvaapiworkarounds.h \ sysdeps.h \ diff --git a/gst-libs/gst/vaapi/gstvaapiutils_tsb.c b/gst-libs/gst/vaapi/gstvaapiutils_tsb.c deleted file mode 100644 index 67ef2f2..0000000 --- a/gst-libs/gst/vaapi/gstvaapiutils_tsb.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * gstvaapiutils_tsb.c - Timestamp buffer store - * - * Copyright (C) 2011 Intel Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include "gstvaapiutils_tsb.h" -#include - -typedef struct _GstVaapiTSBEntry GstVaapiTSBEntry; - -struct _GstVaapiTSB { - GList *list; -}; - -struct _GstVaapiTSBEntry { - GstBuffer *buffer; - guint32 buffer_size; - guint32 offset; -}; - -static GstVaapiTSBEntry * -gst_vaapi_tsb_entry_new(GstBuffer *buffer) -{ - GstVaapiTSBEntry *e; - - e = g_slice_new(GstVaapiTSBEntry); - if (!e) - return NULL; - - e->buffer = gst_buffer_ref(buffer); - e->buffer_size = GST_BUFFER_SIZE(buffer); - e->offset = 0; - return e; -} - -static void -gst_vaapi_tsb_entry_destroy(GstVaapiTSBEntry *e) -{ - if (!e) - return; - - if (e->buffer) { - gst_buffer_unref(e->buffer); - e->buffer = NULL; - } - g_slice_free(GstVaapiTSBEntry, e); -} - -/** - * gst_vaapi_tsb_new: - * - * Creates a new #GstVaapiTSB. - * - * Return value: a new #GstVaapiTSB - */ -GstVaapiTSB * -gst_vaapi_tsb_new() -{ - GstVaapiTSB *tsb; - - tsb = g_new(GstVaapiTSB, 1); - if (!tsb) - return NULL; - - tsb->list = NULL; - return tsb; -} - -/** - * gst_vaapi_tsb_destroy: - * @tsb: a #GstVaapiTSB - * - * Destroys the #GstVaapiTSB. All buffers are unreferenced. - */ -void -gst_vaapi_tsb_destroy(GstVaapiTSB *tsb) -{ - if (!tsb) - return; - - if (tsb->list) { - g_list_foreach(tsb->list, (GFunc)gst_vaapi_tsb_entry_destroy, NULL); - g_list_free(tsb->list); - tsb->list = NULL; - } - g_free(tsb); -} - -/** - * gst_vaapi_tsb_push: - * @tsb: a #GstVaapiTSB - * @buffer: a #GstBuffer - * - * Pushes @buffer to the timestamp buffer store. The TSB owns and - * maintains an extra reference to the buffer. - * - * Return value: %TRUE if success, %FALSE otherwise - */ -gboolean -gst_vaapi_tsb_push(GstVaapiTSB *tsb, GstBuffer *buffer) -{ - GList *l; - GstVaapiTSBEntry *e; - - if (!tsb) - return FALSE; - - e = gst_vaapi_tsb_entry_new(buffer); - if (!e) - return FALSE; - - l = g_list_append(tsb->list, e); - if (!l) - return FALSE; - - tsb->list = l; - return TRUE; -} - -/** - * gst_vaapi_tsb_pop: - * @tsb: a #GstVaapiTSB - * @size: number of bytes to remove from the TSB - * - * Removes @size bytes from the @tsb. - */ -void -gst_vaapi_tsb_pop(GstVaapiTSB *tsb, gsize size) -{ - GList *l; - GstVaapiTSBEntry *e; - guint32 n; - - if (!tsb || !tsb->list) - return; - - l = tsb->list; - e = l->data; - while (size > 0) { - n = MIN(e->buffer_size - e->offset, size); - e->offset += n; - size -= n; - if (e->offset == e->buffer_size) { - gst_vaapi_tsb_entry_destroy(e); - l = l->next; - g_list_free_1(tsb->list); - tsb->list = l; - if (!l) - return; - e = l->data; - } - } -} - -/** - * gst_vaapi_tsb_peek: - * @tsb: a #GstVaapiTSB - * - * Returns the current #GstBuffer. - * - * Return value: current #GstBuffer, or %NULL if none was found - */ -GstBuffer * -gst_vaapi_tsb_peek(GstVaapiTSB *tsb) -{ - GstVaapiTSBEntry *e; - - if (!tsb || !tsb->list) - return NULL; - - e = tsb->list->data; - if (!e) - return NULL; - - return e->buffer; -} - -/** - * gst_vaapi_tsb_get_timestamp: - * @tsb: a #GstVaapiTSB - * - * Returns the timestamp for the current #GstBuffer. - * - * Return value: current #GstBuffer timestamp, or %GST_CLOCK_TIME_NONE if none was found - */ -GstClockTime -gst_vaapi_tsb_get_timestamp(GstVaapiTSB *tsb) -{ - GstBuffer *buffer; - - buffer = gst_vaapi_tsb_peek(tsb); - if (!buffer) - return GST_CLOCK_TIME_NONE; - - return GST_BUFFER_TIMESTAMP(buffer); -} - -/** - * gst_vaapi_tsb_get_size: - * @tsb: a #GstVaapiTSB - * - * Returns the size of the #GstVaapiTSB. - * - * Return value: how many bytes left to consume from @tsb - */ -gsize -gst_vaapi_tsb_get_size(GstVaapiTSB *tsb) -{ - GList *l; - GstVaapiTSBEntry *e; - guint32 size = 0; - - if (!tsb || !tsb->list) - return 0; - - for (l = tsb->list; l != NULL; l = l->next) { - e = l->data; - size += e->buffer_size - e->offset; - } - return size; -} diff --git a/gst-libs/gst/vaapi/gstvaapiutils_tsb.h b/gst-libs/gst/vaapi/gstvaapiutils_tsb.h deleted file mode 100644 index 4070571..0000000 --- a/gst-libs/gst/vaapi/gstvaapiutils_tsb.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * gstvaapiutils_tsb.h - Timestamp buffer store - * - * Copyright (C) 2011 Intel Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#ifndef GST_VAAPI_UTILS_TSB_H -#define GST_VAAPI_UTILS_TSB_H - -#include "config.h" -#include - -typedef struct _GstVaapiTSB GstVaapiTSB; - -GstVaapiTSB * -gst_vaapi_tsb_new() - attribute_hidden; - -void -gst_vaapi_tsb_destroy(GstVaapiTSB *tsb) - attribute_hidden; - -gboolean -gst_vaapi_tsb_push(GstVaapiTSB *tsb, GstBuffer *buffer) - attribute_hidden; - -void -gst_vaapi_tsb_pop(GstVaapiTSB *tsb, gsize size) - attribute_hidden; - -GstBuffer * -gst_vaapi_tsb_peek(GstVaapiTSB *tsb) - attribute_hidden; - -GstClockTime -gst_vaapi_tsb_get_timestamp(GstVaapiTSB *tsb) - attribute_hidden; - -gsize -gst_vaapi_tsb_get_size(GstVaapiTSB *tsb) - attribute_hidden; - -#endif /* GST_VAAPI_UTILS_TSB_H */