summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/alsa-audio-dec.c8
-rw-r--r--libavdevice/bktr.c19
-rw-r--r--libavdevice/dv1394.c12
-rw-r--r--libavdevice/fbdev.c4
-rw-r--r--libavdevice/jack_audio.c24
-rw-r--r--libavdevice/oss_audio.c7
-rw-r--r--libavdevice/sndio_dec.c7
-rw-r--r--libavdevice/v4l.c10
-rw-r--r--libavdevice/v4l2.c21
-rw-r--r--libavdevice/vfwcap.c11
-rw-r--r--libavdevice/x11grab.c8
11 files changed, 18 insertions, 113 deletions
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 5e2f2a8897..11c6e92928 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -61,14 +61,6 @@ static av_cold int audio_read_header(AVFormatContext *s1,
enum CodecID codec_id;
double o;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->sample_rate > 0)
- s->sample_rate = ap->sample_rate;
-
- if (ap->channels > 0)
- s->channels = ap->channels;
-#endif
-
st = av_new_stream(s1, 0);
if (!st) {
av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 9c1afe518b..2792fcf07f 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -251,17 +251,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVRational framerate;
int ret = 0;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->standard) {
- if (!strcasecmp(ap->standard, "pal"))
- s->standard = PAL;
- else if (!strcasecmp(ap->standard, "secam"))
- s->standard = SECAM;
- else if (!strcasecmp(ap->standard, "ntsc"))
- s->standard = NTSC;
- }
-#endif
-
if ((ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
av_log(s1, AV_LOG_ERROR, "Could not parse video size '%s'.\n", s->video_size);
goto out;
@@ -281,14 +270,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate);
goto out;
}
-#if FF_API_FORMAT_PARAMETERS
- if (ap->width > 0)
- width = ap->width;
- if (ap->height > 0)
- height = ap->height;
- if (ap->time_base.num)
- framerate = (AVRational){ap->time_base.den, ap->time_base.num};
-#endif
st = av_new_stream(s1, 0);
if (!st) {
diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c
index 63eff2aec8..779117aee3 100644
--- a/libavdevice/dv1394.c
+++ b/libavdevice/dv1394.c
@@ -90,18 +90,6 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
if (!dv->dv_demux)
goto failed;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->standard) {
- if (!strcasecmp(ap->standard, "pal"))
- dv->format = DV1394_PAL;
- else
- dv->format = DV1394_NTSC;
- }
-
- if (ap->channel)
- dv->channel = ap->channel;
-#endif
-
/* Open and initialize DV1394 device */
dv->fd = open(context->filename, O_RDONLY);
if (dv->fd < 0) {
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index 8f7fc676ac..70a904c572 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -107,10 +107,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", fbdev->framerate);
return ret;
}
-#if FF_API_FORMAT_PARAMETERS
- if (ap->time_base.num)
- fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num};
-#endif
if (!(st = av_new_stream(avctx, 0)))
return AVERROR(ENOMEM);
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c
index f78a2c9164..bdf5eb8f9e 100644
--- a/libavdevice/jack_audio.c
+++ b/libavdevice/jack_audio.c
@@ -26,6 +26,7 @@
#include "libavutil/log.h"
#include "libavutil/fifo.h"
+#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "libavformat/timefilter.h"
#include "avdevice.h"
@@ -36,6 +37,7 @@
#define FIFO_PACKETS_NUM 16
typedef struct {
+ AVClass *class;
jack_client_t * client;
int activated;
sem_t packet_count;
@@ -136,7 +138,7 @@ static int supply_new_packets(JackData *self, AVFormatContext *context)
return 0;
}
-static int start_jack(AVFormatContext *context, AVFormatParameters *params)
+static int start_jack(AVFormatContext *context)
{
JackData *self = context->priv_data;
jack_status_t status;
@@ -153,7 +155,6 @@ static int start_jack(AVFormatContext *context, AVFormatParameters *params)
sem_init(&self->packet_count, 0, 0);
self->sample_rate = jack_get_sample_rate(self->client);
- self->nports = params->channels;
self->ports = av_malloc(self->nports * sizeof(*self->ports));
self->buffer_size = jack_get_buffer_size(self->client);
@@ -225,10 +226,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
AVStream *stream;
int test;
- if (params->sample_rate <= 0 || params->channels <= 0)
- return -1;
-
- if ((test = start_jack(context, params)))
+ if ((test = start_jack(context)))
return test;
stream = av_new_stream(context, 0);
@@ -314,6 +312,19 @@ static int audio_read_close(AVFormatContext *context)
return 0;
}
+#define OFFSET(x) offsetof(JackData, x)
+static const AVOption options[] = {
+ { "channels", "Number of audio channels.", OFFSET(nports), FF_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass jack_indev_class = {
+ .class_name = "JACK indev",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVInputFormat ff_jack_demuxer = {
"jack",
NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
@@ -323,4 +334,5 @@ AVInputFormat ff_jack_demuxer = {
audio_read_packet,
audio_read_close,
.flags = AVFMT_NOFILE,
+ .priv_class = &jack_indev_class,
};
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index a1f0cbd3d0..73cb575bb9 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -209,13 +209,6 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVStream *st;
int ret;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->sample_rate > 0)
- s->sample_rate = ap->sample_rate;
- if (ap->channels > 0)
- s->channels = ap->channels;
-#endif
-
st = av_new_stream(s1, 0);
if (!st) {
return AVERROR(ENOMEM);
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 3014fd2787..6e386c6d99 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -34,13 +34,6 @@ static av_cold int audio_read_header(AVFormatContext *s1,
AVStream *st;
int ret;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->sample_rate > 0)
- s->sample_rate = ap->sample_rate;
- if (ap->channels > 0)
- s->channels = ap->channels;
-#endif
-
st = av_new_stream(s1, 0);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index 28a4e94599..642af9529d 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -142,16 +142,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
/* set tv standard */
if (!ioctl(video_fd, VIDIOCGTUNER, &tuner)) {
-#if FF_API_FORMAT_PARAMETERS
- if (ap->standard) {
- if (!strcasecmp(ap->standard, "pal"))
- s->standard = VIDEO_MODE_PAL;
- else if (!strcasecmp(ap->standard, "secam"))
- s->standard = VIDEO_MODE_SECAM;
- else
- s->standard = VIDEO_MODE_NTSC;
- }
-#endif
tuner.mode = s->standard;
ioctl(video_fd, VIDIOCSTUNER, &tuner);
}
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 468c133f60..9682d21151 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -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);
@@ -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);
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 7279817529..b8b0e70c37 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -265,11 +265,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO);
}
-#if FF_API_FORMAT_PARAMETERS
- if (ap->time_base.num)
- framerate_q = (AVRational){ap->time_base.den, ap->time_base.num};
-#endif
-
ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
if(!ctx->hwnd) {
av_log(s, AV_LOG_ERROR, "Could not create capture window.\n");
@@ -327,12 +322,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail_bi;
}
}
-#if FF_API_FORMAT_PARAMETERS
- if (ap->width > 0)
- bi->bmiHeader.biWidth = ap->width;
- if (ap->height > 0)
- bi->bmiHeader.biHeight = ap->height;
-#endif
if (0) {
/* For testing yet unsupported compressions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index a41733480f..7debe9dcbb 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -183,14 +183,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
av_log(s1, AV_LOG_ERROR, "Could not parse framerate: %s.\n", x11grab->framerate);
goto out;
}
-#if FF_API_FORMAT_PARAMETERS
- if (ap->width > 0)
- x11grab->width = ap->width;
- if (ap->height > 0)
- x11grab->height = ap->height;
- if (ap->time_base.num)
- framerate = (AVRational){ap->time_base.den, ap->time_base.num};
-#endif
av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n",
s1->filename, dpyname, x_off, y_off, x11grab->width, x11grab->height);