GNOME Bugzilla – Bug 162137
PostScript plugin
Last modified: 2011-05-20 13:48:38 UTC
GStreamer currently does not support the PostScript format.
Created attachment 35178 [details] PostScript plugin for GStreamer The plugin is not yet fully functional. I submit it in order to announce my work on a PostScript plugin. Once it is fully functional, I'll post an update. Final goal: To be able to do gst-launch filesrc location="test.jpeg" ! jpegdec ! postscriptenc ! filesink location="test.ps" and vice versa.
Created attachment 35737 [details] PostScript plugin for GStreamer The PostScript plugin can now (1) Encode videos/images in PostScript (2) Decode PostScript files in images For example, you can convert a PostScript file into a JPEG file by running gst-launch-0.8 filesrc location=test.ps ! postscriptdec type=4 ! filesink location=test.jpeg
Some comments: 1) PS <-> pnm doesn't look like most fortunate format choice, is there any specific reason not to use video/x-raw-rgb? I don't think we even have any plugin capable of dealing with pnm, unlike video/x-raw-rgb. So unless there's some significant loss of functionality, change that to video/x-raw-rgb, and leave manipulating pnm/png/jpeg their respective plugins. 2) Related to above, DON'T use property to choose output format. We have filtered caps for that, you should be using those (and I still hold there should be choice between at most vide/x-raw-rgb and video/x-raw-yuv, not other encoded image formats) 3) Style fixes: - mv gstpostscriptplugin.c gstpostscript.c, no need to specifically mark it's a plugin, it's kinda obvious when it resides in gst-plugins ;) - break long declaration lines, like 94 and following gstpostscriptdec.c, they are *way* too long. Use general gstreamer/GNOME formatting rules - I'd prefer s/Postscriptdec/PostscriptDec/, easier to read this way - Also, postscriptdec is very typing-unfriendly, but I guess simply "psdec" would have too high probability of clashes, right? Sigh, will need to live with that Otherwise, from quick compile and run, it seems to work nice. Didn't have time to look at source closely, will do sometime, preferably after the above suggestions are incorporated :)
Some comments: If you are going to spawn ghostscript, use pipes. Still there is much error correciton to be done. The encoder actually looks OK.
There is now an encoder using CAIRO in bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=331420. Once this encoder is in CVS, I'll start work on the postscript decoder again.
> Once this encoder is in CVS, I'll start work on the postscript decoder again. I guess this isn't really going to happen any longer, is it? Also, it looks like it's 0.8 code..
Why not? But again, let's first do the encoder (#331420).
The encoder is in gst-plugins-good now.
Created attachment 143547 [details] Makefile for the postscript plugin
Created attachment 143548 [details] gstpostscript.c
Created attachment 143549 [details] gstpostscriptdec.c
Created attachment 143550 [details] gstpostscriptdec.h The plugin has been tested with the following pipeline: filesrc ! postscriptdec ! "image/png" ! filesink.
Created attachment 143656 [details] gstpostscriptdec.c Same thing, but using pipes. Doesn't work yet, because gs needs a bit of time to convert, and I haven't figured out yet how the plugin can know when gs is done.
Created attachment 143657 [details] gstpostscriptdec.h
If you pass -dBATCH and -dNOPAUSE gs should exit after writing the last of the image data. Alternatively, you could link the the shared library and use the display device as described in http://ghostscript.com/doc/current/API.htm which will give you a callback on page completion. This means you'll only be able to support image/x-raw-rgb, but pngenc and jpegenc are of course available to pipeline users.
Yes, Ralphs suggesting to use the shared library sounds like the way to go. Calling and controlling other processes should always be the last thing to use if nothing else is possible IMHO
Created attachment 144025 [details] gstpostscriptdec.h
Created attachment 144027 [details] gstpostscriptdec.c filesrc ! postscriptdec ! "image/[png,jpeg]" ! filesink is now fully working. The plugin still uses pipes because ghostscript's header file gave me the creeps: * Current problems: * 1. Ghostscript does not support multiple instances. * 2. Global variables in gs_main_instance_default() * and gsapi_instance_counter I propose to use pipes as long as those issues persist.
Maybe using http://libspectre.freedesktop.org/wiki/ would be a solution. This is used by evince and evince supports multiple instances.
Lutz, I am assuming you are not working on this anymore. So I am closing this as wontfix.