2009-07-24 17:52:28 +00:00
|
|
|
/* 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
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-07-24 17:52:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GST_ASF_MUX_H__
|
|
|
|
#define __GST_ASF_MUX_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2012-04-17 13:22:59 +00:00
|
|
|
#include <gst/base/gstcollectpads.h>
|
2009-07-24 17:52:28 +00:00
|
|
|
#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_HEADERS,
|
|
|
|
GST_ASF_MUX_STATE_DATA,
|
|
|
|
GST_ASF_MUX_STATE_EOS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstAsfPad
|
|
|
|
{
|
2012-04-17 13:22:59 +00:00
|
|
|
GstCollectData collect;
|
2009-07-24 17:52:28 +00:00
|
|
|
|
|
|
|
gboolean is_audio;
|
|
|
|
guint8 stream_number;
|
|
|
|
guint8 media_object_number;
|
|
|
|
guint32 bitrate;
|
|
|
|
|
|
|
|
GstClockTime play_duration;
|
2009-11-17 20:25:14 +00:00
|
|
|
GstClockTime first_ts;
|
2009-07-24 17:52:28 +00:00
|
|
|
|
|
|
|
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;
|
2010-01-21 13:51:16 +00:00
|
|
|
guint32 payload_parsing_info_size;
|
2009-07-24 17:52:28 +00:00
|
|
|
GSList *payloads;
|
|
|
|
|
|
|
|
Guid file_id;
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
guint32 prop_packet_size;
|
|
|
|
guint64 prop_preroll;
|
|
|
|
gboolean prop_merge_stream_tags;
|
|
|
|
guint64 prop_padding;
|
2010-06-08 17:33:56 +00:00
|
|
|
gboolean prop_streamable;
|
2009-07-24 17:52:28 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2009-11-17 20:25:14 +00:00
|
|
|
GstClockTime first_ts;
|
|
|
|
|
2009-07-24 17:52:28 +00:00
|
|
|
/* pads */
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
2012-04-17 13:22:59 +00:00
|
|
|
GstCollectPads *collect;
|
2009-07-24 17:52:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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__ */
|