~siretart/libav/trusty

« back to all changes in this revision

Viewing changes to libavdevice/vfwcap.c

  • Committer: Reinhard Tartler
  • Date: 2013-10-23 03:04:17 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: siretart@tauware.de-20131023030417-1o6mpkl1l0raifjt
mergeĀ fromĀ debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    char *framerate;        /**< Set by a private option. */
48
48
};
49
49
 
50
 
static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
 
50
static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
51
51
{
52
52
    switch(biCompression) {
53
53
    case MKTAG('U', 'Y', 'V', 'Y'):
54
 
        return PIX_FMT_UYVY422;
 
54
        return AV_PIX_FMT_UYVY422;
55
55
    case MKTAG('Y', 'U', 'Y', '2'):
56
 
        return PIX_FMT_YUYV422;
 
56
        return AV_PIX_FMT_YUYV422;
57
57
    case MKTAG('I', '4', '2', '0'):
58
 
        return PIX_FMT_YUV420P;
 
58
        return AV_PIX_FMT_YUV420P;
59
59
    case BI_RGB:
60
60
        switch(biBitCount) { /* 1-8 are untested */
61
61
            case 1:
62
 
                return PIX_FMT_MONOWHITE;
 
62
                return AV_PIX_FMT_MONOWHITE;
63
63
            case 4:
64
 
                return PIX_FMT_RGB4;
 
64
                return AV_PIX_FMT_RGB4;
65
65
            case 8:
66
 
                return PIX_FMT_RGB8;
 
66
                return AV_PIX_FMT_RGB8;
67
67
            case 16:
68
 
                return PIX_FMT_RGB555;
 
68
                return AV_PIX_FMT_RGB555;
69
69
            case 24:
70
 
                return PIX_FMT_BGR24;
 
70
                return AV_PIX_FMT_BGR24;
71
71
            case 32:
72
 
                return PIX_FMT_RGB32;
 
72
                return AV_PIX_FMT_RGB32;
73
73
        }
74
74
    }
75
 
    return PIX_FMT_NONE;
 
75
    return AV_PIX_FMT_NONE;
76
76
}
77
77
 
78
 
static enum CodecID vfw_codecid(DWORD biCompression)
 
78
static enum AVCodecID vfw_codecid(DWORD biCompression)
79
79
{
80
80
    switch(biCompression) {
81
81
    case MKTAG('d', 'v', 's', 'd'):
82
 
        return CODEC_ID_DVVIDEO;
 
82
        return AV_CODEC_ID_DVVIDEO;
83
83
    case MKTAG('M', 'J', 'P', 'G'):
84
84
    case MKTAG('m', 'j', 'p', 'g'):
85
 
        return CODEC_ID_MJPEG;
 
85
        return AV_CODEC_ID_MJPEG;
86
86
    }
87
 
    return CODEC_ID_NONE;
 
87
    return AV_CODEC_ID_NONE;
88
88
}
89
89
 
90
90
#define dstruct(pctx, sname, var, type) \
238
238
    return 0;
239
239
}
240
240
 
241
 
static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
241
static int vfw_read_header(AVFormatContext *s)
242
242
{
243
243
    struct vfw_ctx *ctx = s->priv_data;
244
244
    AVCodecContext *codec;
376
376
    codec->width  = bi->bmiHeader.biWidth;
377
377
    codec->height = bi->bmiHeader.biHeight;
378
378
    codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
379
 
    if(codec->pix_fmt == PIX_FMT_NONE) {
 
379
    if(codec->pix_fmt == AV_PIX_FMT_NONE) {
380
380
        codec->codec_id = vfw_codecid(biCompression);
381
 
        if(codec->codec_id == CODEC_ID_NONE) {
 
381
        if(codec->codec_id == AV_CODEC_ID_NONE) {
382
382
            av_log(s, AV_LOG_ERROR, "Unknown compression type. "
383
383
                             "Please report verbose (-v 9) debug information.\n");
384
384
            vfw_read_close(s);
386
386
        }
387
387
        codec->bits_per_coded_sample = biBitCount;
388
388
    } else {
389
 
        codec->codec_id = CODEC_ID_RAWVIDEO;
 
389
        codec->codec_id = AV_CODEC_ID_RAWVIDEO;
390
390
        if(biCompression == BI_RGB) {
391
391
            codec->bits_per_coded_sample = biBitCount;
392
392
            codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE);