~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavcodec/pnm.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * PNM image format
3
3
 * Copyright (c) 2002, 2003 Fabrice Bellard
4
4
 *
5
 
 * This file is part of FFmpeg.
 
5
 * This file is part of Libav.
6
6
 *
7
 
 * FFmpeg is free software; you can redistribute it and/or
 
7
 * Libav is free software; you can redistribute it and/or
8
8
 * modify it under the terms of the GNU Lesser General Public
9
9
 * License as published by the Free Software Foundation; either
10
10
 * version 2.1 of the License, or (at your option) any later version.
11
11
 *
12
 
 * FFmpeg is distributed in the hope that it will be useful,
 
12
 * Libav is distributed in the hope that it will be useful,
13
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
15
 * Lesser General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU Lesser General Public
18
 
 * License along with FFmpeg; if not, write to the Free Software
 
18
 * License along with Libav; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
 
22
#include "libavutil/imgutils.h"
22
23
#include "avcodec.h"
23
24
#include "pnm.h"
24
25
 
101
102
            }
102
103
        }
103
104
        /* check that all tags are present */
104
 
        if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || avcodec_check_dimensions(avctx, w, h))
 
105
        if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx))
105
106
            return -1;
106
107
 
107
108
        avctx->width  = w;
134
135
        return -1;
135
136
    pnm_get(s, buf1, sizeof(buf1));
136
137
    avctx->height = atoi(buf1);
137
 
    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
 
138
    if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
138
139
        return -1;
139
140
    if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
140
141
        pnm_get(s, buf1, sizeof(buf1));
141
142
        s->maxval = atoi(buf1);
 
143
        if (s->maxval <= 0) {
 
144
            av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval);
 
145
            s->maxval = 255;
 
146
        }
142
147
        if (s->maxval >= 256) {
143
148
            if (avctx->pix_fmt == PIX_FMT_GRAY8) {
144
149
                avctx->pix_fmt = PIX_FMT_GRAY16BE;