~ubuntu-branches/ubuntu/trusty/gst-libav1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/pictordec.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-09-24 17:07:00 UTC
  • mfrom: (1.1.17) (7.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20130924170700-4dg62s3pwl0pdakz
Tags: 1.2.0-1
* New upstream stable release:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "avcodec.h"
29
29
#include "bytestream.h"
30
30
#include "cga_data.h"
 
31
#include "internal.h"
31
32
 
32
33
typedef struct PicContext {
33
34
    AVFrame frame;
97
98
};
98
99
 
99
100
static int decode_frame(AVCodecContext *avctx,
100
 
                        void *data, int *data_size,
 
101
                        void *data, int *got_frame,
101
102
                        AVPacket *avpkt)
102
103
{
103
104
    PicContext *s = avctx->priv_data;
121
122
    s->nb_planes   = (tmp >> 4) + 1;
122
123
    bpp            = bits_per_plane * s->nb_planes;
123
124
    if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
124
 
        av_log_ask_for_sample(s, "unsupported bit depth\n");
125
 
        return AVERROR_INVALIDDATA;
 
125
        av_log_ask_for_sample(avctx, "unsupported bit depth\n");
 
126
        return AVERROR_PATCHWELCOME;
126
127
    }
127
128
 
128
129
    if (bytestream2_peek_byte(&s->g) == 0xFF) {
136
137
        esize = 0;
137
138
    }
138
139
 
139
 
    avctx->pix_fmt = PIX_FMT_PAL8;
 
140
    avctx->pix_fmt = AV_PIX_FMT_PAL8;
140
141
 
141
142
    if (s->width != avctx->width && s->height != avctx->height) {
142
143
        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
146
147
            avctx->release_buffer(avctx, &s->frame);
147
148
    }
148
149
 
149
 
    if (avctx->get_buffer(avctx, &s->frame) < 0){
 
150
    if (ff_get_buffer(avctx, &s->frame) < 0){
150
151
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
151
152
        return -1;
152
153
    }
226
227
                if (bits_per_plane == 8) {
227
228
                    picmemset_8bpp(s, val, run, &x, &y);
228
229
                    if (y < 0)
229
 
                        break;
 
230
                        goto finish;
230
231
                } else {
231
232
                    picmemset(s, val, run, &x, &y, &plane, bits_per_plane);
232
233
                }
233
234
            }
234
235
        }
235
236
    } else {
236
 
        av_log_ask_for_sample(s, "uncompressed image\n");
 
237
        av_log_ask_for_sample(avctx, "uncompressed image\n");
237
238
        return avpkt->size;
238
239
    }
 
240
finish:
239
241
 
240
 
    *data_size = sizeof(AVFrame);
 
242
    *got_frame      = 1;
241
243
    *(AVFrame*)data = s->frame;
242
244
    return avpkt->size;
243
245
}
253
255
AVCodec ff_pictor_decoder = {
254
256
    .name           = "pictor",
255
257
    .type           = AVMEDIA_TYPE_VIDEO,
256
 
    .id             = CODEC_ID_PICTOR,
 
258
    .id             = AV_CODEC_ID_PICTOR,
257
259
    .priv_data_size = sizeof(PicContext),
258
260
    .close          = decode_end,
259
261
    .decode         = decode_frame,
260
262
    .capabilities   = CODEC_CAP_DR1,
261
 
    .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"),
 
263
    .long_name      = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"),
262
264
};