flv: flvmux ported to the GstAggregator

This makes it possible to create a flv file from a live source and not stop
when there are packet drops.

https://bugzilla.gnome.org/show_bug.cgi?id=782920
This commit is contained in:
Vincent Penquerc'h 2017-12-20 15:23:26 -05:00 committed by Olivier Crête
parent 6ea569841d
commit 8b814f6351
2 changed files with 446 additions and 391 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,9 @@
/* GStreamer
*
* Copyright (c) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (c) 2008,2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (c) 2008-2017 Collabora Ltd
* @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
* @author: Vincent Penquerc'h <vincent.penquerch@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -22,14 +25,25 @@
#define __GST_FLV_MUX_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include <gst/base/gstaggregator.h>
G_BEGIN_DECLS
#define GST_TYPE_FLV_MUX_PAD (gst_flv_mux_pad_get_type())
#define GST_FLV_MUX_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLV_MUX_PAD, GstFlvMuxPad))
#define GST_FLV_MUX_PAD_CAST(obj) ((GstFlvMuxPad *)(obj))
#define GST_FLV_MUX_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLV_MUX_PAD, GstFlvMuxPad))
#define GST_IS_FLV_MUX_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLV_MUX_PAD))
#define GST_IS_FLV_MUX_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLV_MUX_PAD))
typedef struct _GstFlvMuxPad GstFlvMuxPad;
typedef struct _GstFlvMuxPadClass GstFlvMuxPadClass;
#define GST_TYPE_FLV_MUX \
(gst_flv_mux_get_type ())
#define GST_FLV_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_FLV_MUX, GstFlvMux))
#define GST_FLV_MUX_CAST(obj) ((GstFlvMux *)obj)
#define GST_FLV_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_FLV_MUX, GstFlvMuxClass))
#define GST_IS_FLV_MUX(obj) \
@ -37,27 +51,26 @@ G_BEGIN_DECLS
#define GST_IS_FLV_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_FLV_MUX))
typedef struct
struct _GstFlvMuxPad
{
GstCollectData collect;
GstAggregatorPad aggregator_pad;
gboolean video;
guint audio_codec;
guint codec;
guint rate;
guint width;
guint channels;
GstBuffer *audio_codec_data;
guint video_codec;
GstBuffer *video_codec_data;
GstBuffer *codec_data;
guint bitrate;
GstClockTime last_timestamp;
gint64 pts;
gint64 dts;
} GstFlvPad;
};
typedef struct _GstFlvMuxPadClass {
GstAggregatorPadClass parent;
} GstFlvMuxPadClass;
typedef enum
{
@ -66,15 +79,14 @@ typedef enum
} GstFlvMuxState;
typedef struct _GstFlvMux {
GstElement element;
GstAggregator aggregator;
GstPad *srcpad;
GstCollectPads *collect;
/* <private> */
GstFlvMuxState state;
gboolean have_audio;
gboolean have_video;
GstFlvMuxPad *audio_pad;
GstFlvMuxPad *video_pad;
gboolean streamable;
gchar *metadatacreator;
@ -87,9 +99,10 @@ typedef struct _GstFlvMux {
} GstFlvMux;
typedef struct _GstFlvMuxClass {
GstElementClass parent;
GstAggregatorClass parent;
} GstFlvMuxClass;
GType gst_flv_mux_pad_get_type(void);
GType gst_flv_mux_get_type (void);
G_END_DECLS