[gst-devel] Getting started with gnonlin
Dominique Würtz
housirer at gmx.de
Tue Jan 10 02:12:01 CET 2006
Thanks again. The second test code now works as well. However, there are
still issues I stumbled across:
1. Priority only works for sources with same start time. A high priority
source which starts after a low priority source but before the latter
has finished won't play.
source1 = gst.element_factory_make("gnlfilesource")
source1.set_property("location", "foo.wav")
source1.set_property("duration", 2 * gst.SECOND)
source1.set_property("start", 2 * gst.SECOND)
source2 = gst.element_factory_make("gnlfilesource")
source2.set_property("location", "bar.wav")
source2.set_property("duration", 5 * gst.SECOND)
source2.set_property("priority", 1)
Here source1 will not play.
2. Having only one source delayed by some time
source = gst.element_factory_make("gnlfilesource")
source.set_property("location", "foo.wav")
source.set_property("start", 2 * gst.SECOND)
source.set_property("duration", 2 * gst.SECOND)
and linked to an alsasink will start to play immediately but not from the beginning of the file but with a 2 sec (I guess) offset within the file. So it seems like setting "start" behaves like setting "media-start".
Dominique
Edward Hervey wrote:
>Forgot to CC the mailing list
>
>---------- Forwarded message ----------
>From: Edward Hervey <bilboed at gmail.com>
>Date: Jan 7, 2006 7:54 PM
>Subject: Re: [gst-devel] Getting started with gnonlin
>To: Dominique Würtz <housirer at gmx.de>
>
>
>Hi,
>
>On 1/7/06, Dominique Würtz <housirer at gmx.de> wrote:
>
>
>>Thanks a lot for clearing things up! With the modifications you
>>mentioned my previous script works fine.
>>Now I want to go one step further and play two audio snippets one after
>>another. Here is the new code which unfortunately does not work again:
>>
>>import pygst
>>pygst.require('0.10')
>>import gst
>>import gobject
>>
>>def _audiocomp_new_pad_cb(self, pad):
>> audiocomp.link(sink)
>>
>>sink = gst.element_factory_make("alsasink")
>>audiocomp = gst.element_factory_make("gnlcomposition")
>>
>>source1 = gst.element_factory_make("gnlfilesource")
>>source1.set_property("location", "foo.wav")
>>source1.set_property("duration", 2 * gst.SECOND)
>>
>>source2 = gst.element_factory_make("gnlfilesource")
>>source2.set_property("location", "bar.wav")
>>source2.set_property("start", 2 * gst.SECOND)
>>source2.set_property("duration", 2 * gst.SECOND)
>>
>>audiocomp.add(source1, source2)
>>audiocomp.connect("pad-added", _audiocomp_new_pad_cb)
>>
>>pipeline = gst.Pipeline()
>>pipeline.add(audiocomp, sink)
>>
>>pipeline.set_state(gst.STATE_PLAYING)
>>gobject.MainLoop().run()
>>pipeline.set_state(gst.STATE_NULL)
>>
>>In this case only source1 is played (for 2 seconds).
>>
>>
>>
>
> I had a look, the handling of segment messages with format
>different form GST_FORMAT_TIME was handled wrongly in gnlobject. I
>commited the fixes to cvs. But there are still some issues regarding
>not having enough data to properly decode the second segment (seeking
>to 2s in the mp3 stream, whereas the previous chunk of mp3 starts
>earlier), I'll still be looking into that.
>
>
>
>>Another question is how gnonlin handles gaps. Since it's media type
>>agnostic I assume it won't output silence automatically at times not
>>covered by a source. Does a composition with gaps result in undefined
>>behaviour? Do I need to add a silence source with low priority and
>>"infinite" duration to fill the gaps?
>>
>>
>
> Let's take the example where you have your first source from 0s to
>2s and your second from 5s to 10s. What will happen is that two
>segments of 'data' will be outputted with the correct timestamps and
>newsegment events. This is what really happens 'under the hood'.
>
> If you connect your composition to an audiosink, the sink will wait
>for 3s after the first segment, before playing data from the second
>segment.
> If you connect your composition to an encoder.... expect serious borkage :)
>
> The 'trick' for the second case, is to put a 'blanking' gnlsource
>(audiotestsrc for audio or videotestsrc) with a priority (the actual
>property value) set very high, so that the composition will play that
>blanking source if there are gaps.
> In the previous version of gnonlin, you could set a source with a
>priority of G_MAXINT and it would only be played during blanks. I will
>add that feature again soon.
>
>
>
>>Dominique
>>
>>
>
> Take care,
>
> Edward
>
>
>
>>Edward Hervey wrote:
>>
>>
>>
>>>Hi,
>>>
>>> Nice to see more people using gnonlin :)
>>>
>>>On 1/6/06, Dominique Würtz <housirer at gmx.de> wrote:
>>>
>>>
>>>
>>>
>>>>I tried out the latest gnonlin (0.10.0.3) since I plan to use it for my
>>>>project. I created a little Python script to to test its functionality.
>>>>Unfortunately it wouldn't work. I think the pipeline gets stuck in the
>>>>PREROLL state. The timeline source pad however is created.
>>>>Here is the code:
>>>>
>>>>
>>>>
>>>>
>>> I'll comment along the way:
>>>
>>>
>>>
>>>
>>>
>>>>import gst
>>>>
>>>>
>>>>
>>>>
>>>I suppose you only have gst-python >= 0.10 installed, otherwise you
>>>should do the following before importing gst:
>>> import pygst
>>> pygst.require('0.10')
>>>
>>>
>>>
>>>
>>>
>>>>import gobject
>>>>
>>>>def _timeline_new_pad_cb(self, pad):
>>>> timeline.link(sink)
>>>>
>>>>sink = gst.element_factory_make("alsasink")
>>>>timeline = gst.element_factory_make("gnltimeline")
>>>>audiocomp = gst.element_factory_make("gnlcomposition")
>>>>
>>>>gnlsource = gst.element_factory_make("gnlfilesource")
>>>>gnlsource.set_property("location", "foo.wav")
>>>>gnlsource.set_property("media-start", 0L)
>>>>gnlsource.set_property("media-duration", 100000L)
>>>>
>>>>
>>>>
>>>>
>>> 1000000 is one millisecond ! You'd be better off using the
>>>gst.SECOND (or gst.MSECOND,...).
>>>
>>>
>>>
>>>
>>>
>>>>gnlsource.set_property("start", 0L)
>>>>gnlsource.set_property("duration", 100000L)
>>>>audiocomp.add(gnlsource)
>>>>
>>>>audiocomp.set_property("media-start", 0L)
>>>>audiocomp.set_property("media-duration", 100000L)
>>>>audiocomp.set_property("start", 0L)
>>>>audiocomp.set_property("duration", 100000L)
>>>>
>>>>
>>>>
>>>>
>>> For the time being, gnlcomposition have the (media)[start|duration]
>>>automatically set to it's contents (in this case it will be set to the
>>>duration of you gnlsource).
>>>
>>>
>>>
>>>
>>>
>>>>timeline.set_property("media-start", 0L)
>>>>timeline.set_property("media-duration", 100000L)
>>>>timeline.set_property("start", 0L)
>>>>timeline.set_property("duration", 100000L)
>>>>timeline.add(audiocomp)
>>>>
>>>>
>>>>
>>>>
>>> I'm slapping myself really hard :( The gnltimeline and gnloperation
>>>do nothing for the time being. In fact gnltimeline is going to go away
>>>(with the gnlobject-0.10 way of working, you can just replace it with
>>>a bin, if you really need that).
>>>
>>>
>>>
>>>
>>>
>>>>timeline.connect("pad-added", _timeline_new_pad_cb)
>>>>
>>>>pipeline = gst.Pipeline()
>>>>pipeline.add(timeline, sink)
>>>>
>>>>
>>>>
>>>>
>>> Because of the previous comment, replace all mention of gnltimeline
>>>with your audiocomp.
>>>
>>>
>>>
>>>
>>>
>>>>pipeline.set_state(gst.STATE_PLAYING)
>>>>gobject.MainLoop().run()
>>>>pipeline.set_state(gst.STATE_NULL)
>>>>
>>>>Just a side note:
>>>>
>>>>This works: gst-launch filesrc location="foo.wav" ! decodebin ! alsasink
>>>>While this won't: gst-launch gnlfilesrc location="foo.wav" ! decodebin !
>>>>alsasink
>>>>
>>>>
>>>>
>>>>
>>> The gnlfilesource contains decodebin within (it's it's purpose, just
>>>give a location and (if needed) a caps). Also, the default values for
>>>(media)[start|duration] are set to 0, so it will play for... 0
>>>nanoseconds :)
>>>
>>>
>>>
>>>
>>>
>>>>Any ideas why the pipeline won't play?
>>>>
>>>>
>>>>
>>>>
>>>>
>>> Try following all the instructions given above. Although with latest
>>>cvs, there seems to be an issue, where the fakesink contained in
>>>decodebin doesn't get removed. I'm having a look at it now.
>>>
>>> Edward
>>>
>>>
>>>
>>>
>>>
>>>>-------------------------------------------------------
>>>>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>>>>for problems? Stop! Download the new AJAX search engine that makes
>>>>searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
>>>>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>>>>_______________________________________________
>>>>gstreamer-devel mailing list
>>>>gstreamer-devel at lists.sourceforge.net
>>>>https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>>
>>>>
>>>>
>>>>
>>>>
>>>--
>>>Edward Hervey
>>>Junior developer / Fluendo S.L.
>>>http://www.pitivi.org/
>>>
>>>
>>>
>>>
>>
>>
>
>
>--
>Edward Hervey
>Junior developer / Fluendo S.L.
>http://www.pitivi.org/
>
>
>--
>Edward Hervey
>Junior developer / Fluendo S.L.
>http://www.pitivi.org/
>N�HY隊X���'���u���[�������
>ަ�k��!���W�~�鮆�zk��C� 塧m����@^ǚ��^��z�Z�f�z�
j�!�x2�������ɫ,���a{��,�H��4�m���i�(��ܢo�v'��jYhr'ׯ:�rX��-��z�^��fj)b� b��,������z�+-��.�ǟ��
��a��l��b��,���y�+���b��?�+-�w��-��z�^vel=
>
More information about the gstreamer-devel
mailing list