hlsdemux2: Add llhls-enabled property to streams
Tidying: Make the llhls-enabled setting configurable through a stream property instead of set manually after construction. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
parent
d5edd48f13
commit
7b3a1bac0a
@ -43,6 +43,15 @@
|
|||||||
GST_DEBUG_CATEGORY_EXTERN (gst_hls_demux2_debug);
|
GST_DEBUG_CATEGORY_EXTERN (gst_hls_demux2_debug);
|
||||||
#define GST_CAT_DEFAULT gst_hls_demux2_debug
|
#define GST_CAT_DEFAULT gst_hls_demux2_debug
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_LLHLS_ENABLED,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_LLHLS_ENABLED TRUE
|
||||||
|
|
||||||
/* Maximum values for mpeg-ts DTS values */
|
/* Maximum values for mpeg-ts DTS values */
|
||||||
#define MPEG_TS_MAX_PTS (((((guint64)1) << 33) * (guint64)100000) / 9)
|
#define MPEG_TS_MAX_PTS (((((guint64)1) << 33) * (guint64)100000) / 9)
|
||||||
|
|
||||||
@ -87,6 +96,38 @@ static void gst_hls_demux_stream_finalize (GObject * object);
|
|||||||
G_DEFINE_TYPE (GstHLSDemuxStream, gst_hls_demux_stream,
|
G_DEFINE_TYPE (GstHLSDemuxStream, gst_hls_demux_stream,
|
||||||
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_hls_demux_stream_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstHLSDemuxStream *stream = GST_HLS_DEMUX_STREAM (object);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_LLHLS_ENABLED:
|
||||||
|
stream->llhls_enabled = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_hls_demux_stream_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstHLSDemuxStream *stream = GST_HLS_DEMUX_STREAM (object);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_LLHLS_ENABLED:
|
||||||
|
g_value_set_boolean (value, stream->llhls_enabled);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
||||||
{
|
{
|
||||||
@ -94,6 +135,8 @@ gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
|||||||
GstAdaptiveDemux2StreamClass *adaptivedemux2stream_class =
|
GstAdaptiveDemux2StreamClass *adaptivedemux2stream_class =
|
||||||
GST_ADAPTIVE_DEMUX2_STREAM_CLASS (klass);
|
GST_ADAPTIVE_DEMUX2_STREAM_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->set_property = gst_hls_demux_stream_set_property;
|
||||||
|
gobject_class->get_property = gst_hls_demux_stream_get_property;
|
||||||
gobject_class->finalize = gst_hls_demux_stream_finalize;
|
gobject_class->finalize = gst_hls_demux_stream_finalize;
|
||||||
|
|
||||||
adaptivedemux2stream_class->update_fragment_info =
|
adaptivedemux2stream_class->update_fragment_info =
|
||||||
@ -120,6 +163,11 @@ gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
|||||||
gst_hls_demux_stream_data_received;
|
gst_hls_demux_stream_data_received;
|
||||||
adaptivedemux2stream_class->get_presentation_offset =
|
adaptivedemux2stream_class->get_presentation_offset =
|
||||||
gst_hls_demux_stream_get_presentation_offset;
|
gst_hls_demux_stream_get_presentation_offset;
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_LLHLS_ENABLED,
|
||||||
|
g_param_spec_boolean ("llhls-enabled", "Enable LL-HLS support",
|
||||||
|
"Enable support for LL-HLS (Low Latency HLS) downloads",
|
||||||
|
DEFAULT_LLHLS_ENABLED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -130,6 +178,7 @@ gst_hls_demux_stream_init (GstHLSDemuxStream * stream)
|
|||||||
stream->reset_pts = TRUE;
|
stream->reset_pts = TRUE;
|
||||||
stream->presentation_offset = 60 * GST_SECOND;
|
stream->presentation_offset = 60 * GST_SECOND;
|
||||||
stream->pdt_tag_sent = FALSE;
|
stream->pdt_tag_sent = FALSE;
|
||||||
|
stream->llhls_enabled = DEFAULT_LLHLS_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -74,9 +74,6 @@ enum
|
|||||||
#define DEFAULT_START_BITRATE 0
|
#define DEFAULT_START_BITRATE 0
|
||||||
#define DEFAULT_LLHLS_ENABLED TRUE
|
#define DEFAULT_LLHLS_ENABLED TRUE
|
||||||
|
|
||||||
/* Maximum values for mpeg-ts DTS values */
|
|
||||||
#define MPEG_TS_MAX_PTS (((((guint64)1) << 33) * (guint64)100000) / 9)
|
|
||||||
|
|
||||||
/* GObject */
|
/* GObject */
|
||||||
static void gst_hls_demux_finalize (GObject * obj);
|
static void gst_hls_demux_finalize (GObject * obj);
|
||||||
|
|
||||||
@ -171,7 +168,6 @@ gst_hls_demux_get_property (GObject * object, guint prop_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_hls_demux2_class_init (GstHLSDemux2Class * klass)
|
gst_hls_demux2_class_init (GstHLSDemux2Class * klass)
|
||||||
{
|
{
|
||||||
@ -408,8 +404,8 @@ create_common_hls_stream (GstHLSDemux * demux, const gchar * name)
|
|||||||
{
|
{
|
||||||
GstAdaptiveDemux2Stream *stream;
|
GstAdaptiveDemux2Stream *stream;
|
||||||
|
|
||||||
stream = g_object_new (GST_TYPE_HLS_DEMUX_STREAM, "name", name, NULL);
|
stream = g_object_new (GST_TYPE_HLS_DEMUX_STREAM, "name", name,
|
||||||
GST_HLS_DEMUX_STREAM (stream)->llhls_enabled = demux->llhls_enabled;
|
"llhls-enabled", demux->llhls_enabled, NULL);
|
||||||
|
|
||||||
gst_adaptive_demux2_add_stream ((GstAdaptiveDemux *) demux, stream);
|
gst_adaptive_demux2_add_stream ((GstAdaptiveDemux *) demux, stream);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user