summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/indevs.texi2
-rw-r--r--libavdevice/v4l2.c33
-rw-r--r--libavdevice/version.h2
3 files changed, 36 insertions, 1 deletions
diff --git a/doc/indevs.texi b/doc/indevs.texi
index 621e1de978..82d500dff8 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -596,6 +596,8 @@ the device.
Video4Linux2 devices usually support a limited set of
@var{width}x@var{height} sizes and framerates. You can check which are
supported using @command{-list_formats all} for Video4Linux2 devices.
+Some devices, like TV cards, support one or more standards. It is possible
+to list all the supported standards using @command{-list_standards all}.
Some usage examples of the video4linux2 devices with ffmpeg and ffplay:
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 5f0102746d..76b6d64717 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -116,6 +116,7 @@ struct video_data {
int channel;
char *pixel_format; /**< Set by a private option. */
int list_format; /**< Set by a private option. */
+ int list_standard; /**< Set by a private option. */
char *framerate; /**< Set by a private option. */
};
@@ -381,6 +382,30 @@ static void list_formats(AVFormatContext *ctx, int fd, int type)
}
}
+static void list_standards(AVFormatContext *ctx)
+{
+ int ret;
+ struct video_data *s = ctx->priv_data;
+ struct v4l2_standard standard;
+
+ if (s->std_id == 0)
+ return;
+
+ for (standard.index = 0; ; standard.index++) {
+ ret = v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard);
+ if (ret < 0) {
+ if (errno == EINVAL)
+ break;
+ else {
+ av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", strerror(errno));
+ return;
+ }
+ }
+ av_log(ctx, AV_LOG_INFO, "%2d, %16llx, %s\n",
+ standard.index, standard.id, standard.name);
+ }
+}
+
static int mmap_init(AVFormatContext *ctx)
{
int i, res;
@@ -824,6 +849,11 @@ static int v4l2_read_header(AVFormatContext *s1)
return AVERROR_EXIT;
}
+ if (s->list_standard) {
+ list_standards(s1);
+ return AVERROR_EXIT;
+ }
+
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
if (s->pixel_format) {
@@ -952,6 +982,9 @@ static const AVOption options[] = {
{ "raw", "show only non-compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.i64 = V4L_RAWFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ "compressed", "show only compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.i64 = V4L_COMPFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "list_standards", "list supported standards and exit", OFFSET(list_standard), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, DEC, "list_standards" },
+ { "all", "show all supported standards", OFFSET(list_standard), AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, DEC, "list_standards" },
+
{ "timestamps", "set type of timestamps for grabbed frames", OFFSET(ts_mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, "timestamps" },
{ "ts", "set type of timestamps for grabbed frames", OFFSET(ts_mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, "timestamps" },
{ "default", "use timestamps from the kernel", OFFSET(ts_mode), AV_OPT_TYPE_CONST, {.i64 = V4L_TS_DEFAULT }, 0, 2, DEC, "timestamps" },
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 5eed4f5e1a..9e0c0ae940 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
#define LIBAVDEVICE_VERSION_MAJOR 54
#define LIBAVDEVICE_VERSION_MINOR 3
-#define LIBAVDEVICE_VERSION_MICRO 102
+#define LIBAVDEVICE_VERSION_MICRO 103
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \