[gst-devel] pygst and custom src problem
Paolo
paolo at eurika.net
Tue Jan 9 00:20:59 CET 2007
I have a problem with a custom src element.
I need a src that produce a video streaming from jpeg images. I've built
one deriving a class from pushsrc (or baseSrc) and it works if I use it
in a pipeline like:
mycustomsrc ! jpegdec ! queue ! xvimagesink
but if I insert a videorate plugin ( mysrc ! jpegdec ! videorate ! queue
! xvimagesink ) all the program freeze after 25 frame... the same happen
if I use it for generate a file like ogg or avi.
I try to follow some tricks from Edward Hervey (thank you very much
Edward), but again I'm not able to make this code work.
Someone can help me?
Thx,
Paolo
this is the code of my class:
######################################################
class FileSource(gst.BaseSrc):
__gsttemplates__ = (
gst.PadTemplate("src",
gst.PAD_SRC,
gst.PAD_ALWAYS,
gst.Caps("image/jpeg, framerate = (fraction) 25/1")
),)
__data = []
__current_index = 0
def __init__(self, name):
self.__gobject_init__()
self.append_image('img01.jpeg')
self.append_image('img02.jpeg')
self.append_image('img03.jpeg')
self.set_format(gst.FORMAT_TIME)
self.set_name(name)
def do_create(self, offset, size):
print self.__current_index, offset, size
index = self.__current_index % len(self.__data)
buf = gst.Buffer( self.__data[index] )
buf.timestamp = self.__current_index * 40 * gst.MSECOND
buf.duration = 40 * gst.MSECOND
buf.offset = self.__current_index
self.__current_index += 1
buf.offset_end = self.__current_index
if self.__current_index < 500:
return gst.FLOW_OK, buf
else:
return gst.FLOW_UNEXPECTED, None
def append_image(self, filename):
f=open(filename, 'r')
data = f.read()
self.__data.append(data)
f.close()
######################################################
More information about the gstreamer-devel
mailing list