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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-30 09:00:15 UTC
  • mfrom: (1.1.16) (7.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130730090015-sc1ou2yssu7q5w4e
Tags: 1.1.3-1
* New upstream development snapshot:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.1.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * @see http://www.oldskool.org/pc/8088_Corruption
27
27
 */
28
28
 
 
29
#include <string.h>
 
30
 
29
31
#include "avcodec.h"
 
32
#include "internal.h"
 
33
#include "libavutil/internal.h"
30
34
 
31
35
#include "cga_data.h"
32
36
 
35
39
} TMVContext;
36
40
 
37
41
static int tmv_decode_frame(AVCodecContext *avctx, void *data,
38
 
                            int *data_size, AVPacket *avpkt)
 
42
                            int *got_frame, AVPacket *avpkt)
39
43
{
40
44
    TMVContext *tmv    = avctx->priv_data;
41
45
    const uint8_t *src = avpkt->data;
47
51
    if (tmv->pic.data[0])
48
52
        avctx->release_buffer(avctx, &tmv->pic);
49
53
 
50
 
    if (avctx->get_buffer(avctx, &tmv->pic) < 0) {
 
54
    if (ff_get_buffer(avctx, &tmv->pic) < 0) {
51
55
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
52
56
        return -1;
53
57
    }
55
59
    if (avpkt->size < 2*char_rows*char_cols) {
56
60
        av_log(avctx, AV_LOG_ERROR,
57
61
               "Input buffer too small, truncated sample?\n");
58
 
        *data_size = 0;
 
62
        *got_frame = 0;
59
63
        return -1;
60
64
    }
61
65
 
77
81
        dst += tmv->pic.linesize[0] * 8;
78
82
    }
79
83
 
80
 
    *data_size = sizeof(AVFrame);
 
84
    *got_frame = 1;
81
85
    *(AVFrame *)data = tmv->pic;
82
86
    return avpkt->size;
83
87
}
84
88
 
85
89
static av_cold int tmv_decode_init(AVCodecContext *avctx)
86
90
{
87
 
    avctx->pix_fmt = PIX_FMT_PAL8;
 
91
    avctx->pix_fmt = AV_PIX_FMT_PAL8;
88
92
    return 0;
89
93
}
90
94
 
101
105
AVCodec ff_tmv_decoder = {
102
106
    .name           = "tmv",
103
107
    .type           = AVMEDIA_TYPE_VIDEO,
104
 
    .id             = CODEC_ID_TMV,
 
108
    .id             = AV_CODEC_ID_TMV,
105
109
    .priv_data_size = sizeof(TMVContext),
106
110
    .init           = tmv_decode_init,
107
111
    .close          = tmv_decode_close,