~ubuntu-branches/debian/sid/gstreamer0.10-ffmpeg/sid

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavdevice/v4l.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-02-22 12:24:07 UTC
  • mfrom: (1.1.24 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090222122407-nubojphrd84klmee
Tags: 0.10.6-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
 
22
#undef __STRICT_ANSI__ //workaround due to broken kernel headers
22
23
#include "config.h"
23
 
#include "avformat.h"
24
 
#include "dsputil.h"
 
24
#include "libavformat/avformat.h"
 
25
#include "libavcodec/dsputil.h"
25
26
#include <unistd.h>
26
27
#include <fcntl.h>
27
28
#include <sys/ioctl.h>
30
31
#define _LINUX_TIME_H 1
31
32
#include <linux/videodev.h>
32
33
#include <time.h>
 
34
#include <strings.h>
33
35
 
34
36
typedef struct {
35
37
    int fd;
76
78
    struct video_audio audio;
77
79
    struct video_picture pict;
78
80
    int j;
79
 
    int vformat_num = sizeof(video_formats) / sizeof(video_formats[0]);
80
 
 
81
 
    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
82
 
        av_log(s1, AV_LOG_ERROR, "Bad capture size (%dx%d) or wrong time base (%d)\n",
83
 
            ap->width, ap->height, ap->time_base.den);
84
 
 
 
81
    int vformat_num = FF_ARRAY_ELEMS(video_formats);
 
82
 
 
83
    if (ap->width <= 0 || ap->height <= 0) {
 
84
        av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
 
85
        return -1;
 
86
    }
 
87
    if (ap->time_base.den <= 0) {
 
88
        av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
85
89
        return -1;
86
90
    }
87
91
 
258
262
 fail:
259
263
    if (video_fd >= 0)
260
264
        close(video_fd);
261
 
    av_free(st);
262
265
    return AVERROR(EIO);
263
266
}
264
267
 
346
349
 
347
350
AVInputFormat v4l_demuxer = {
348
351
    "video4linux",
349
 
    "video grab",
 
352
    NULL_IF_CONFIG_SMALL("video grab"),
350
353
    sizeof(VideoData),
351
354
    NULL,
352
355
    grab_read_header,