mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
- Added flags to lookup method so that one can search for keyframes too
Original commit message from CVS: - Added flags to lookup method so that one can search for keyframes too - Updated memindex
This commit is contained in:
parent
2694db659d
commit
fb9970d85a
4 changed files with 60 additions and 11 deletions
|
@ -557,12 +557,12 @@ gst_index_compare_func (gconstpointer a,
|
|||
*/
|
||||
GstIndexEntry*
|
||||
gst_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_INDEX (index), NULL);
|
||||
|
||||
return gst_index_get_assoc_entry_full (index, id, method, format, value,
|
||||
return gst_index_get_assoc_entry_full (index, id, method, flags, format, value,
|
||||
gst_index_compare_func, NULL);
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,7 @@ gst_index_get_assoc_entry (GstIndex *index, gint id,
|
|||
*/
|
||||
GstIndexEntry*
|
||||
gst_index_get_assoc_entry_full (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data)
|
||||
|
@ -596,7 +596,7 @@ gst_index_get_assoc_entry_full (GstIndex *index, gint id,
|
|||
iclass = GST_INDEX_GET_CLASS (index);
|
||||
|
||||
if (iclass->get_assoc_entry)
|
||||
return iclass->get_assoc_entry (index, id, method, format, value, func, user_data);
|
||||
return iclass->get_assoc_entry (index, id, method, flags, format, value, func, user_data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ struct _GstIndexAssociation {
|
|||
typedef enum {
|
||||
GST_ACCOCIATION_FLAG_NONE = 0,
|
||||
GST_ACCOCIATION_FLAG_KEY_UNIT = (1 << 0),
|
||||
|
||||
/* new flags should start here */
|
||||
GST_ACCOCIATION_FLAG_LAST = (1 << 8),
|
||||
} GstAssocFlags;
|
||||
|
||||
#define GST_INDEX_FORMAT_FORMAT(entry) ((entry)->data.format.format)
|
||||
|
@ -172,7 +175,7 @@ struct _GstIndexClass {
|
|||
void (*add_entry) (GstIndex *index, GstIndexEntry *entry);
|
||||
|
||||
GstIndexEntry* (*get_assoc_entry) (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data);
|
||||
|
@ -210,10 +213,10 @@ GstIndexEntry* gst_index_add_id (GstIndex *index, gint id,
|
|||
gchar *description);
|
||||
|
||||
GstIndexEntry* gst_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value);
|
||||
GstIndexEntry* gst_index_get_assoc_entry_full (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data);
|
||||
|
|
|
@ -106,7 +106,7 @@ static void gst_mem_index_dispose (GObject *object);
|
|||
|
||||
static void gst_mem_index_add_entry (GstIndex *index, GstIndexEntry *entry);
|
||||
static GstIndexEntry* gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data);
|
||||
|
@ -332,7 +332,8 @@ mem_index_search (gconstpointer a,
|
|||
|
||||
static GstIndexEntry*
|
||||
gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method,
|
||||
GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data)
|
||||
|
@ -375,6 +376,28 @@ gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
|||
}
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
if ((GST_INDEX_ASSOC_FLAGS (entry) & flags) != flags) {
|
||||
GList *l_entry = g_list_find (memindex->associations, entry);
|
||||
|
||||
entry = NULL;
|
||||
|
||||
while (l_entry) {
|
||||
entry = (GstIndexEntry *) l_entry->data;
|
||||
|
||||
if (entry->id == id &&
|
||||
(GST_INDEX_ASSOC_FLAGS (entry) & flags) == flags)
|
||||
break;
|
||||
|
||||
if (method == GST_INDEX_LOOKUP_BEFORE)
|
||||
l_entry = g_list_next (l_entry);
|
||||
else if (method == GST_INDEX_LOOKUP_AFTER) {
|
||||
l_entry = g_list_previous (l_entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static void gst_mem_index_dispose (GObject *object);
|
|||
|
||||
static void gst_mem_index_add_entry (GstIndex *index, GstIndexEntry *entry);
|
||||
static GstIndexEntry* gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method, GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data);
|
||||
|
@ -332,7 +332,8 @@ mem_index_search (gconstpointer a,
|
|||
|
||||
static GstIndexEntry*
|
||||
gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
||||
GstIndexLookupMethod method,
|
||||
GstIndexLookupMethod method,
|
||||
GstAssocFlags flags,
|
||||
GstFormat format, gint64 value,
|
||||
GCompareDataFunc func,
|
||||
gpointer user_data)
|
||||
|
@ -375,6 +376,28 @@ gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
|
|||
}
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
if ((GST_INDEX_ASSOC_FLAGS (entry) & flags) != flags) {
|
||||
GList *l_entry = g_list_find (memindex->associations, entry);
|
||||
|
||||
entry = NULL;
|
||||
|
||||
while (l_entry) {
|
||||
entry = (GstIndexEntry *) l_entry->data;
|
||||
|
||||
if (entry->id == id &&
|
||||
(GST_INDEX_ASSOC_FLAGS (entry) & flags) == flags)
|
||||
break;
|
||||
|
||||
if (method == GST_INDEX_LOOKUP_BEFORE)
|
||||
l_entry = g_list_next (l_entry);
|
||||
else if (method == GST_INDEX_LOOKUP_AFTER) {
|
||||
l_entry = g_list_previous (l_entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue