GNOME Bugzilla – Bug 339772
Python example showing segment seeking and looping
Last modified: 2010-09-07 11:30:47 UTC
This is an example that shows how to do simple segment seeking and looping within a playbin. Thanks to Andy Wingo, for pointing out a huge incorrectness.
Created attachment 64298 [details] The example itself
There is one with ui already in gst-plugins-base/tests/examples/seek. Maybe that one should be mentioned in the docs?
Edward, want to include it? Artem, right now I get random fails from it: python /home/ensonic/Desktop/Segments.py /home/ensonic/Musik/ErsDemo2.mp3 1 5 1 python: malloc.c:4628: _int_malloc: Assertion `(unsigned long)(size) >= (unsigned long)(nb)' failed. Aborted
Woah, completely forgot about this. Stefan, the code still works for me on different files without errors (Ubuntu Maverick, GStreamer 0.10.30, Python 2.6.6rc1, PyGST 0.10.19).
This is really weired. I am using git HEAD of all gstreamer modules. I get 3 behaviour: - it works - it fails as in comment #3 - it fails as in below: $ python ./examples/segments.py /home/ensonic/Musik/klingon.mp3 2 4 0 python: malloc.c:4628: _int_malloc: Assertion `(unsigned long)(size) >= (unsigned long)(nb)' failed. Aborted ensonic@mautz:~/projects/gstreamer/gst-python$ python ./examples/segments.py /home/ensonic/Musik/klingon.mp3 2 4 0 (segments.py:7339): GStreamer-CRITICAL **: gst_value_is_fixed: assertion `G_IS_VALUE (value)' failed (segments.py:7339): GStreamer-CRITICAL **: gst_pad_set_caps: assertion `caps == NULL || gst_caps_is_fixed (caps)' failed *** glibc detected *** python: free(): invalid pointer: 0xb6d2c7b8 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x2cd591] /lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x2cede8] /lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x2d1ecd] /lib/libglib-2.0.so.0(g_free+0x36)[0x510fc6] /lib/libglib-2.0.so.0(g_array_free+0x87)[0x4e18a7] /usr/lib/libgstreamer-0.10.so.0(gst_structure_free+0xc6)[0x47eae6] /usr/lib/libgstreamer-0.10.so.0(gst_caps_unref+0x14a)[0x434bfa] /usr/lib/libgstreamer-0.10.so.0(gst_caps_replace+0x59)[0x434e49] /usr/lib/libgstreamer-0.10.so.0(gst_pad_set_caps+0xf3)[0x45aa93] /usr/lib/libgstreamer-0.10.so.0(+0x3a21a)[0x43f21a] /usr/lib/libgstreamer-0.10.so.0(gst_iterator_fold+0x67)[0x451d47] /usr/lib/libgstreamer-0.10.so.0(+0x3a19f)[0x43f19f] /usr/lib/libgstreamer-0.10.so.0(+0x3c933)[0x441933] /usr/lib/libgstreamer-0.10.so.0(+0x3edb9)[0x443db9] /usr/lib/gstreamer-0.10/libgstmpg123.so(+0x21a6)[0x7961a6] /usr/lib/libgstreamer-0.10.so.0(gst_element_change_state+0x35)[0x440355] /usr/lib/libgstreamer-0.10.so.0(+0x3eac8)[0x443ac8] /usr/lib/libgstreamer-0.10.so.0(gst_element_set_state+0x90)[0x43f710] /usr/lib/libgstreamer-0.10.so.0(+0x29f4f)[0x42ef4f] /usr/lib/gstreamer-0.10/libgstdecodebin.so(+0x6a2f)[0x673a2f] /usr/lib/libgstreamer-0.10.so.0(gst_element_change_state+0x35)[0x440355] /usr/lib/libgstreamer-0.10.so.0(+0x3eac8)[0x443ac8] /usr/lib/libgstreamer-0.10.so.0(gst_element_set_state+0x90)[0x43f710] /usr/lib/libgstreamer-0.10.so.0(+0x29f4f)[0x42ef4f] /usr/lib/libgstreamer-0.10.so.0(+0x5f372)[0x464372] /usr/lib/gstreamer-0.10/libgstplaybin.so(+0x23d3b)[0x71cd3b] /usr/lib/gstreamer-0.10/libgstplaybin.so(+0xa2dd)[0x7032dd] /usr/lib/libgstreamer-0.10.so.0(gst_element_change_state+0x35)[0x440355] /usr/lib/libgstreamer-0.10.so.0(+0x3eac8)[0x443ac8] /usr/lib/libgstreamer-0.10.so.0(gst_element_set_state+0x90)[0x43f710] /usr/lib/python2.6/dist-packages/gst-0.10/gst/_gst.so(+0x4529e)[0xad429e] python(PyEval_EvalFrameEx+0x4221)[0x80e0a21] python(PyEval_EvalCodeEx+0x857)[0x80e2807] python(PyEval_EvalFrameEx+0x448b)[0x80e0c8b] python(PyEval_EvalCodeEx+0x857)[0x80e2807] python[0x816b2ac] python(PyObject_Call+0x4a)[0x806245a] python[0x806a45c] python(PyObject_Call+0x4a)[0x806245a] python(PyEval_CallObjectWithKeywords+0x42)[0x80db892] python(PyObject_CallObject+0x20)[0x80624f0] /usr/lib/python2.6/dist-packages/gst-0.10/gst/_gst.so(+0x3f448)[0xace448] /usr/lib/libgstreamer-0.10.so.0(+0x2e325)[0x433325] /lib/libglib-2.0.so.0(g_main_context_dispatch+0x1d5)[0x5085e5] /lib/libglib-2.0.so.0(+0x3f2d8)[0x50c2d8] /lib/libglib-2.0.so.0(g_main_loop_run+0x187)[0x50c817] /usr/lib/pymodules/python2.6/gtk-2.0/glib/_glib.so(+0x81aa)[0x59f1aa] python(PyEval_EvalFrameEx+0x479c)[0x80e0f9c] python(PyEval_EvalCodeEx+0x857)[0x80e2807] python(PyEval_EvalCode+0x57)[0x80e2907] python(PyRun_FileExFlags+0x12d)[0x81005ad] python(PyRun_SimpleFileExFlags+0xc2)[0x8100812] python(Py_Main+0xadc)[0x805de5c] python(main+0x1b)[0x805d03b] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x278bd6] python[0x805cf81] ======= Memory map: ======== 00110000-00248000 r-xp 00000000 08:01 1133 /lib/i686/cmov/libcrypto.so.0.9.8 00248000-00250000 r--p 00137000 08:01 1133 /lib/i686/cmov/libcrypto.so.0.9.8 00250000-0025e000 rw-p 0013f000 08:01 1133 /lib/i686/cmov/libcrypto.so.0.9.8 0025e000-00262000 rw-p 00000000 00:00 0 00262000-003b5000 r-xp 00000000 08:01 131199 /lib/tls/i686/cmov/libc-2.11.1.so 003b5000-003b6000 ---p 00153000 08:01 131199 /lib/tls/i686/cmov/libc-2.11.1.so 003b6000-003b8000 r--p 00153000 08:01 131199 /lib/tls/i686/cmov/libc-2.11.1.so 003b8000-003b9000 rw-p 00155000 08:01 131199 /lib/tls/i686/cmov/libc-2.11.1.so 003b9000-003bc000 rw-p 00000000 00:00 0 003bc000-003c2000 r-xp 00000000 08:01 263155 /usr/lib/libgstnet-0.10.so.0.26.0 003c2000-003c3000 r--p 00005000 08:01 263155 /usr/lib/libgstnet-0.10.so.0.26.0 003c3000-003c4000 rw-p 00006000 08:01 263155 /usr/lib/libgstnet-0.10.so.0.26.0 003c4000-00403000 r-xp 00000000 08:01 264986 /usr/lib/libgstbase-0.10.so.0.26.0 00403000-00404000 r--p 0003e000 08:01 264986 /usr/lib/libgstbase-0.10.so.0.26.0 00404000-00405000 rw-p 0003f000 08:01 264986 /usr/lib/libgstbase-0.10.so.0.26.0 00405000-004c7000 r-xp 00000000 08:01 263471 /usr/lib/libgstreamer-0.10.so.0.26.0 004c7000-004ca000 r--p 000c1000 08:01 263471 /usr/lib/libgstreamer-0.10.so.0.26.0 004ca000-004cc000 rw-p 000c4000 08:01 263471 /usr/lib/libgstreamer-0.10.so.0.26.0 004cc000-004cd000 rw-p 00000000 00:00 0 004cd000-00595000 r-xp 00000000 08:01 753 /lib/libglib-2.0.so.0.2400.1 00595000-00596000 r--p 000c7000 08:01 753 /lib/libglib-2.0.so.0.2400.1 00596000-00597000 rw-p 000c8000 08:01 753 /lib/libglib-2.0.so.0.2400.1 00597000-005a4000 r-xp 00000000 08:01 760897 /usr/lib/pyshared/python2.6/gtk-2.0/glib/_glib.so 005a4000-005a5000 r--p 0000c000 08:01 760897 /usr/lib/pyshared/python2.6/gtk-2.0/glib/_glib.so 005a5000-005a7000 rw-p 0000d000 08:01 760897 /usr/lib/pyshared/python2.6/gtk-2.0/glib/_glib.so 005a7000-005c3000 r-xp 00000000 08:01 760896 /usr/lib/pyshared/python2.6/gtk-2.0/gobject/_gobject.so 005c3000-005c4000 r--p 0001b000 08:01 760896 /usr/lib/pyshared/python2.6/gtk-2.0/gobject/_gobject.so 005c4000-005c6000 rw-p 0001c000 08:01 760896 /usr/lib/pyshared/python2.6/gtk-2.0/gobject/_gobject.so 005c6000-005cc000 r-xp 00000000 08:01 131210 /lib/tls/i686/cmov/libnss_compat-2.11.1.so 005cc000-005cd000 r--p 00006000 08:01 131210 /lib/tls/i686/cmov/libnss_compat-2.11.1.so 005cd000-005ce000 rw-p 00007000 08:01 131210 /lib/tls/i686/cmov/libnss_compat-2.11.1.so 005ce000-005d5000 r-xp 00000000 08:01 266874 /usr/lib/libgstvideo-0.10.so.0.21.0 005d5000-005d6000 r--p 00006000 08:01 266874 /usr/lib/libgstvideo-0.10.so.0.21.0 005d6000-005d7000 rw-p 00007000 08:01 266874 /usr/lib/libgstvideo-0.10.so.0.21.0 005d7000-00617000 r-xp 00000000 08:01 526211 /usr/lib/pyshared/python2.6/libxml2mod.so 00617000-00618000 r--p 0003f000 08:01 526211 /usr/lib/pyshared/python2.6/libxml2mod.so 00618000-0061d000 rw-p 00040000 08:01 526211 /usr/lib/pyshared/python2.6/libxml2mod.so 0061d000-00630000 r-xp 00000000 08:01 131209 /lib/tls/i686/cmov/libnsl-2.11.1.so 00630000-00631000 r--p 00012000 08:01 131209 /lib/tls/i686/cmov/libnsl-2.11.1.so 00631000-00632000 rw-p 00013000 08:01 131209 /lib/tls/i686/cmov/libnsl-2.11.1.so 00632000-00634000 rw-p 00000000 00:00 0 00634000-0063e000 r-xp 00000000 08:01 131212 /lib/tls/i686/cmov/libnss_files-2.11.1.so 0063e000-0063f000 r--p 00009000 08:01 131212 /lib/tls/i686/cmov/libnss_files-2.11.1.so 0063f000-00640000 rw-p 0000a000 08:01 131212 /lib/tls/i686/cmov/libnss_files-2.11.1.so 00640000-0064d000 r-xp 00000000 08:01 1048967 /usr/lib/python2.6/dist-packages/gst-0.10/gst/interfaces.soAborted
Irks, thousand times sorry. Bug in the mp3 decoder element. The example works fine. Edward, okay to add this after the freeze?
commit b921832369de0a84db57389749b4c9ed0091f016 Author: Артём Попов <artfwo@gmail.com> Date: Tue Sep 7 14:28:14 2010 +0300 examples: add an example to show looping using segments Fixes #339772.