summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-02-15 09:45:27 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-02-15 09:45:27 +0000
commit6e75290c497f7843cd53e6a5200329536ca469b1 (patch)
treeeb2fa0e01defb6eb9fa2886fca1421bf2ad7bd7c
parent6e172e01f008c6eb26f30916fad8bbf5c6b67103 (diff)
downloadgst-plugins-bad-6e75290c497f7843cd53e6a5200329536ca469b1.tar.gz
gst-plugins-bad-6e75290c497f7843cd53e6a5200329536ca469b1.tar.bz2
gst-plugins-bad-6e75290c497f7843cd53e6a5200329536ca469b1.zip
gst/qtdemux/qtdemux.c: When buffering MDAT data, show the user something is happening by posting 'buffering' messages...
Original commit message from CVS: * gst/qtdemux/qtdemux.c: (gst_qtdemux_post_buffering), (gst_qtdemux_chain): When buffering MDAT data, show the user something is happening by posting 'buffering' messages on the bus.
-rw-r--r--ChangeLog7
-rw-r--r--gst/qtdemux/qtdemux.c21
2 files changed, 27 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7006a452..fe078dfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-15 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/qtdemux/qtdemux.c: (gst_qtdemux_post_buffering),
+ (gst_qtdemux_chain):
+ When buffering MDAT data, show the user something is
+ happening by posting 'buffering' messages on the bus.
+
2006-02-14 Edward Hervey <edward@fluendo.com>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_init),
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 77a0c5d1..ffcfee56 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -104,7 +104,7 @@ enum QtDemuxState
QTDEMUX_STATE_INITIAL, /* Initial state (haven't got the header yet) */
QTDEMUX_STATE_HEADER, /* Parsing the header */
QTDEMUX_STATE_MOVIE, /* Parsing/Playing the media data */
- QTDEMUX_STATE_BUFFER_MDAT, /* Buffering the mdat atom */
+ QTDEMUX_STATE_BUFFER_MDAT /* Buffering the mdat atom */
};
static GNode *qtdemux_tree_get_child_by_type (GNode * node, guint32 fourcc);
@@ -810,6 +810,18 @@ next_entry_size (GstQTDemux * demux)
return -1;
}
+static void
+gst_qtdemux_post_buffering (GstQTDemux * demux, gint num, gint denom)
+{
+ gint perc = (gint) ((gdouble) num * 100.0 / (gdouble) denom);
+
+ gst_element_post_message (GST_ELEMENT (demux),
+ gst_message_new_custom (GST_MESSAGE_BUFFERING,
+ GST_OBJECT (demux),
+ gst_structure_new ("GstMessageBuffering",
+ "buffer-percent", G_TYPE_INT, perc, NULL)));
+}
+
static GstFlowReturn
gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf)
{
@@ -920,6 +932,7 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf)
demux->offset += demux->neededbytes;
demux->neededbytes = 16;
demux->state = QTDEMUX_STATE_INITIAL;
+ gst_qtdemux_post_buffering (demux, 100, 1);
}
break;
@@ -1012,6 +1025,12 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf)
}
}
+ /* when buffering movie data, at least show user something is happening */
+ if (ret == GST_FLOW_OK && demux->state == QTDEMUX_STATE_BUFFER_MDAT &&
+ gst_adapter_available (demux->adapter) <= demux->neededbytes) {
+ gst_qtdemux_post_buffering (demux, gst_adapter_available (demux->adapter),
+ demux->neededbytes);
+ }
return ret;
}