]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/v4l2.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavdevice / v4l2.c
index 468c133f60e7011d64157fca25d7c57b5590abc0..468d4c168710299e9350a1868aa02e4c702f84a3 100644 (file)
@@ -447,12 +447,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
         av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate);
         return ret;
     }
-#if FF_API_FORMAT_PARAMETERS
-    if (ap->channel > 0)
-        s->channel = ap->channel;
-    if (ap->time_base.num)
-        framerate_q = (AVRational){ap->time_base.den, ap->time_base.num};
-#endif
 
     /* set tv video input */
     input.index = s->channel;
@@ -469,13 +463,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
         return AVERROR(EIO);
     }
 
-#if FF_API_FORMAT_PARAMETERS
-    if (ap->standard) {
-        av_freep(&s->standard);
-        s->standard = av_strdup(ap->standard);
-    }
-#endif
-
     if (s->standard) {
         av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
                s->standard);
@@ -573,7 +560,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     enum CodecID codec_id;
     enum PixelFormat pix_fmt = PIX_FMT_NONE;
 
-    st = av_new_stream(s1, 0);
+    st = avformat_new_stream(s1, NULL);
     if (!st) {
         res = AVERROR(ENOMEM);
         goto out;
@@ -589,14 +576,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         res = AVERROR(EINVAL);
         goto out;
     }
-#if FF_API_FORMAT_PARAMETERS
-    if (ap->width > 0)
-        s->width  = ap->width;
-    if (ap->height > 0)
-        s->height = ap->height;
-    if (ap->pix_fmt)
-        pix_fmt = ap->pix_fmt;
-#endif
 
     capabilities = 0;
     s->fd = device_open(s1, &capabilities);
@@ -710,11 +689,11 @@ static int v4l2_read_close(AVFormatContext *s1)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 
 static const AVOption options[] = {
-    { "standard", "", OFFSET(standard), FF_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
-    { "channel",  "", OFFSET(channel),  FF_OPT_TYPE_INT,    {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
-    { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
-    { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
-    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+    { "standard", "", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+    { "channel",  "", OFFSET(channel),  AV_OPT_TYPE_INT,    {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+    { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+    { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
     { NULL },
 };
 
@@ -726,13 +705,12 @@ static const AVClass v4l2_class = {
 };
 
 AVInputFormat ff_v4l2_demuxer = {
-    "video4linux2",
-    NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
-    sizeof(struct video_data),
-    NULL,
-    v4l2_read_header,
-    v4l2_read_packet,
-    v4l2_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &v4l2_class,
+    .name           = "video4linux2",
+    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
+    .priv_data_size = sizeof(struct video_data),
+    .read_header    = v4l2_read_header,
+    .read_packet    = v4l2_read_packet,
+    .read_close     = v4l2_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &v4l2_class,
 };