videoutils: remove adapter methods

Remove adapter methods now that they are in core.
This commit is contained in:
Wim Taymans 2009-05-20 00:48:40 +02:00 committed by Wim Taymans
parent 1c01a01dbf
commit 243d366b34
2 changed files with 0 additions and 109 deletions

View file

@ -161,113 +161,6 @@ gst_video_state_get_timestamp (const GstVideoState * state, int frame_number)
} }
} }
/* gst adapter */
static GSList *
get_chunk (GstAdapter * adapter, int offset, int *skip)
{
GSList *g;
#if 1
if (skip)
*skip = 0;
#endif
g_return_val_if_fail (offset >= 0, NULL);
g_return_val_if_fail (offset < adapter->size, NULL);
offset += adapter->skip;
g = adapter->buflist;
while (g) {
if (offset < GST_BUFFER_SIZE (GST_BUFFER (g->data))) {
if (skip)
*skip = offset;
return g;
}
offset -= GST_BUFFER_SIZE (GST_BUFFER (g->data));
g = g->next;
}
g_assert_not_reached ();
}
static int
scan_fast (guint8 * data, guint32 pattern, guint32 mask, int n)
{
int i;
pattern &= mask;
for (i = 0; i < n; i++) {
if ((GST_READ_UINT32_BE (data + i) & mask) == pattern) {
return i;
}
}
return n;
}
static gboolean
scan_slow (GstAdapter * adapter, GSList * g, int skip, guint32 pattern,
guint32 mask)
{
guint8 tmp[4];
int j;
pattern &= mask;
for (j = 0; j < 4; j++) {
tmp[j] = ((guint8 *) GST_BUFFER_DATA (GST_BUFFER (g->data)))[skip];
skip++;
if (skip >= GST_BUFFER_SIZE (GST_BUFFER (g->data))) {
g = g->next;
skip = 0;
}
}
return ((GST_READ_UINT32_BE (tmp) & mask) == pattern);
}
int
gst_adapter_masked_scan_uint32 (GstAdapter * adapter,
guint32 pattern, guint32 mask, int offset, int n)
{
GSList *g;
int j;
int k;
int skip;
int m;
g_return_val_if_fail (n >= 0, 0);
g_return_val_if_fail (offset >= 0, 0);
g_return_val_if_fail (offset + n + 4 <= adapter->size, 0);
g = get_chunk (adapter, offset, &skip);
j = 0;
while (j < n) {
m = MIN (GST_BUFFER_SIZE (GST_BUFFER (g->data)) - skip - 4, 0);
if (m > 0) {
k = scan_fast (GST_BUFFER_DATA (GST_BUFFER (g->data)) + skip,
pattern, mask, m);
if (k < m) {
return offset + j + k;
}
j += m;
skip += m;
} else {
if (scan_slow (adapter, g, skip, pattern, mask)) {
return offset + j;
}
j++;
skip++;
}
if (skip >= GST_BUFFER_SIZE (GST_BUFFER (g->data))) {
g = g->next;
skip = 0;
}
}
return n;
}
GstBuffer * GstBuffer *
gst_adapter_get_buffer (GstAdapter * adapter) gst_adapter_get_buffer (GstAdapter * adapter)
{ {

View file

@ -84,8 +84,6 @@ gboolean gst_base_video_state_from_caps (GstVideoState *state,
GstClockTime gst_video_state_get_timestamp (const GstVideoState *state, GstClockTime gst_video_state_get_timestamp (const GstVideoState *state,
int frame_number); int frame_number);
int gst_adapter_masked_scan_uint32 (GstAdapter *adapter,
guint32 pattern, guint32 mask, int offset, int n);
GstBuffer *gst_adapter_get_buffer (GstAdapter *adapter); GstBuffer *gst_adapter_get_buffer (GstAdapter *adapter);
G_END_DECLS G_END_DECLS