summaryrefslogtreecommitdiff
path: root/gst-libs/gst/media-info/media-info-priv.h
blob: 0a7aa5009de47d10e609dd4009267cd4136566c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 *
 * 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.
 */

/* media-info-priv.h: private stuff */

#ifndef __GST_MEDIA_INFO_PRIV_H__
#define __GST_MEDIA_INFO_PRIV_H__

#include <gst/gst.h>

/* debug */
#define DEBUG
#ifdef DEBUG
static gboolean _gmi_debug = TRUE;
#else
static gboolean _gmi_debug = FALSE;
#endif

#ifdef G_HAVE_ISO_VARARGS

#define GMI_DEBUG(...) \
  { if (_gmi_debug) { g_print ( __VA_ARGS__ ); }}

#elif defined(G_HAVE_GNUC_VARARGS)

#define GMI_DEBUG(format, args...) \
  { if (_gmi_debug) { g_print ( format , ## args ); }}

#endif


/* state machine enum; FIXME: can we move this to priv.c ? */
typedef enum
{
  GST_MEDIA_INFO_STATE_NULL,
  GST_MEDIA_INFO_STATE_TYPEFIND,
  GST_MEDIA_INFO_STATE_STREAM,
  GST_MEDIA_INFO_STATE_METADATA,
  GST_MEDIA_INFO_STATE_STREAMINFO,
  GST_MEDIA_INFO_STATE_FORMAT,
  GST_MEDIA_INFO_STATE_DONE
} GstMediaInfoState;

/* private structure */
struct GstMediaInfoPriv
{
  GstElement *pipeline;

  GstElement *typefind;

  GstCaps *type;
  GstPad *decoder_pad;                  /* pad for querying decoded caps */
  GstPad *source_pad;                   /* pad for querying encoded caps */

  GstCaps *format;
  GstCaps *metadata;
  gint metadata_iters;
  GstCaps *streaminfo;

  GstElement *decoder;                  /* will be != NULL during collection */
  gchar *source_element;                /* type of element used as source */
  GstElement *source;

  GHashTable *decoders;                 /* a table of decoder GstElements */

  GstMediaInfoState state;              /* current state of state machine */
  gchar *location;                      /* location set on the info object */
  guint16 flags;                        /* flags supplied for detection */
  GstMediaInfoTrack *current_track;     /* track pointer under inspection */
  glong current_track_num;              /* current track under inspection */

  GstMediaInfoStream *stream;           /* total stream properties */
  char *cache;                          /* location of cache */
};

/* declarations */
GstMediaInfoStream *
		gmi_stream_new			(void);
void		gmi_stream_free			(GstMediaInfoStream *stream);

GstMediaInfoTrack *
		gmi_track_new			(void);

void		gmi_reset			(GstMediaInfo *info);
gboolean	gmi_seek_to_track		(GstMediaInfo *info,
		                                 long track);

GstElement *	gmi_get_decoder			(GstMediaInfo *info,
		                                 const char *mime);
void		gmi_set_decoder			(GstMediaInfo *info,
		                                 GstElement *decoder);
void		gmi_clear_decoder		(GstMediaInfo *info);

void		deep_notify_callback            (GObject *object,
		                                 GstObject *origin,
						 GParamSpec *pspec,
						 GstMediaInfoPriv *priv);

gboolean	gmip_find_type_pre		(GstMediaInfoPriv *priv);
gboolean	gmip_find_type_post		(GstMediaInfoPriv *priv);
gboolean	gmip_find_type			(GstMediaInfoPriv *priv);
gboolean	gmip_find_stream_pre		(GstMediaInfoPriv *priv);
gboolean	gmip_find_stream_post		(GstMediaInfoPriv *priv);
gboolean	gmip_find_stream			(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_metadata_pre	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_metadata_post	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_metadata		(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_streaminfo_pre	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_streaminfo_post	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_streaminfo	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_format_pre	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_format_post	(GstMediaInfoPriv *priv);
gboolean	gmip_find_track_format		(GstMediaInfoPriv *priv);

#endif /* __GST_MEDIA_INFO_PRIV_H__ */