demux->global_tags = NULL;
}
- g_object_unref (demux->adapter);
+ g_object_unref (demux->common.adapter);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
demux->common.index = NULL;
demux->global_tags = NULL;
- demux->adapter = gst_adapter_new ();
+ demux->common.adapter = gst_adapter_new ();
/* finish off */
gst_matroska_demux_reset (GST_ELEMENT (demux));
ret = gst_matroska_demux_check_read_size (demux, flush);
if (ret != GST_FLOW_OK)
return ret;
- if (flush <= gst_adapter_available (demux->adapter))
- gst_adapter_flush (demux->adapter, flush);
+ if (flush <= gst_adapter_available (demux->common.adapter))
+ gst_adapter_flush (demux->common.adapter, flush);
else
return GST_FLOW_UNEXPECTED;
}
goto exit;
}
if (demux->streaming) {
- if (gst_adapter_available (demux->adapter) >= bytes)
- buffer = gst_adapter_take_buffer (demux->adapter, bytes);
+ if (gst_adapter_available (demux->common.adapter) >= bytes)
+ buffer = gst_adapter_take_buffer (demux->common.adapter, bytes);
else
ret = GST_FLOW_UNEXPECTED;
} else
return res;
}
-static const guint8 *
-gst_matroska_demux_peek_adapter (GstMatroskaDemux * demux, guint peek)
-{
- return gst_adapter_peek (demux->adapter, peek);
-}
-
static GstFlowReturn
gst_matroska_demux_peek_id_length_push (GstMatroskaDemux * demux, guint32 * _id,
guint64 * _length, guint * _needed)
{
return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_demux_peek_adapter, (gpointer) demux,
- GST_ELEMENT_CAST (demux), demux->common.offset);
+ (GstPeekData) gst_matroska_read_common_peek_adapter,
+ (gpointer) (&demux->common), GST_ELEMENT_CAST (demux),
+ demux->common.offset);
}
static GstFlowReturn
if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (buffer))) {
GST_DEBUG_OBJECT (demux, "got DISCONT");
- gst_adapter_clear (demux->adapter);
+ gst_adapter_clear (demux->common.adapter);
GST_OBJECT_LOCK (demux);
gst_matroska_demux_reset_streams (demux, GST_CLOCK_TIME_NONE, FALSE);
GST_OBJECT_UNLOCK (demux);
}
- gst_adapter_push (demux->adapter, buffer);
+ gst_adapter_push (demux->common.adapter, buffer);
buffer = NULL;
next:
- available = gst_adapter_available (demux->adapter);
+ available = gst_adapter_available (demux->common.adapter);
ret = gst_matroska_demux_peek_id_length_push (demux, &id, &length, &needed);
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED))
GST_DEBUG_OBJECT (demux, "clearing segment state");
GST_OBJECT_LOCK (demux);
/* clear current segment leftover */
- gst_adapter_clear (demux->adapter);
+ gst_adapter_clear (demux->common.adapter);
/* and some streaming setup */
demux->common.offset = start;
/* do not know where we are;
}
case GST_EVENT_FLUSH_STOP:
{
- gst_adapter_clear (demux->adapter);
+ gst_adapter_clear (demux->common.adapter);
GST_OBJECT_LOCK (demux);
gst_matroska_demux_reset_streams (demux, GST_CLOCK_TIME_NONE, TRUE);
demux->segment.last_stop = GST_CLOCK_TIME_NONE;
#define __GST_MATROSKA_DEMUX_H__
#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
#include "ebml-read.h"
#include "matroska-ids.h"
guint64 first_cluster_offset;
guint64 next_cluster_offset;
- /* push based mode usual suspects */
- GstAdapter *adapter;
/* index stuff */
gboolean seekable;
gboolean building_index;
parse->global_tags = NULL;
}
- g_object_unref (parse->adapter);
+ g_object_unref (parse->common.adapter);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
parse->common.index = NULL;
parse->global_tags = NULL;
- parse->adapter = gst_adapter_new ();
+ parse->common.adapter = gst_adapter_new ();
/* finish off */
gst_matroska_parse_reset (GST_ELEMENT (parse));
ret = GST_FLOW_ERROR;
goto exit;
}
- if (gst_adapter_available (parse->adapter) >= bytes)
- buffer = gst_adapter_take_buffer (parse->adapter, bytes);
+ if (gst_adapter_available (parse->common.adapter) >= bytes)
+ buffer = gst_adapter_take_buffer (parse->common.adapter, bytes);
else
ret = GST_FLOW_UNEXPECTED;
if (G_LIKELY (buffer)) {
return res;
}
-static const guint8 *
-gst_matroska_parse_peek_adapter (GstMatroskaParse * parse, guint peek)
-{
- return gst_adapter_peek (parse->adapter, peek);
-}
-
static GstFlowReturn
gst_matroska_parse_peek_id_length_push (GstMatroskaParse * parse, guint32 * _id,
guint64 * _length, guint * _needed)
{
return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_parse_peek_adapter, (gpointer) parse,
- GST_ELEMENT_CAST (parse), parse->common.offset);
+ (GstPeekData) gst_matroska_read_common_peek_adapter,
+ (gpointer) (&parse->common), GST_ELEMENT_CAST (parse),
+ parse->common.offset);
}
static GstFlowReturn
if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (buffer))) {
GST_DEBUG_OBJECT (parse, "got DISCONT");
- gst_adapter_clear (parse->adapter);
+ gst_adapter_clear (parse->common.adapter);
GST_OBJECT_LOCK (parse);
gst_matroska_parse_reset_streams (parse, GST_CLOCK_TIME_NONE, FALSE);
GST_OBJECT_UNLOCK (parse);
}
- gst_adapter_push (parse->adapter, buffer);
+ gst_adapter_push (parse->common.adapter, buffer);
buffer = NULL;
next:
- available = gst_adapter_available (parse->adapter);
+ available = gst_adapter_available (parse->common.adapter);
ret = gst_matroska_parse_peek_id_length_push (parse, &id, &length, &needed);
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED))
GST_DEBUG_OBJECT (parse, "clearing segment state");
/* clear current segment leftover */
- gst_adapter_clear (parse->adapter);
+ gst_adapter_clear (parse->common.adapter);
/* and some streaming setup */
parse->common.offset = start;
/* do not know where we are;
}
case GST_EVENT_FLUSH_STOP:
{
- gst_adapter_clear (parse->adapter);
+ gst_adapter_clear (parse->common.adapter);
GST_OBJECT_LOCK (parse);
gst_matroska_parse_reset_streams (parse, GST_CLOCK_TIME_NONE, TRUE);
GST_OBJECT_UNLOCK (parse);
#define __GST_MATROSKA_PARSE_H__
#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
#include "ebml-read.h"
#include "matroska-ids.h"
guint64 first_cluster_offset;
guint64 next_cluster_offset;
- /* push based mode usual suspects */
- GstAdapter *adapter;
/* index stuff */
gboolean seekable;
gboolean building_index;
return ret;
}
+const guint8 *
+gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon * common, guint
+ peek)
+{
+ return gst_adapter_peek (common->adapter, peek);
+}
+
/*
* Calls pull_range for (offset,size) without advancing our offset
*/
#include <glib.h>
#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
#include "matroska-ids.h"
/* push and pull mode */
guint64 offset;
+
+ /* push based mode usual suspects */
+ GstAdapter *adapter;
} GstMatroskaReadCommon;
GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
common, GstEbmlRead * ebml);
GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
common, GstEbmlRead * ebml, const gchar * parent_name, guint id);
+const guint8 * gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon *
+ common, guint peek);
GstFlowReturn gst_matroska_read_common_peek_bytes (GstMatroskaReadCommon *
common, guint64 offset, guint size, GstBuffer ** p_buf, guint8 ** bytes);
const guint8 * gst_matroska_read_common_peek_pull (GstMatroskaReadCommon *