diff --git a/ChangeLog b/ChangeLog index 0fc982c48f..93a1a41f1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-11-01 Edward Hervey + + * gst/gst-types.defs: + Updated modification from API + * gst/gstquery.override: + Added gst_query_parse_duration override + * examples/gstfile.py: + Now use duration query + Cleanups + 2005-10-27 Edward Hervey * gst/gst.defs: diff --git a/common b/common index 1cb5d7b76a..a0c6a14dbc 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 1cb5d7b76a01c711674c752015089e70c394fa99 +Subproject commit a0c6a14dbc3cb62bf513502eaef83d0600a7c1ca diff --git a/examples/gstfile.py b/examples/gstfile.py index de60f9ff6c..49287ec8ea 100644 --- a/examples/gstfile.py +++ b/examples/gstfile.py @@ -108,7 +108,6 @@ class Discoverer(gst.Pipeline): self.typefind.connect("have-type", self._have_type_cb) self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb) self.dbin.connect("unknown-type", self._unknown_type_cb) - #self.dbin.connect("found-tag", self._found_tag_cb) self.discover() @@ -130,29 +129,21 @@ class Discoverer(gst.Pipeline): if not msg: print "got empty message..." break - #print "##", msg.type if msg.type & gst.MESSAGE_STATE_CHANGED: - #print "## state changed\t", msg.src.get_name() , - #print msg.parse_state_changed() pass elif msg.type & gst.MESSAGE_EOS: - #print "EOS" break elif msg.type & gst.MESSAGE_TAG: for key in msg.parse_tag().keys(): self.tags[key] = msg.structure[key] - #print msg.structure.to_string() elif msg.type & gst.MESSAGE_ERROR: print "whooops, error", msg.parse_error() break else: print "unknown message type" -# self.info( "going to PAUSED") self.set_state(gst.STATE_PAUSED) -# self.info("going to ready") self.set_state(gst.STATE_READY) -# print "now in ready" self.finished = True def print_info(self): @@ -207,24 +198,18 @@ class Discoverer(gst.Pipeline): def _notify_caps_cb(self, pad, args): caps = pad.get_negotiated_caps() -# print "caps notify on", pad, ":", caps if not caps: return # the caps are fixed # We now get the total length of that stream - q = gst.query_new_position(gst.FORMAT_TIME) - #print "query refcount", q.__grefcount__ + q = gst.query_new_duration(gst.FORMAT_TIME) pad.info("sending position query") if pad.get_peer().query(q): - #print "query refcount", q.__grefcount__ - length = q.structure["end"] - pos = q.structure["cur"] - format = q.structure["format"] - pad.info("got position query answer : %d:%d:%d" % (length, pos, format)) - #print "got length", time_to_string(pos), time_to_string(length), format + format, length = q.parse_duration() + pad.info("got position query answer : %d:%d" % (length, format)) else: gst.warning("position query didn't work") - #length = pad.get_peer().query(gst.QUERY_TOTAL, gst.FORMAT_TIME) + # We store the caps and length in the proper location if "audio" in caps.to_string(): self.audiocaps = caps @@ -251,19 +236,10 @@ class Discoverer(gst.Pipeline): # Does the file contain got audio or video ? caps = pad.get_caps() gst.info("caps:%s" % caps.to_string()) -# print "new decoded pad", caps.to_string() if "audio" in caps.to_string(): self.is_audio = True -## if caps.is_fixed(): -## print "have negotiated caps", caps -## self.audiocaps = caps -## return elif "video" in caps.to_string(): self.is_video = True -## if caps.is_fixed(): -## print "have negotiated caps", caps -## self.videocaps = caps -## return else: print "got a different caps..", caps return diff --git a/gst/gst-types.defs b/gst/gst-types.defs index bd125698c4..436448b70d 100644 --- a/gst/gst-types.defs +++ b/gst/gst-types.defs @@ -423,7 +423,6 @@ '("demux" "GST_STREAM_ERROR_DEMUX") '("mux" "GST_STREAM_ERROR_MUX") '("format" "GST_STREAM_ERROR_FORMAT") - '("stopped" "GST_STREAM_ERROR_STOPPED") '("num-errors" "GST_STREAM_ERROR_NUM_ERRORS") ) ) diff --git a/gst/gstquery.override b/gst/gstquery.override index 52c8ff2e30..d761509a2b 100644 --- a/gst/gstquery.override +++ b/gst/gstquery.override @@ -43,6 +43,28 @@ _wrap_gst_query_parse_position (PyGstMiniObject *self) return ret; } %% +override gst_query_parse_duration noargs +static PyObject * +_wrap_gst_query_parse_duration (PyGstMiniObject *self) +{ + GstFormat format; + gint64 cur; + PyObject *ret; + + if (GST_QUERY_TYPE(self->obj) != GST_QUERY_DURATION) { + PyErr_SetString(PyExc_TypeError, "Query is not a 'Duration' query"); + return NULL; + } + + gst_query_parse_duration (GST_QUERY(self->obj), &format, &cur); + + ret = PyList_New(2); + PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FORMAT, format)); + PyList_SetItem(ret, 1, PyLong_FromLongLong(cur)); + + return ret; +} +%% override gst_query_parse_convert noargs static PyObject * _wrap_gst_query_parse_convert (PyGstMiniObject *self)