Blame ext/ogg/gstoggmux.h

Packit 0652a1
/* OGG muxer plugin for GStreamer
Packit 0652a1
 * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
Packit 0652a1
 * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
Packit 0652a1
 *
Packit 0652a1
 * This library is free software; you can redistribute it and/or
Packit 0652a1
 * modify it under the terms of the GNU Library General Public
Packit 0652a1
 * License as published by the Free Software Foundation; either
Packit 0652a1
 * version 2 of the License, or (at your option) any later version.
Packit 0652a1
 *
Packit 0652a1
 * This library is distributed in the hope that it will be useful,
Packit 0652a1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0652a1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 0652a1
 * Library General Public License for more details.
Packit 0652a1
 *
Packit 0652a1
 * You should have received a copy of the GNU Library General Public
Packit 0652a1
 * License along with this library; if not, write to the
Packit 0652a1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 0652a1
 * Boston, MA 02110-1301, USA.
Packit 0652a1
 */
Packit 0652a1
Packit 0652a1
#ifndef __GST_OGG_MUX_H__
Packit 0652a1
#define __GST_OGG_MUX_H__
Packit 0652a1
Packit 0652a1
#include <ogg/ogg.h>
Packit 0652a1
Packit 0652a1
#include <gst/gst.h>
Packit 0652a1
#include <gst/base/gstcollectpads.h>
Packit 0652a1
#include "gstoggstream.h"
Packit 0652a1
Packit 0652a1
G_BEGIN_DECLS
Packit 0652a1
Packit 0652a1
#define GST_TYPE_OGG_MUX (gst_ogg_mux_get_type())
Packit 0652a1
#define GST_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_MUX, GstOggMux))
Packit 0652a1
#define GST_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_MUX, GstOggMux))
Packit 0652a1
#define GST_IS_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_MUX))
Packit 0652a1
#define GST_IS_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_MUX))
Packit 0652a1
Packit 0652a1
typedef struct _GstOggMux GstOggMux;
Packit 0652a1
typedef struct _GstOggMuxClass GstOggMuxClass;
Packit 0652a1
Packit 0652a1
typedef enum
Packit 0652a1
{
Packit 0652a1
  GST_OGG_PAD_STATE_CONTROL = 0,
Packit 0652a1
  GST_OGG_PAD_STATE_DATA = 1
Packit 0652a1
}
Packit 0652a1
GstOggPadState;
Packit 0652a1
Packit 0652a1
/* all information needed for one ogg stream */
Packit 0652a1
typedef struct
Packit 0652a1
{
Packit 0652a1
  GstCollectData collect;       /* we extend the CollectData */
Packit 0652a1
Packit 0652a1
  GstOggStream map;
Packit 0652a1
  gboolean have_type;
Packit 0652a1
Packit 0652a1
  GstSegment segment;
Packit 0652a1
Packit 0652a1
  GstBuffer *buffer;            /* the first waiting buffer for the pad */
Packit 0652a1
Packit 0652a1
  gint64 packetno;              /* number of next packet */
Packit 0652a1
  gint64 pageno;                /* number of next page */
Packit 0652a1
  guint64 duration;             /* duration of current page */
Packit 0652a1
  gboolean eos;
Packit 0652a1
  gint64 offset;
Packit 0652a1
  GstClockTime timestamp;       /* timestamp of the first packet on the next
Packit 0652a1
                                 * page to be dequeued */
Packit 0652a1
  GstClockTime timestamp_end;   /* end timestamp of last complete packet on
Packit 0652a1
                                   the next page to be dequeued */
Packit 0652a1
  GstClockTime gp_time;         /* time corresponding to the gp value of the
Packit 0652a1
                                   last complete packet on the next page to be
Packit 0652a1
                                   dequeued */
Packit 0652a1
Packit 0652a1
  GstOggPadState state;         /* state of the pad */
Packit 0652a1
Packit 0652a1
  GQueue *pagebuffers;          /* List of pages in buffers ready for pushing */
Packit 0652a1
Packit 0652a1
  gboolean new_page;            /* starting a new page */
Packit 0652a1
  gboolean first_delta;         /* was the first packet in the page a delta */
Packit 0652a1
  gboolean prev_delta;          /* was the previous buffer a delta frame */
Packit 0652a1
  gboolean data_pushed;         /* whether we pushed data already */
Packit 0652a1
Packit 0652a1
  gint64  next_granule;         /* expected granule of next buffer ts */
Packit 0652a1
  gint64  keyframe_granule;     /* granule of last preceding keyframe */
Packit 0652a1
Packit 0652a1
  GstTagList *tags;
Packit 0652a1
}
Packit 0652a1
GstOggPadData;
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GstOggMux:
Packit 0652a1
 *
Packit 0652a1
 * The ogg muxer object structure.
Packit 0652a1
 */
Packit 0652a1
struct _GstOggMux
Packit 0652a1
{
Packit 0652a1
  GstElement element;
Packit 0652a1
Packit 0652a1
  /* source pad */
Packit 0652a1
  GstPad *srcpad;
Packit 0652a1
Packit 0652a1
  /* sinkpads */
Packit 0652a1
  GstCollectPads *collect;
Packit 0652a1
Packit 0652a1
  /* number of pads which have not received EOS */
Packit 0652a1
  gint active_pads;
Packit 0652a1
Packit 0652a1
  /* the pad we are currently using to fill a page */
Packit 0652a1
  GstOggPadData *pulling;
Packit 0652a1
Packit 0652a1
  /* next timestamp for the page */
Packit 0652a1
  GstClockTime next_ts;
Packit 0652a1
Packit 0652a1
  /* Last timestamp actually output on src pad */
Packit 0652a1
  GstClockTime last_ts;
Packit 0652a1
Packit 0652a1
  /* offset in stream */
Packit 0652a1
  guint64 offset;
Packit 0652a1
Packit 0652a1
  /* need_headers */
Packit 0652a1
  gboolean need_headers;
Packit 0652a1
  gboolean need_start_events;
Packit 0652a1
Packit 0652a1
  guint64 max_delay;
Packit 0652a1
  guint64 max_page_delay;
Packit 0652a1
  guint64 max_tolerance;
Packit 0652a1
Packit 0652a1
  GstOggPadData *delta_pad;     /* when a delta frame is detected on a stream, we mark
Packit 0652a1
                                   pages as delta frames up to the page that has the
Packit 0652a1
                                   keyframe */
Packit 0652a1
Packit 0652a1
Packit 0652a1
  /* whether to create a skeleton track */
Packit 0652a1
  gboolean use_skeleton;
Packit 0652a1
};
Packit 0652a1
Packit 0652a1
struct _GstOggMuxClass
Packit 0652a1
{
Packit 0652a1
  GstElementClass parent_class;
Packit 0652a1
};
Packit 0652a1
Packit 0652a1
GType gst_ogg_mux_get_type (void);
Packit 0652a1
Packit 0652a1
gboolean gst_ogg_mux_plugin_init (GstPlugin * plugin);
Packit 0652a1
Packit 0652a1
G_END_DECLS
Packit 0652a1
Packit 0652a1
#endif /* __GST_OGG_MUX_H__ */