Custom Src

146 views
Skip to first unread message

Castillejos Nicolas

unread,
Jun 28, 2016, 11:08:36 AM6/28/16
to gstreamer-java
Hi, 

I'm trying to make my custom Java Input Stream Src Element with GStreamer 1.0 in Java,
I've tried to convert some code I've found on the internet for older version of gstreamer,
But it always fails when my new custom class try to register to GOBJECT_API with the method g_type_register_static()
The returned GType got its size equals to 0.
And I got these exceptions :

(javaw.exe:4552): GLib-GObject-WARNING **: specified instance size for type 'AllInclusive' is smaller than the parent type's 'GstBaseSrc' instance size

(javaw.exe:4552): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid native pointer
at org.freedesktop.gstreamer.lowlevel.NativeObject.initializer(NativeObject.java:71)
at org.freedesktop.gstreamer.GstObject.initializer(GstObject.java:57)
at com.swingws.shaft.mosaic.gstreamer.elements.customsrc.AllInclusive.<init>(AllInclusive.java:96)

I've put my custom class in attachment,

Do you know why it is not working properly ?

Thank you,

Nicolas

AllInclusive.java

Castillejos Nicolas

unread,
Jun 29, 2016, 5:22:03 AM6/29/16
to gstreamer-java
I've finally corrected this error by modifying the class_size and instance_size

//  ginfo.class_size = (short)new BaseSrcAPI.GstBaseSrcClass().size();
// ginfo.instance_size = (short)new BaseSrcAPI.GstBaseSrcStruct().size();
ginfo.class_size = BaseSrcAPI.BASESRC_API.gst_base_src_get_type().shortValue();
ginfo.instance_size = BaseSrcAPI.BASESRC_API.gst_base_src_get_type().shortValue();

I don't really know if what I'm doing is right but now it go further...
But it fails on this error now :
WARNING: no real random source present!
0:00:05.221272057  3580   1751A800 ERROR                basesrc gstbasesrc.c:3462:gst_base_src_start_complete:<input file> Failed to perform initial seek



you can see my pipeline construction here :

 Element src = ElementFactory.make("filesrc", "filesrc");
src.set("location", fileName);
Bin decodeBin =  (Bin)ElementFactory.make("decodebin", "Decode Bin");
Pipeline pipe = new Pipeline("main pipeline");
pipe.addMany(src, decodeBin);
src.link(decodeBin);
 
pipe.addMany(videoComponent);
decodeBin.link(videoComponent);

   
        pipe.play();
        Gst.main();

I've tested this pipeline with the command line "gst-launch-1.0.exe filesrc location=test.m4v ! decodebin ! autovideosink"
to be sure it can read my m4v file and it works fine.
But in java it result with the error "gst_base_src_start_complete:<input file> Failed to perform initial seek"

Do you know what's the problem ?

Neil C Smith

unread,
Jun 29, 2016, 6:02:45 AM6/29/16
to gstream...@googlegroups.com
On 29 June 2016 at 10:22, Castillejos Nicolas <djos...@gmail.com> wrote:
> Do you know what's the problem ?

I have no idea without spending more time than I have to look at it
right now. Not sure if anyone else on list has done this?

However, the obvious question in my mind is why you're not using
AppSrc? That may need a little work, as I'm not sure all aspects of
the binding are fully working yet, but it seems a much easier way to
do this unless I'm missing something in your requirements?

Best wishes,

Neil


--
Neil C Smith
Artist : Technologist : Adviser
http://neilcsmith.net

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Digital Prisoners - interactive spaces and projections -
www.digitalprisoners.co.uk

Castillejos Nicolas

unread,
Jun 30, 2016, 5:45:12 AM6/30/16
to gstreamer-java
Hi Neil,

I've tried what you have suggested usin appsrc,
Effectively, it seems more simple, but it fails with errors :

0:00:01.342831667  3888   1702E9F0 WARN                 qtdemux qtdemux.c:5803:gst_qtdemux_process_adapter:<qtdemux0> Unknown fourcc while parsing header : free
0:00:01.417614030  3888   1702E9F0 WARN                 qtdemux qtdemux_types.c:221:qtdemux_type_get: unknown QuickTime node type uuid
0:00:01.417946974  3888   1702E9F0 WARN                 qtdemux qtdemux.c:7965:qtdemux_parse_segments:<qtdemux0> streaming; discarding edit list segments
0:00:01.418162991  3888   1702E9F0 WARN                 qtdemux qtdemux.c:7965:qtdemux_parse_segments:<qtdemux0> streaming; discarding edit list segments

it seems to go further, but I don't understand why qtdemux fails, because with the gst-launch command line , I use the same components that I use into my pipeline construction :

gst-launch-1.0.exe filesrc location=test.m4v ! decodebin ! autovideosink"

I've just replaced into javacode the file src by a appsrc where I feed myself the buffer.

I've put my code containing my pipeline construction in attachment.

Do you have any idea ?


Le mardi 28 juin 2016 17:08:36 UTC+2, Castillejos Nicolas a écrit :
InputStreamJavaPlayer.java

Castillejos Nicolas

unread,
Jul 1, 2016, 4:11:40 AM7/1/16
to gstreamer-java
Hi Neil,

I've finally made my own detailed pipeline and it goes further,
It begins to work but it is stuck on the first picture.
I've put my class in attachment, it contains a main method to easily test it, i've put the .m4v file I use to test too.
The DEBUG_GRAPH (dot->png) is in attachement , if you see something wrong.
Is it possible that you test it ? to see if you have the same behaviour (stuck on firts picture).

Thank you,

Nicolas Castillejos
InputStreamJavaPlayer.java
test.m4v
InputStreamJavaPlayer.png

Castillejos Nicolas

unread,
Jul 1, 2016, 5:13:38 AM7/1/16
to gstreamer-java
I forgot the DEBUG logs, i put it in attachment
debug_log.txt

Castillejos Nicolas

unread,
Jul 1, 2016, 10:53:40 AM7/1/16
to gstreamer-java
Ok I've found a solution !

But I don't know why I have to do this to get it work, if you could explain me, it would be great !
This is the modification I've made to get it Work :

1) setLive(true) on the AppSrc
2) Listen Bus messages : when the Video Bin Element State goes to GST_STATE_PAUSED , I do a "pipe.pause();" then "pipe.play();"

And the video start !!

For me it looks like a hack ... why do I have to do this ?
Reply all
Reply to author
Forward
0 new messages