mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gst/gst-types.defs: Updated modification from API
Original commit message from CVS: * 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
This commit is contained in:
parent
5f81d50344
commit
85b73ba53f
5 changed files with 37 additions and 30 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-11-01 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
|
* 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 <edward@fluendo.com>
|
2005-10-27 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/gst.defs:
|
* gst/gst.defs:
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 1cb5d7b76a01c711674c752015089e70c394fa99
|
Subproject commit a0c6a14dbc3cb62bf513502eaef83d0600a7c1ca
|
|
@ -108,7 +108,6 @@ class Discoverer(gst.Pipeline):
|
||||||
self.typefind.connect("have-type", self._have_type_cb)
|
self.typefind.connect("have-type", self._have_type_cb)
|
||||||
self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb)
|
self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb)
|
||||||
self.dbin.connect("unknown-type", self._unknown_type_cb)
|
self.dbin.connect("unknown-type", self._unknown_type_cb)
|
||||||
#self.dbin.connect("found-tag", self._found_tag_cb)
|
|
||||||
|
|
||||||
self.discover()
|
self.discover()
|
||||||
|
|
||||||
|
@ -130,29 +129,21 @@ class Discoverer(gst.Pipeline):
|
||||||
if not msg:
|
if not msg:
|
||||||
print "got empty message..."
|
print "got empty message..."
|
||||||
break
|
break
|
||||||
#print "##", msg.type
|
|
||||||
if msg.type & gst.MESSAGE_STATE_CHANGED:
|
if msg.type & gst.MESSAGE_STATE_CHANGED:
|
||||||
#print "## state changed\t", msg.src.get_name() ,
|
|
||||||
#print msg.parse_state_changed()
|
|
||||||
pass
|
pass
|
||||||
elif msg.type & gst.MESSAGE_EOS:
|
elif msg.type & gst.MESSAGE_EOS:
|
||||||
#print "EOS"
|
|
||||||
break
|
break
|
||||||
elif msg.type & gst.MESSAGE_TAG:
|
elif msg.type & gst.MESSAGE_TAG:
|
||||||
for key in msg.parse_tag().keys():
|
for key in msg.parse_tag().keys():
|
||||||
self.tags[key] = msg.structure[key]
|
self.tags[key] = msg.structure[key]
|
||||||
#print msg.structure.to_string()
|
|
||||||
elif msg.type & gst.MESSAGE_ERROR:
|
elif msg.type & gst.MESSAGE_ERROR:
|
||||||
print "whooops, error", msg.parse_error()
|
print "whooops, error", msg.parse_error()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print "unknown message type"
|
print "unknown message type"
|
||||||
|
|
||||||
# self.info( "going to PAUSED")
|
|
||||||
self.set_state(gst.STATE_PAUSED)
|
self.set_state(gst.STATE_PAUSED)
|
||||||
# self.info("going to ready")
|
|
||||||
self.set_state(gst.STATE_READY)
|
self.set_state(gst.STATE_READY)
|
||||||
# print "now in ready"
|
|
||||||
self.finished = True
|
self.finished = True
|
||||||
|
|
||||||
def print_info(self):
|
def print_info(self):
|
||||||
|
@ -207,24 +198,18 @@ class Discoverer(gst.Pipeline):
|
||||||
|
|
||||||
def _notify_caps_cb(self, pad, args):
|
def _notify_caps_cb(self, pad, args):
|
||||||
caps = pad.get_negotiated_caps()
|
caps = pad.get_negotiated_caps()
|
||||||
# print "caps notify on", pad, ":", caps
|
|
||||||
if not caps:
|
if not caps:
|
||||||
return
|
return
|
||||||
# the caps are fixed
|
# the caps are fixed
|
||||||
# We now get the total length of that stream
|
# We now get the total length of that stream
|
||||||
q = gst.query_new_position(gst.FORMAT_TIME)
|
q = gst.query_new_duration(gst.FORMAT_TIME)
|
||||||
#print "query refcount", q.__grefcount__
|
|
||||||
pad.info("sending position query")
|
pad.info("sending position query")
|
||||||
if pad.get_peer().query(q):
|
if pad.get_peer().query(q):
|
||||||
#print "query refcount", q.__grefcount__
|
format, length = q.parse_duration()
|
||||||
length = q.structure["end"]
|
pad.info("got position query answer : %d:%d" % (length, format))
|
||||||
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
|
|
||||||
else:
|
else:
|
||||||
gst.warning("position query didn't work")
|
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
|
# We store the caps and length in the proper location
|
||||||
if "audio" in caps.to_string():
|
if "audio" in caps.to_string():
|
||||||
self.audiocaps = caps
|
self.audiocaps = caps
|
||||||
|
@ -251,19 +236,10 @@ class Discoverer(gst.Pipeline):
|
||||||
# Does the file contain got audio or video ?
|
# Does the file contain got audio or video ?
|
||||||
caps = pad.get_caps()
|
caps = pad.get_caps()
|
||||||
gst.info("caps:%s" % caps.to_string())
|
gst.info("caps:%s" % caps.to_string())
|
||||||
# print "new decoded pad", caps.to_string()
|
|
||||||
if "audio" in caps.to_string():
|
if "audio" in caps.to_string():
|
||||||
self.is_audio = True
|
self.is_audio = True
|
||||||
## if caps.is_fixed():
|
|
||||||
## print "have negotiated caps", caps
|
|
||||||
## self.audiocaps = caps
|
|
||||||
## return
|
|
||||||
elif "video" in caps.to_string():
|
elif "video" in caps.to_string():
|
||||||
self.is_video = True
|
self.is_video = True
|
||||||
## if caps.is_fixed():
|
|
||||||
## print "have negotiated caps", caps
|
|
||||||
## self.videocaps = caps
|
|
||||||
## return
|
|
||||||
else:
|
else:
|
||||||
print "got a different caps..", caps
|
print "got a different caps..", caps
|
||||||
return
|
return
|
||||||
|
|
|
@ -423,7 +423,6 @@
|
||||||
'("demux" "GST_STREAM_ERROR_DEMUX")
|
'("demux" "GST_STREAM_ERROR_DEMUX")
|
||||||
'("mux" "GST_STREAM_ERROR_MUX")
|
'("mux" "GST_STREAM_ERROR_MUX")
|
||||||
'("format" "GST_STREAM_ERROR_FORMAT")
|
'("format" "GST_STREAM_ERROR_FORMAT")
|
||||||
'("stopped" "GST_STREAM_ERROR_STOPPED")
|
|
||||||
'("num-errors" "GST_STREAM_ERROR_NUM_ERRORS")
|
'("num-errors" "GST_STREAM_ERROR_NUM_ERRORS")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,6 +43,28 @@ _wrap_gst_query_parse_position (PyGstMiniObject *self)
|
||||||
return ret;
|
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
|
override gst_query_parse_convert noargs
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_query_parse_convert (PyGstMiniObject *self)
|
_wrap_gst_query_parse_convert (PyGstMiniObject *self)
|
||||||
|
|
Loading…
Reference in a new issue