mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 05:52:37 +00:00
ext/ogg/gstoggmux.c: Added property to set the maximum delay of a page.
Original commit message from CVS: * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init), (gst_ogg_mux_init), (gst_ogg_mux_next_buffer), (gst_ogg_mux_get_headers), (gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_send_headers), (gst_ogg_mux_loop), (gst_ogg_mux_get_property), (gst_ogg_mux_set_property): Added property to set the maximum delay of a page.
This commit is contained in:
parent
811fe5ce14
commit
ff3c32516e
2 changed files with 54 additions and 0 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-06-11 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init),
|
||||||
|
(gst_ogg_mux_init), (gst_ogg_mux_next_buffer),
|
||||||
|
(gst_ogg_mux_get_headers), (gst_ogg_mux_set_header_on_caps),
|
||||||
|
(gst_ogg_mux_send_headers), (gst_ogg_mux_loop),
|
||||||
|
(gst_ogg_mux_get_property), (gst_ogg_mux_set_property):
|
||||||
|
Added property to set the maximum delay of a page.
|
||||||
|
|
||||||
2004-06-10 Wim Taymans <wim@fluendo.com>
|
2004-06-10 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init),
|
* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init),
|
||||||
|
|
|
@ -51,7 +51,9 @@ typedef struct
|
||||||
ogg_stream_state stream;
|
ogg_stream_state stream;
|
||||||
gint64 packetno; /* number of next packet */
|
gint64 packetno; /* number of next packet */
|
||||||
gint64 pageno; /* number of next page */
|
gint64 pageno; /* number of next page */
|
||||||
|
guint64 duration; /* duration of current page */
|
||||||
gboolean eos;
|
gboolean eos;
|
||||||
|
gint64 offset;
|
||||||
|
|
||||||
guint state; /* state of the pad */
|
guint state; /* state of the pad */
|
||||||
|
|
||||||
|
@ -89,6 +91,7 @@ struct _GstOggMux
|
||||||
gboolean need_headers;
|
gboolean need_headers;
|
||||||
|
|
||||||
guint64 max_delay;
|
guint64 max_delay;
|
||||||
|
guint64 max_page_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -116,11 +119,14 @@ enum
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* set to 5 seconds by default */
|
||||||
#define DEFAULT_MAX_DELAY 5000000000LL
|
#define DEFAULT_MAX_DELAY 5000000000LL
|
||||||
|
#define DEFAULT_MAX_PAGE_DELAY 5000000000LL
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_MAX_DELAY,
|
ARG_MAX_DELAY,
|
||||||
|
ARG_MAX_PAGE_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
@ -208,6 +214,10 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
|
||||||
g_param_spec_uint64 ("max-delay", "Max delay",
|
g_param_spec_uint64 ("max-delay", "Max delay",
|
||||||
"Maximum delay in multiplexing streams", 0, G_MAXUINT64,
|
"Maximum delay in multiplexing streams", 0, G_MAXUINT64,
|
||||||
DEFAULT_MAX_DELAY, (GParamFlags) G_PARAM_READWRITE));
|
DEFAULT_MAX_DELAY, (GParamFlags) G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (gobject_class, ARG_MAX_PAGE_DELAY,
|
||||||
|
g_param_spec_uint64 ("max-page-delay", "Max page delay",
|
||||||
|
"Maximum delay for sending out a page", 0, G_MAXUINT64,
|
||||||
|
DEFAULT_MAX_PAGE_DELAY, (GParamFlags) G_PARAM_READWRITE));
|
||||||
|
|
||||||
gstelement_class->change_state = gst_ogg_mux_change_state;
|
gstelement_class->change_state = gst_ogg_mux_change_state;
|
||||||
|
|
||||||
|
@ -247,6 +257,7 @@ gst_ogg_mux_init (GstOggMux * ogg_mux)
|
||||||
ogg_mux->pulling = NULL;
|
ogg_mux->pulling = NULL;
|
||||||
ogg_mux->need_headers = TRUE;
|
ogg_mux->need_headers = TRUE;
|
||||||
ogg_mux->max_delay = DEFAULT_MAX_DELAY;
|
ogg_mux->max_delay = DEFAULT_MAX_DELAY;
|
||||||
|
ogg_mux->max_page_delay = DEFAULT_MAX_PAGE_DELAY;
|
||||||
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (ogg_mux), gst_ogg_mux_loop);
|
gst_element_set_loop_function (GST_ELEMENT (ogg_mux), gst_ogg_mux_loop);
|
||||||
}
|
}
|
||||||
|
@ -403,8 +414,18 @@ gst_ogg_mux_next_buffer (GstOggPad * pad)
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
return NULL;
|
return NULL;
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
|
{
|
||||||
|
gint64 value = 0;
|
||||||
|
|
||||||
|
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
||||||
|
GST_DEBUG_OBJECT (ogg_mux,
|
||||||
|
"got discont of %" G_GUINT64_FORMAT " on pad %s:%s",
|
||||||
|
value, GST_DEBUG_PAD_NAME (pad->pad));
|
||||||
|
}
|
||||||
|
pad->offset = value;
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
gst_pad_event_default (pad->pad, event);
|
gst_pad_event_default (pad->pad, event);
|
||||||
break;
|
break;
|
||||||
|
@ -846,6 +867,7 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
ogg_page page;
|
ogg_page page;
|
||||||
GstBuffer *buf, *tmpbuf;
|
GstBuffer *buf, *tmpbuf;
|
||||||
GstOggPad *pad = ogg_mux->pulling;
|
GstOggPad *pad = ogg_mux->pulling;
|
||||||
|
gint64 duration;
|
||||||
|
|
||||||
/* now see if we have a buffer */
|
/* now see if we have a buffer */
|
||||||
buf = pad->buffer;
|
buf = pad->buffer;
|
||||||
|
@ -860,6 +882,8 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duration = GST_BUFFER_DURATION (buf);
|
||||||
|
|
||||||
/* create a packet from the buffer */
|
/* create a packet from the buffer */
|
||||||
packet.packet = GST_BUFFER_DATA (buf);
|
packet.packet = GST_BUFFER_DATA (buf);
|
||||||
packet.bytes = GST_BUFFER_SIZE (buf);
|
packet.bytes = GST_BUFFER_SIZE (buf);
|
||||||
|
@ -886,6 +910,20 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
/* store new readahead buffer */
|
/* store new readahead buffer */
|
||||||
pad->buffer = tmpbuf;
|
pad->buffer = tmpbuf;
|
||||||
|
|
||||||
|
if (duration != -1) {
|
||||||
|
pad->duration += duration;
|
||||||
|
/* if page duration exceeds max, flush page */
|
||||||
|
if (pad->duration > ogg_mux->max_page_delay) {
|
||||||
|
while (ogg_stream_flush (&pad->stream, &page)) {
|
||||||
|
gst_ogg_mux_push_page (ogg_mux, &page);
|
||||||
|
/* increment the page number counter */
|
||||||
|
pad->pageno++;
|
||||||
|
}
|
||||||
|
pad->duration = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* flush out the pages now. The packet we got could end up in
|
/* flush out the pages now. The packet we got could end up in
|
||||||
* more than one page so we need to flush them all */
|
* more than one page so we need to flush them all */
|
||||||
while (ogg_stream_pageout (&pad->stream, &page) > 0) {
|
while (ogg_stream_pageout (&pad->stream, &page) > 0) {
|
||||||
|
@ -897,6 +935,7 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
/* we're done pulling on this pad, make sure to choose a new
|
/* we're done pulling on this pad, make sure to choose a new
|
||||||
* pad for pulling in the next iteration */
|
* pad for pulling in the next iteration */
|
||||||
ogg_mux->pulling = NULL;
|
ogg_mux->pulling = NULL;
|
||||||
|
pad->duration = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -913,6 +952,9 @@ gst_ogg_mux_get_property (GObject * object,
|
||||||
case ARG_MAX_DELAY:
|
case ARG_MAX_DELAY:
|
||||||
g_value_set_uint64 (value, ogg_mux->max_delay);
|
g_value_set_uint64 (value, ogg_mux->max_delay);
|
||||||
break;
|
break;
|
||||||
|
case ARG_MAX_PAGE_DELAY:
|
||||||
|
g_value_set_uint64 (value, ogg_mux->max_page_delay);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -931,6 +973,9 @@ gst_ogg_mux_set_property (GObject * object,
|
||||||
case ARG_MAX_DELAY:
|
case ARG_MAX_DELAY:
|
||||||
ogg_mux->max_delay = g_value_get_uint64 (value);
|
ogg_mux->max_delay = g_value_get_uint64 (value);
|
||||||
break;
|
break;
|
||||||
|
case ARG_MAX_PAGE_DELAY:
|
||||||
|
ogg_mux->max_page_delay = g_value_get_uint64 (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue