mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
toc: Fix gst_toc_find_entry()
Recursive search for the required entry, instead of returning the top-level entry that contains an entry with the search UID.
This commit is contained in:
parent
042d1ff398
commit
be38fbba5e
1 changed files with 25 additions and 13 deletions
38
gst/gsttoc.c
38
gst/gsttoc.c
|
@ -283,25 +283,30 @@ gst_toc_entry_free (GstTocEntry * entry)
|
||||||
g_slice_free (GstTocEntry, entry);
|
g_slice_free (GstTocEntry, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstTocEntry *
|
||||||
gst_toc_check_entry_for_uid (const GstTocEntry * entry, const gchar * uid)
|
gst_toc_entry_find_sub_entry (const GstTocEntry * entry, const gchar * uid)
|
||||||
{
|
{
|
||||||
GList *cur;
|
GList *cur;
|
||||||
|
GstTocEntry *subentry, *subsubentry;
|
||||||
|
|
||||||
g_return_val_if_fail (entry != NULL, FALSE);
|
g_return_val_if_fail (entry != NULL, NULL);
|
||||||
g_return_val_if_fail (uid != NULL, FALSE);
|
g_return_val_if_fail (uid != NULL, NULL);
|
||||||
|
|
||||||
if (g_strcmp0 (entry->uid, uid) == 0)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
cur = entry->subentries;
|
cur = entry->subentries;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (gst_toc_check_entry_for_uid (cur->data, uid))
|
subentry = cur->data;
|
||||||
return TRUE;
|
|
||||||
|
if (g_strcmp0 (subentry->uid, uid) == 0)
|
||||||
|
return subentry;
|
||||||
|
|
||||||
|
subsubentry = gst_toc_entry_find_sub_entry (subentry, uid);
|
||||||
|
if (subsubentry != NULL)
|
||||||
|
return subsubentry;
|
||||||
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -311,20 +316,27 @@ gst_toc_check_entry_for_uid (const GstTocEntry * entry, const gchar * uid)
|
||||||
*
|
*
|
||||||
* Find #GstTocEntry with given @uid in the @toc.
|
* Find #GstTocEntry with given @uid in the @toc.
|
||||||
*
|
*
|
||||||
* Returns: #GstTocEntry with specified @uid from the @toc, or NULL if not found.
|
* Returns: (transfer none): #GstTocEntry with specified @uid from the @toc, or NULL if not found.
|
||||||
*/
|
*/
|
||||||
GstTocEntry *
|
GstTocEntry *
|
||||||
gst_toc_find_entry (const GstToc * toc, const gchar * uid)
|
gst_toc_find_entry (const GstToc * toc, const gchar * uid)
|
||||||
{
|
{
|
||||||
GList *cur;
|
GList *cur;
|
||||||
|
GstTocEntry *entry, *subentry;
|
||||||
|
|
||||||
g_return_val_if_fail (toc != NULL, NULL);
|
g_return_val_if_fail (toc != NULL, NULL);
|
||||||
g_return_val_if_fail (uid != NULL, NULL);
|
g_return_val_if_fail (uid != NULL, NULL);
|
||||||
|
|
||||||
cur = toc->entries;
|
cur = toc->entries;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (gst_toc_check_entry_for_uid (cur->data, uid))
|
entry = cur->data;
|
||||||
return cur->data;
|
|
||||||
|
if (g_strcmp0 (entry->uid, uid) == 0)
|
||||||
|
return entry;
|
||||||
|
|
||||||
|
subentry = gst_toc_entry_find_sub_entry (entry, uid);
|
||||||
|
if (subentry != NULL)
|
||||||
|
return subentry;
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue