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

« back to all changes in this revision

Viewing changes to libavcodec/dpx.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
 * DPX (.dpx) image decoder
3
3
 * Copyright (c) 2009 Jimmy Christensen
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
22
#include "libavutil/intreadwrite.h"
 
23
#include "libavutil/imgutils.h"
23
24
#include "bytestream.h"
24
25
#include "avcodec.h"
25
26
 
54
55
                        AVPacket *avpkt)
55
56
{
56
57
    const uint8_t *buf = avpkt->data;
 
58
    const uint8_t *buf_end = avpkt->data + avpkt->size;
57
59
    int buf_size       = avpkt->size;
58
60
    DPXContext *const s = avctx->priv_data;
59
61
    AVFrame *picture  = data;
139
141
 
140
142
    if (s->picture.data[0])
141
143
        avctx->release_buffer(avctx, &s->picture);
142
 
    if (avcodec_check_dimensions(avctx, w, h))
 
144
    if (av_image_check_size(w, h, 0, avctx))
143
145
        return -1;
144
146
    if (w != avctx->width || h != avctx->height)
145
147
        avcodec_set_dimensions(avctx, w, h);
171
173
        case 8:
172
174
        case 12: // Treat 12-bit as 16-bit
173
175
        case 16:
 
176
            if (source_packet_size*avctx->width*avctx->height > buf_end - buf) {
 
177
                av_log(avctx, AV_LOG_ERROR, "Overread buffer. Invalid header?\n");
 
178
                return -1;
 
179
            }
174
180
            if (source_packet_size == target_packet_size) {
175
181
                for (x = 0; x < avctx->height; x++) {
176
182
                    memcpy(ptr, buf, target_packet_size*avctx->width);
214
220
    return 0;
215
221
}
216
222
 
217
 
AVCodec dpx_decoder = {
 
223
AVCodec ff_dpx_decoder = {
218
224
    "dpx",
219
225
    AVMEDIA_TYPE_VIDEO,
220
226
    CODEC_ID_DPX,