After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 595215 - PNM encoder doesn't support ASCII encoding
PNM encoder doesn't support ASCII encoding
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-14 22:02 UTC by Lutz Mueller
Modified: 2009-09-16 22:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add ASCII encoding support. (11.45 KB, patch)
2009-09-14 22:02 UTC, Lutz Mueller
needs-work Details | Review
Patch to add ASCII encoding support. (12.42 KB, patch)
2009-09-15 18:30 UTC, Lutz Mueller
committed Details | Review

Description Lutz Mueller 2009-09-14 22:02:55 UTC
Created attachment 143196 [details] [review]
Patch to add ASCII encoding support.

The PNM encoder doesn't support ASCII encoding (the decoder doesn't, neither,
but that's another story). Attached patch fixes this by adding an ascii
property to the encoder. If set to true (it is off by default), the encoder
produces files in ASCII encoding. While at it, I...
- fixed the example
- completed the documentation
- removed some unused code from gstpnmutils.[c,h]
- improved the readability of the code by splitting up type and encoding
Comment 1 Sebastian Dröge (slomo) 2009-09-15 08:11:31 UTC
Looks good, now only check in the decoder that the encoding is not ASCII and I'm going to commit this ;)

Also I think the ASCII encoding is wrong. You're outputting a \n after the first byte and then every 20 bytes.

What exactly is the difference between BITMAP and GRAYMAP?
Comment 2 Lutz Mueller 2009-09-15 18:30:29 UTC
Created attachment 143242 [details] [review]
Patch to add ASCII encoding support.

As requested, the decoder now refuses to handle ascii encoded files or files in bitmap format (1 pixel = 1 bit). I'll add this functionality later.

By the way, the Gimp can load the ascii encoded files generated by this encoder, therefore the ASCII encoding can't be that wrong... The '\n' is added after 20 bytes (= 80 characters) to make the display on terminals easier. See for instance Wikipedia for details on the PNM format.
Comment 3 Sebastian Dröge (slomo) 2009-09-16 06:23:23 UTC
Ok, I've committed this. One minor thing though: You should add the encoding to the caps IMHO, this way the decoder can already declare from the caps that it doesn't support ASCII. Also the ASCII property could go away then and it could be selected depending on downstream caps.


The problem with the ASCII encoding that I meant is, that you add a newline after the *first* byte (i == 0 && i % something == 0) and then after every 20 bytes (which is correct of course). That's not a real problem, it's just not beautiful ;)



commit 93172c445311eadeef82107382bcfccdb47d33dc
Author: Lutz Mueller <lutz@topfrose.de>
Date:   Wed Sep 16 08:22:19 2009 +0200

    pnm: Support ASCII format for encoding and handle unsupported formats better
    
    Fixes bug #595215.
Comment 4 David Schleef 2009-09-16 19:56:55 UTC
Any reason for not using gdkpixbuf for PxM encoding/decoding?
Comment 5 Lutz Mueller 2009-09-16 22:18:42 UTC
As far as I know, gdk-pixbuf can't be used for encoding.

By the way: ASCII decoding support now at #595409.