On Tue, 27 Dec 2011 07:51:20 +0100, Luca Barbato <[email protected]> wrote:
> Only mmap is supported.
> ---
>  libavdevice/v4l2.c |   43 +++++--------------------------------------
>  1 files changed, 5 insertions(+), 38 deletions(-)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index f6d003b..ee43ed7 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -52,17 +52,10 @@
>  
>  static const int desired_video_buffers = 256;
>  
> -enum io_method {
> -    io_read,
> -    io_mmap,
> -    io_userptr
> -};
> -
>  struct video_data {
>      AVClass *class;
>      int fd;
>      int frame_format; /* V4L2_PIX_FMT_* */
> -    enum io_method io_method;
>      int width, height;
>      int frame_size;
>      int interlaced;
> @@ -336,11 +329,6 @@ static int mmap_init(AVFormatContext *ctx)
>      return 0;
>  }
>  
> -static int read_init(AVFormatContext *ctx)
> -{
> -    return -1;
> -}
> -
>  static void mmap_release_buffer(AVPacket *pkt)
>  {
>      struct v4l2_buffer buf;
> @@ -421,11 +409,6 @@ static int mmap_read_frame(AVFormatContext *ctx, 
> AVPacket *pkt)
>      return s->buf_len[buf.index];
>  }
>  
> -static int read_frame(AVFormatContext *ctx, AVPacket *pkt)
> -{
> -    return -1;
> -}
> -
>  static int mmap_start(AVFormatContext *ctx)
>  {
>      struct video_data *s = ctx->priv_data;
> @@ -693,14 +676,10 @@ static int v4l2_read_header(AVFormatContext *s1, 
> AVFormatParameters *ap)
>          avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
>  
>      if (capabilities & V4L2_CAP_STREAMING) {
> -        s->io_method = io_mmap;
> -        res = mmap_init(s1);
> -        if (res == 0) {
> +        if (!(res = mmap_init(s1)))
>              res = mmap_start(s1);
> -        }
>      } else {
> -        s->io_method = io_read;
> -        res = read_init(s1);
> +        res = -1;

AVERROR(ENOSYS) maybe?
And an error message would be nice too.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to