2009-08-29 17:51:48 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2009 David Schleef <ds@schleef.org>
|
|
|
|
*
|
|
|
|
* gstoggstream.h: header for GstOggStream
|
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-08-29 17:51:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_OGG_STREAM_H__
|
|
|
|
#define __GST_OGG_STREAM_H__
|
|
|
|
|
|
|
|
#include <ogg/ogg.h>
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2010-09-14 20:08:51 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2010-03-02 10:16:39 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_OGG_SKELETON_FISBONE,
|
|
|
|
GST_OGG_SKELETON_INDEX,
|
|
|
|
} GstOggSkeleton;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint64 offset;
|
|
|
|
guint64 timestamp;
|
|
|
|
} GstOggIndex;
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
typedef struct _GstOggStream GstOggStream;
|
|
|
|
|
|
|
|
struct _GstOggStream
|
|
|
|
{
|
|
|
|
ogg_stream_state stream;
|
|
|
|
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serialno;
|
2009-08-29 17:51:48 +00:00
|
|
|
GList *headers;
|
2010-01-08 15:57:40 +00:00
|
|
|
gboolean have_headers;
|
|
|
|
GList *queued;
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
/* for oggparse */
|
|
|
|
gboolean in_headers;
|
|
|
|
GList *unknown_pages;
|
2011-02-04 06:41:23 +00:00
|
|
|
GList *stored_buffers;
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
gint map;
|
|
|
|
gboolean is_skeleton;
|
|
|
|
gboolean have_fisbone;
|
|
|
|
gint granulerate_n;
|
|
|
|
gint granulerate_d;
|
2011-11-21 17:03:21 +00:00
|
|
|
gint64 granule_offset;
|
2009-08-29 17:51:48 +00:00
|
|
|
guint32 preroll;
|
|
|
|
guint granuleshift;
|
|
|
|
gint n_header_packets;
|
|
|
|
gint n_header_packets_seen;
|
|
|
|
gint64 accumulated_granule;
|
|
|
|
gint frame_size;
|
2010-04-30 15:41:05 +00:00
|
|
|
gint bitrate;
|
2010-05-04 11:02:19 +00:00
|
|
|
guint64 total_time;
|
2010-10-10 22:17:31 +00:00
|
|
|
gboolean is_sparse;
|
2012-06-06 16:41:55 +00:00
|
|
|
gboolean forbid_start_clamping;
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
GstCaps *caps;
|
2010-03-02 10:16:39 +00:00
|
|
|
|
2010-11-21 03:02:50 +00:00
|
|
|
gboolean is_video;
|
2011-08-17 17:48:54 +00:00
|
|
|
gboolean always_flush_page;
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
/* vorbis stuff */
|
|
|
|
int nln_increments[4];
|
|
|
|
int nsn_increment;
|
|
|
|
int short_size;
|
|
|
|
int long_size;
|
|
|
|
int vorbis_log2_num_modes;
|
|
|
|
int vorbis_mode_sizes[256];
|
2009-11-25 05:22:03 +00:00
|
|
|
int last_size;
|
2010-09-14 20:08:51 +00:00
|
|
|
int version;
|
2010-10-27 08:59:03 +00:00
|
|
|
gint bitrate_upper;
|
|
|
|
gint bitrate_nominal;
|
|
|
|
gint bitrate_lower;
|
2010-09-14 20:08:51 +00:00
|
|
|
GstTagList *taglist;
|
2009-11-26 01:04:41 +00:00
|
|
|
/* theora stuff */
|
|
|
|
gboolean theora_has_zero_keyoffset;
|
2010-05-05 11:59:57 +00:00
|
|
|
/* VP8 stuff */
|
|
|
|
gboolean is_vp8;
|
2012-06-06 10:01:13 +00:00
|
|
|
/* opus stuff */
|
|
|
|
gint64 first_granpos;
|
2009-12-04 04:05:29 +00:00
|
|
|
/* OGM stuff */
|
|
|
|
gboolean is_ogm;
|
|
|
|
gboolean is_ogm_text;
|
2012-05-12 13:36:09 +00:00
|
|
|
/* CMML */
|
|
|
|
gboolean is_cmml;
|
2010-03-01 12:50:32 +00:00
|
|
|
/* fishead stuff */
|
2010-06-08 09:31:35 +00:00
|
|
|
guint16 skeleton_major, skeleton_minor;
|
2010-03-01 12:50:32 +00:00
|
|
|
gint64 prestime;
|
|
|
|
gint64 basetime;
|
2010-03-02 10:16:39 +00:00
|
|
|
/* index */
|
|
|
|
guint n_index;
|
|
|
|
GstOggIndex *index;
|
|
|
|
guint64 kp_denom;
|
2010-05-06 08:56:21 +00:00
|
|
|
guint64 idx_bitrate;
|
2009-08-29 17:51:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
gboolean gst_ogg_stream_setup_map (GstOggStream * pad, ogg_packet *packet);
|
2011-04-15 12:36:39 +00:00
|
|
|
gboolean gst_ogg_stream_setup_map_from_caps_headers (GstOggStream * pad,
|
|
|
|
const GstCaps * caps);
|
2009-08-29 17:51:48 +00:00
|
|
|
GstClockTime gst_ogg_stream_get_end_time_for_granulepos (GstOggStream *pad,
|
|
|
|
gint64 granulepos);
|
|
|
|
GstClockTime gst_ogg_stream_get_start_time_for_granulepos (GstOggStream *pad,
|
|
|
|
gint64 granulepos);
|
|
|
|
GstClockTime gst_ogg_stream_granule_to_time (GstOggStream *pad, gint64 granule);
|
|
|
|
gint64 gst_ogg_stream_granulepos_to_granule (GstOggStream * pad, gint64 granulepos);
|
2009-11-25 06:08:09 +00:00
|
|
|
gint64 gst_ogg_stream_granulepos_to_key_granule (GstOggStream * pad, gint64 granulepos);
|
2009-11-25 05:22:03 +00:00
|
|
|
gint64 gst_ogg_stream_granule_to_granulepos (GstOggStream * pad, gint64 granule, gint64 keyframe_granule);
|
2009-08-29 17:51:48 +00:00
|
|
|
GstClockTime gst_ogg_stream_get_packet_start_time (GstOggStream *pad,
|
|
|
|
ogg_packet *packet);
|
|
|
|
gboolean gst_ogg_stream_granulepos_is_key_frame (GstOggStream *pad,
|
|
|
|
gint64 granulepos);
|
|
|
|
gboolean gst_ogg_stream_packet_is_header (GstOggStream *pad, ogg_packet *packet);
|
2012-02-01 15:28:45 +00:00
|
|
|
gboolean gst_ogg_stream_packet_is_key_frame (GstOggStream *pad, ogg_packet *packet);
|
2009-08-29 17:51:48 +00:00
|
|
|
gint64 gst_ogg_stream_get_packet_duration (GstOggStream * pad, ogg_packet *packet);
|
2010-10-27 10:08:25 +00:00
|
|
|
void gst_ogg_stream_extract_tags (GstOggStream * pad, ogg_packet * packet);
|
2011-08-17 18:40:08 +00:00
|
|
|
const char *gst_ogg_stream_get_media_type (GstOggStream * pad);
|
2009-08-29 17:51:48 +00:00
|
|
|
|
2010-03-01 12:50:32 +00:00
|
|
|
gboolean gst_ogg_map_parse_fisbone (GstOggStream * pad, const guint8 * data, guint size,
|
2010-03-02 10:16:39 +00:00
|
|
|
guint32 * serialno, GstOggSkeleton *type);
|
2010-06-08 10:01:15 +00:00
|
|
|
gboolean gst_ogg_map_add_fisbone (GstOggStream * pad, GstOggStream * skel_pad, const guint8 * data, guint size,
|
2010-03-01 12:50:32 +00:00
|
|
|
GstClockTime * p_start_time);
|
2010-06-08 10:01:15 +00:00
|
|
|
gboolean gst_ogg_map_add_index (GstOggStream * pad, GstOggStream * skel_pad, const guint8 * data, guint size);
|
2010-03-02 10:16:39 +00:00
|
|
|
gboolean gst_ogg_map_search_index (GstOggStream * pad, gboolean before, guint64 *timestamp, guint64 *offset);
|
|
|
|
|
|
|
|
|
2010-03-01 12:50:32 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_OGG_STREAM_H__ */
|