gstreamer/gst/asfmux/gstasfmux.h
Thiago Santos 2641cd9d94 asfmux: Adds new plugin asfmux
Adds the brand new asfmux plugin, containing 3 elements:
asfmux, rtpasfpay and asfparse. This plugin was developed
as a GSoC 2009 project, with David Schleef as the mentor and
Thiago Santos as the student.
2009-07-24 14:52:28 -03:00

159 lines
3.8 KiB
C

/* ASF muxer plugin for GStreamer
* Copyright (C) 2009 Thiago Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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_ASF_MUX_H__
#define __GST_ASF_MUX_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include <gst/riff/riff-media.h>
#include "gstasfobjects.h"
G_BEGIN_DECLS
#define GST_TYPE_ASF_MUX \
(gst_asf_mux_get_type())
#define GST_ASF_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASF_MUX,GstAsfMux))
#define GST_ASF_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASF_MUX,GstAsfMuxClass))
#define GST_IS_ASF_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASF_MUX))
#define GST_IS_ASF_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASF_MUX))
#define GST_ASF_MUX_CAST(obj) ((GstAsfMux*)(obj))
typedef struct _GstAsfMux GstAsfMux;
typedef struct _GstAsfMuxClass GstAsfMuxClass;
typedef struct _GstAsfPad GstAsfPad;
typedef struct _GstAsfAudioPad GstAsfAudioPad;
typedef struct _GstAsfVideoPad GstAsfVideoPad;
typedef enum _GstAsfMuxState GstAsfMuxState;
enum _GstAsfMuxState
{
GST_ASF_MUX_STATE_NONE,
GST_ASF_MUX_STATE_STARTED,
GST_ASF_MUX_STATE_HEADERS,
GST_ASF_MUX_STATE_DATA,
GST_ASF_MUX_STATE_EOS
};
struct _GstAsfPad
{
GstCollectData collect;
gboolean is_audio;
guint8 stream_number;
guint8 media_object_number;
guint32 bitrate;
GstClockTime play_duration;
GstBuffer *codec_data;
/* stream only metadata */
GstTagList *taglist;
};
struct _GstAsfAudioPad
{
GstAsfPad pad;
gst_riff_strf_auds audioinfo;
};
struct _GstAsfVideoPad
{
GstAsfPad pad;
gst_riff_strf_vids vidinfo;
/* Simple Index Entries */
GSList *simple_index;
gboolean has_keyframe; /* if we have received one at least */
guint32 last_keyframe_packet;
guint16 last_keyframe_packet_count;
guint16 max_keyframe_packet_count;
GstClockTime next_index_time;
guint64 time_interval;
};
struct _GstAsfMux
{
GstElement element;
/* output stream state */
GstAsfMuxState state;
/* counter to assign stream numbers */
guint8 stream_number;
/* counting variables */
guint64 file_size;
guint64 data_object_size;
guint64 total_data_packets;
/*
* data object size field position
* needed for updating when finishing the file
*/
guint64 data_object_position;
guint64 file_properties_object_position;
/* payloads still to be sent in a packet */
guint32 payload_data_size;
GSList *payloads;
Guid file_id;
/* properties */
guint32 prop_packet_size;
guint64 prop_preroll;
gboolean prop_merge_stream_tags;
guint64 prop_padding;
gboolean prop_is_live;
/* same as properties, but those are stored here to be
* used without modification while muxing a single file */
guint32 packet_size;
guint64 preroll; /* milisecs */
gboolean merge_stream_tags;
/* pads */
GstPad *srcpad;
/* sinkpads, video first */
GSList *sinkpads;
GstCollectPads *collect;
GstPadEventFunction collect_event;
};
struct _GstAsfMuxClass
{
GstElementClass parent_class;
};
GType gst_asf_mux_get_type (void);
gboolean gst_asf_mux_plugin_init (GstPlugin * plugin);
G_END_DECLS
#endif /* __GST_ASF_MUX_H__ */