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

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/v410dec.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:
20
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
21
 */
22
22
 
 
23
#include "libavutil/common.h"
23
24
#include "libavutil/intreadwrite.h"
24
25
#include "avcodec.h"
 
26
#include "internal.h"
25
27
 
26
28
static av_cold int v410_decode_init(AVCodecContext *avctx)
27
29
{
28
 
    avctx->pix_fmt             = PIX_FMT_YUV444P10;
 
30
    avctx->pix_fmt             = AV_PIX_FMT_YUV444P10;
29
31
    avctx->bits_per_raw_sample = 10;
30
32
 
31
33
    if (avctx->width & 1) {
32
 
        av_log(avctx, AV_LOG_ERROR, "v410 requires even width.\n");
33
 
        return AVERROR_INVALIDDATA;
 
34
        if (avctx->err_recognition & AV_EF_EXPLODE) {
 
35
            av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even.\n");
 
36
            return AVERROR_INVALIDDATA;
 
37
        } else {
 
38
            av_log(avctx, AV_LOG_WARNING, "v410 requires width to be even, continuing anyway.\n");
 
39
        }
34
40
    }
35
41
 
36
42
    avctx->coded_frame = avcodec_alloc_frame();
44
50
}
45
51
 
46
52
static int v410_decode_frame(AVCodecContext *avctx, void *data,
47
 
                             int *data_size, AVPacket *avpkt)
 
53
                             int *got_frame, AVPacket *avpkt)
48
54
{
49
55
    AVFrame *pic = avctx->coded_frame;
50
56
    uint8_t *src = avpkt->data;
62
68
 
63
69
    pic->reference = 0;
64
70
 
65
 
    if (avctx->get_buffer(avctx, pic) < 0) {
 
71
    if (ff_get_buffer(avctx, pic) < 0) {
66
72
        av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
67
73
        return AVERROR(ENOMEM);
68
74
    }
90
96
        v += pic->linesize[2] >> 1;
91
97
    }
92
98
 
93
 
    *data_size = sizeof(AVFrame);
 
99
    *got_frame = 1;
94
100
    *(AVFrame *)data = *pic;
95
101
 
96
102
    return avpkt->size;
109
115
AVCodec ff_v410_decoder = {
110
116
    .name         = "v410",
111
117
    .type         = AVMEDIA_TYPE_VIDEO,
112
 
    .id           = CODEC_ID_V410,
 
118
    .id           = AV_CODEC_ID_V410,
113
119
    .init         = v410_decode_init,
114
120
    .decode       = v410_decode_frame,
115
121
    .close        = v410_decode_close,