[FFmpeg-cvslog] pam: Fix a typo that broke writing and reading PAM files.

Carl Eugen Hoyos git at videolan.org
Mon Jan 23 01:18:13 CET 2012


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Wed Dec 28 05:54:59 2011 +0100| [66b9d7065a5c01bcf6b5d5325fd9b9d4132e7e6f] | committer: Janne Grunau

pam: Fix a typo that broke writing and reading PAM files.

Reported and reviewed by Derek Buitenhuis.

Signed-off-by: Janne Grunau <janne-libav at jannau.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66b9d7065a5c01bcf6b5d5325fd9b9d4132e7e6f
---

 libavcodec/pamenc.c |    2 +-
 libavcodec/pnm.c    |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c
index 10960d5..e070ed4 100644
--- a/libavcodec/pamenc.c
+++ b/libavcodec/pamenc.c
@@ -78,7 +78,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
         return -1;
     }
     snprintf(s->bytestream, s->bytestream_end - s->bytestream,
-             "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLETYPE %s\nENDHDR\n",
+             "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
              w, h, depth, maxval, tuple_type);
     s->bytestream += strlen(s->bytestream);
 
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 54b55cf..f6e6d53 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -93,7 +93,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
             } else if (!strcmp(buf1, "MAXVAL")) {
                 pnm_get(s, buf1, sizeof(buf1));
                 maxval = strtol(buf1, NULL, 10);
-            } else if (!strcmp(buf1, "TUPLETYPE")) {
+            } else if (!strcmp(buf1, "TUPLTYPE") ||
+                       /* libavcodec used to write invalid files */
+                       !strcmp(buf1, "TUPLETYPE")) {
                 pnm_get(s, tuple_type, sizeof(tuple_type));
             } else if (!strcmp(buf1, "ENDHDR")) {
                 break;



More information about the ffmpeg-cvslog mailing list