~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/tscc.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        return -1;
89
89
    }
90
90
 
91
 
    zret = inflateReset(&(c->zstream));
 
91
    zret = inflateReset(&c->zstream);
92
92
    if (zret != Z_OK) {
93
93
        av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
94
94
        return -1;
97
97
    c->zstream.avail_in = len;
98
98
    c->zstream.next_out = c->decomp_buf;
99
99
    c->zstream.avail_out = c->decomp_size;
100
 
    zret = inflate(&(c->zstream), Z_FINISH);
 
100
    zret = inflate(&c->zstream, Z_FINISH);
101
101
    // Z_DATA_ERROR means empty picture
102
102
    if ((zret != Z_OK) && (zret != Z_STREAM_END) && (zret != Z_DATA_ERROR)) {
103
103
        av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
143
143
    c->height = avctx->height;
144
144
 
145
145
    // Needed if zlib unused or init aborted before inflateInit
146
 
    memset(&(c->zstream), 0, sizeof(z_stream));
 
146
    memset(&c->zstream, 0, sizeof(z_stream));
147
147
    switch(avctx->bits_per_coded_sample){
148
148
    case  8: avctx->pix_fmt = PIX_FMT_PAL8; break;
149
149
    case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
155
155
             return -1;
156
156
    }
157
157
    c->bpp = avctx->bits_per_coded_sample;
158
 
    // buffer size for RLE 'best' case when 2-byte code preceeds each pixel and there may be padding after it too
 
158
    // buffer size for RLE 'best' case when 2-byte code precedes each pixel and there may be padding after it too
159
159
    c->decomp_size = (((avctx->width * c->bpp + 7) >> 3) + 3 * avctx->width + 2) * avctx->height + 2;
160
160
 
161
161
    /* Allocate decompression buffer */
169
169
    c->zstream.zalloc = Z_NULL;
170
170
    c->zstream.zfree = Z_NULL;
171
171
    c->zstream.opaque = Z_NULL;
172
 
    zret = inflateInit(&(c->zstream));
 
172
    zret = inflateInit(&c->zstream);
173
173
    if (zret != Z_OK) {
174
174
        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
175
175
        return 1;
193
193
 
194
194
    if (c->pic.data[0])
195
195
        avctx->release_buffer(avctx, &c->pic);
196
 
    inflateEnd(&(c->zstream));
 
196
    inflateEnd(&c->zstream);
197
197
 
198
198
    return 0;
199
199
}
200
200
 
201
201
AVCodec ff_tscc_decoder = {
202
 
        "camtasia",
203
 
        AVMEDIA_TYPE_VIDEO,
204
 
        CODEC_ID_TSCC,
205
 
        sizeof(CamtasiaContext),
206
 
        decode_init,
207
 
        NULL,
208
 
        decode_end,
209
 
        decode_frame,
210
 
        CODEC_CAP_DR1,
211
 
        .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"),
 
202
    .name           = "camtasia",
 
203
    .type           = AVMEDIA_TYPE_VIDEO,
 
204
    .id             = CODEC_ID_TSCC,
 
205
    .priv_data_size = sizeof(CamtasiaContext),
 
206
    .init           = decode_init,
 
207
    .close          = decode_end,
 
208
    .decode         = decode_frame,
 
209
    .capabilities   = CODEC_CAP_DR1,
 
210
    .long_name      = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"),
212
211
};
213
212