~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavdevice/libdc1394.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#define DC1394_FRAMERATE_240   FRAMERATE_240
49
49
#endif
50
50
 
51
 
#undef free
52
 
 
53
51
typedef struct dc1394_data {
54
52
    AVClass *class;
55
53
#if HAVE_LIBDC1394_1
73
71
struct dc1394_frame_format {
74
72
    int width;
75
73
    int height;
76
 
    enum PixelFormat pix_fmt;
 
74
    enum AVPixelFormat pix_fmt;
77
75
    int frame_size_id;
78
76
} dc1394_frame_formats[] = {
79
 
    { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
80
 
    { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
81
 
    { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
 
77
    { 320, 240, AV_PIX_FMT_UYVY422,   DC1394_VIDEO_MODE_320x240_YUV422 },
 
78
    { 640, 480, AV_PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
 
79
    { 640, 480, AV_PIX_FMT_UYVY422,   DC1394_VIDEO_MODE_640x480_YUV422 },
82
80
    { 0, 0, 0, 0 } /* gotta be the last one */
83
81
};
84
82
 
101
99
#define DEC AV_OPT_FLAG_DECODING_PARAM
102
100
static const AVOption options[] = {
103
101
#if HAVE_LIBDC1394_1
104
 
    { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 
102
    { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
105
103
#endif
106
104
    { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC },
107
105
    { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = "uyvy422"}, 0, 0, DEC },
117
115
};
118
116
 
119
117
 
120
 
static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
 
118
static inline int dc1394_read_common(AVFormatContext *c,
121
119
                                     struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps)
122
120
{
123
121
    dc1394_data* dc1394 = c->priv_data;
124
122
    AVStream* vst;
125
123
    struct dc1394_frame_format *fmt;
126
124
    struct dc1394_frame_rate *fps;
127
 
    enum PixelFormat pix_fmt;
 
125
    enum AVPixelFormat pix_fmt;
128
126
    int width, height;
129
127
    AVRational framerate;
130
128
    int ret = 0;
131
129
 
132
 
    if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) {
 
130
    if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == AV_PIX_FMT_NONE) {
133
131
        av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format);
134
132
        ret = AVERROR(EINVAL);
135
133
        goto out;
168
166
    }
169
167
    avpriv_set_pts_info(vst, 64, 1, 1000);
170
168
    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
171
 
    vst->codec->codec_id = CODEC_ID_RAWVIDEO;
 
169
    vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
172
170
    vst->codec->time_base.den = framerate.num;
173
171
    vst->codec->time_base.num = framerate.den;
174
172
    vst->codec->width = fmt->width;
191
189
}
192
190
 
193
191
#if HAVE_LIBDC1394_1
194
 
static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
 
192
static int dc1394_v1_read_header(AVFormatContext *c)
195
193
{
196
194
    dc1394_data* dc1394 = c->priv_data;
197
195
    AVStream* vst;
200
198
    struct dc1394_frame_format *fmt = NULL;
201
199
    struct dc1394_frame_rate *fps = NULL;
202
200
 
203
 
    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
 
201
    if (dc1394_read_common(c, &fmt, &fps) != 0)
204
202
        return -1;
205
203
 
206
204
    /* Now let us prep the hardware. */
285
283
}
286
284
 
287
285
#elif HAVE_LIBDC1394_2
288
 
static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
 
286
static int dc1394_v2_read_header(AVFormatContext *c)
289
287
{
290
288
    dc1394_data* dc1394 = c->priv_data;
291
289
    dc1394camera_list_t *list;
293
291
    struct dc1394_frame_format *fmt = NULL;
294
292
    struct dc1394_frame_rate *fps = NULL;
295
293
 
296
 
    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
 
294
    if (dc1394_read_common(c, &fmt, &fps) != 0)
297
295
       return -1;
298
296
 
299
297
    /* Now let us prep the hardware. */