Add generic table of contents (TOC) support

This commit is contained in:
Alexander Saprykin 2012-03-14 20:01:51 +04:00 committed by Stefan Sauer
parent 9441e711df
commit 63256d271d
6 changed files with 1139 additions and 0 deletions

View file

@ -98,6 +98,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gsttagsetter.c \
gsttask.c \
gsttaskpool.c \
gsttoc.c \
$(GST_TRACE_SRC) \
gsttypefind.c \
gsttypefindfactory.c \
@ -188,6 +189,7 @@ gst_headers = \
gsttagsetter.h \
gsttask.h \
gsttaskpool.h \
gsttoc.h \
gsttrace.h \
gsttypefind.h \
gsttypefindfactory.h \

View file

@ -767,6 +767,7 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
gst_buffer_list_iterator_get_type ();
_gst_message_initialize ();
_gst_tag_initialize ();
_gst_toc_initialize ();
gst_parse_context_get_type ();
_gst_plugin_initialize ();

View file

@ -68,6 +68,7 @@
#include <gst/gsttagsetter.h>
#include <gst/gsttask.h>
#include <gst/gsttaskpool.h>
#include <gst/gsttoc.h>
#include <gst/gsttrace.h>
#include <gst/gsttypefind.h>
#include <gst/gsttypefindfactory.h>

View file

@ -54,6 +54,9 @@ extern const char g_log_domain_gstreamer[];
/* for GstElement */
#include "gstelement.h"
/* for GstToc */
#include "gsttoc.h"
G_BEGIN_DECLS
/* used by gstparse.c and grammar.y */
@ -109,6 +112,17 @@ void _gst_query_initialize (void);
void _gst_tag_initialize (void);
void _gst_value_initialize (void);
void _gst_toc_initialize (void);
/* TOC functions */
/* These functions are used to parse TOC messages, events and queries */
GstToc* _gst_toc_from_structure (const GstStructure *toc);
GstStructure* _gst_toc_to_structure (const GstToc *toc);
gboolean _gst_toc_structure_get_updated (const GstStructure * toc);
void _gst_toc_structure_set_updated (GstStructure * toc, gboolean updated);
gchar* _gst_toc_structure_get_extend_uid (const GstStructure * toc);
void _gst_toc_structure_set_extend_uid (GstStructure * toc, const gchar * extend_uid);
/* Private registry functions */
gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry);
void _priv_gst_registry_cleanup (void);

1010
gst/gsttoc.c Normal file

File diff suppressed because it is too large Load diff

111
gst/gsttoc.h Normal file
View file

@ -0,0 +1,111 @@
/* GStreamer
* (c) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
*
* gsttoc.h: generic TOC API declaration
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TOC_H__
#define __GST_TOC_H__
#include <gst/gstconfig.h>
#include <gst/gsttaglist.h>
#include <gst/gstformat.h>
G_BEGIN_DECLS
typedef struct _GstTocEntry GstTocEntry;
typedef struct _GstToc GstToc;
/**
* GstTocEntryType:
* @GST_TOC_ENTRY_TYPE_CHAPTER: a chapter type entry.
* @GST_TOC_ENTRY_TYPE_EDITION: an edition entry (angle or alternative in other terms).
*
* The different types of TOC entry.
*/
typedef enum {
GST_TOC_ENTRY_TYPE_CHAPTER = 0,
GST_TOC_ENTRY_TYPE_EDITION = 1
} GstTocEntryType;
/**
* GstTocEntry:
* @uid: unique (for a whole TOC) id of the entry. This value should be persistent and
* should not be changed while updating TOC. @uid should be handled as "opaque" value
* without meaning (e.g. applications should not assume the /editionX/chapterY/chapter/Z structure,
* other demuxers could do something else), it should help to track updates of certain entries.
* @type: #GstTocEntryType of this entry.
* @subentries: list of #GstTocEntry children.
* @pads: list of #GstPad objects, related to this #GstTocEntry.
* @tags: tags related to this entry.
* @info: extra information related to this entry.
*
* Definition of TOC entry structure.
*/
struct _GstTocEntry {
gchar *uid;
GstTocEntryType type;
GList *subentries;
GList *pads;
GstTagList *tags;
GstStructure *info;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* FIXME: pad member should be GstPad type, but that's
* impossible due to recursive includes */
/**
* GstToc:
* @entries: list of #GstTocEntry entries of the TOC.
* @tags: tags related to the whole TOC.
* @info: extra information related to the TOC.
*
* Definition of TOC structure.
*/
struct _GstToc {
GList *entries;
GstTagList *tags;
GstStructure *info;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* functions to create new structures */
GstToc * gst_toc_new (void);
GstTocEntry * gst_toc_entry_new (GstTocEntryType type, const gchar *uid);
GstTocEntry * gst_toc_entry_new_with_pad (GstTocEntryType type, const gchar *uid, gpointer pad);
/* functions to free structures */
void gst_toc_entry_free (GstTocEntry *entry);
void gst_toc_free (GstToc *toc);
GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid);
GstTocEntry * gst_toc_entry_copy (const GstTocEntry *entry);
GstToc * gst_toc_copy (const GstToc *toc);
void gst_toc_entry_set_start_stop (GstTocEntry *entry, gint64 start, gint64 stop);
gboolean gst_toc_entry_get_start_stop (const GstTocEntry *entry, gint64 *start, gint64 *stop);
G_END_DECLS
#endif /* __GST_TOC_H__ */