snd_pcm_uframes_t buffer_size, period_size;
uint64_t layout = ctx->streams[0]->codecpar->channel_layout;
- if (ctx->filename[0] == 0) audio_device = "default";
- else audio_device = ctx->filename;
+ if (ctx->url[0] == 0) audio_device = "default";
+ else audio_device = ctx->url;
if (*codec_id == AV_CODEC_ID_NONE)
*codec_id = DEFAULT_CODEC_ID;
static void parse_device_name(AVFormatContext *s)
{
AVFContext *ctx = (AVFContext*)s->priv_data;
- char *tmp = av_strdup(s->filename);
+ char *tmp = av_strdup(s->url);
char *save;
if (tmp[0] != ':') {
st->codecpar->height = s->height;
st->avg_frame_rate = framerate;
- if (bktr_init(s1->filename, s->width, s->height, s->standard,
+ if (bktr_init(s1->url, s->width, s->height, s->standard,
&s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
ret = AVERROR(EIO);
goto out;
}
if (!c->window_title)
- c->window_title = av_strdup(s->filename);
+ c->window_title = av_strdup(s->url);
caca_set_display_title(c->display, c->window_title);
caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q));
}
av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription",
- avctx->filename);
+ avctx->url);
while (itermode->Next(&mode) == S_OK) {
BMDTimeValue tb_num, tb_den;
mode->GetFrameRate(&tb_num, &tb_den);
cctx->raw_format = MKBETAG('v','2','1','0');
}
- strcpy (fname, avctx->filename);
+ av_strlcpy(fname, avctx->url, sizeof(fname));
tmp=strchr (fname, '@');
if (tmp != NULL) {
av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will be removed. Please use the -format_code option.\n");
/* Get input device. */
if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n",
- avctx->filename);
+ avctx->url);
ret = AVERROR(EIO);
goto error;
}
return AVERROR_EXIT;
}
- ret = ff_decklink_init_device(avctx, avctx->filename);
+ ret = ff_decklink_init_device(avctx, avctx->url);
if (ret < 0)
return ret;
/* Get output device. */
if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",
- avctx->filename);
+ avctx->url);
ret = AVERROR(EIO);
goto error;
}
{
struct dshow_ctx *ctx = avctx->priv_data;
char **device_name = ctx->device_name;
- char *name = av_strdup(avctx->filename);
+ char *name = av_strdup(avctx->url);
char *tmp = name;
int ret = 1;
char *type;
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
flags |= O_NONBLOCK;
- if (avctx->filename[0])
- device = avctx->filename;
+ if (avctx->url[0])
+ device = avctx->url;
else
device = ff_fbdev_default_device();
return AVERROR(EINVAL);
}
- if (h->filename[0])
- device = h->filename;
+ if (h->url[0])
+ device = h->url;
else
device = ff_fbdev_default_device();
HBITMAP hbmp = NULL;
void *buffer = NULL;
- const char *filename = s1->filename;
+ const char *filename = s1->url;
const char *name = NULL;
AVStream *st = NULL;
goto fail;
}
- inport = strtol(context->filename, &endptr, 10);
- if (endptr != context->filename && *endptr == '\0') {
+ inport = strtol(context->url, &endptr, 10);
+ if (endptr != context->url && *endptr == '\0') {
av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
j = inport;
nb_ports = inport + 1;
- } else if (strcmp(context->filename, "auto")) {
+ } else if (strcmp(context->url, "auto")) {
av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "
- "\"auto\" for auto-detection, or the port number.\n", context->filename);
+ "\"auto\" for auto-detection, or the port number.\n", context->url);
goto fail;
}
jack_status_t status;
int i, test;
- /* Register as a JACK client, using the context filename as client name. */
- self->client = jack_client_open(context->filename, JackNullOption, &status);
+ /* Register as a JACK client, using the context url as client name. */
+ self->client = jack_client_open(context->url, JackNullOption, &status);
if (!self->client) {
av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n");
return AVERROR(EIO);
JackPortIsInput, 0);
if (!self->ports[i]) {
av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n",
- context->filename, str);
+ context->url, str);
jack_client_close(self->client);
return AVERROR(EIO);
}
}
if (!lavfi->graph_str)
- lavfi->graph_str = av_strdup(avctx->filename);
+ lavfi->graph_str = av_strdup(avctx->url);
/* parse the graph, create a stream for each open output */
if (!(lavfi->graph = avfilter_graph_alloc()))
if (!(st = avformat_new_stream(ctx, NULL)))
return AVERROR(ENOMEM);
- s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);
+ s->drive = cdio_cddap_identify(ctx->url, CDDA_MESSAGE_LOGIT, &err);
if (!s->drive) {
- av_log(ctx, AV_LOG_ERROR, "Could not open drive %s.\n", ctx->filename);
+ av_log(ctx, AV_LOG_ERROR, "Could not open drive %s.\n", ctx->url);
return AVERROR(EINVAL);
}
if (err) {
free(err);
}
if ((ret = cdio_cddap_open(s->drive)) < 0 || !s->drive->opened) {
- av_log(ctx, AV_LOG_ERROR, "Could not open disk in drive %s.\n", ctx->filename);
+ av_log(ctx, AV_LOG_ERROR, "Could not open disk in drive %s.\n", ctx->url);
return AVERROR(EINVAL);
}
}
/* Find available sources. */
- ret = ndi_find_sources(avctx, avctx->filename, &recv_create_desc.source_to_connect_to);
+ ret = ndi_find_sources(avctx, avctx->url, &recv_create_desc.source_to_connect_to);
if (ctx->find_sources) {
return AVERROR_EXIT;
}
int ret = 0;
unsigned int n;
struct NDIContext *ctx = avctx->priv_data;
- const NDIlib_send_create_t ndi_send_desc = { .p_ndi_name = avctx->filename,
+ const NDIlib_send_create_t ndi_send_desc = { .p_ndi_name = avctx->url,
.p_groups = NULL, .clock_video = ctx->clock_video, .clock_audio = ctx->clock_audio };
if (!NDIlib_initialize()) {
ctx->ndi_send = NDIlib_send_create(&ndi_send_desc);
if (!ctx->ndi_send) {
- av_log(avctx, AV_LOG_ERROR, "Failed to create NDI output %s\n", avctx->filename);
+ av_log(avctx, AV_LOG_ERROR, "Failed to create NDI output %s\n", avctx->url);
ret = AVERROR_EXTERNAL;
}
/* Open device for capture */
ad->device =
- alcCaptureOpenDevice(ctx->filename[0] ? ctx->filename : NULL,
+ alcCaptureOpenDevice(ctx->url[0] ? ctx->url : NULL,
ad->sample_rate,
ad->sample_format,
ad->sample_rate); /* Maximum 1 second of sample data to be read at once */
opengl->window_height = opengl->height;
if (!opengl->window_title && !opengl->no_window)
- opengl->window_title = av_strdup(h->filename);
+ opengl->window_title = av_strdup(h->url);
if ((ret = opengl_create_window(h)))
goto fail;
return AVERROR(ENOMEM);
}
- ret = ff_oss_audio_open(s1, 0, s1->filename);
+ ret = ff_oss_audio_open(s1, 0, s1->url);
if (ret < 0) {
return AVERROR(EIO);
}
st = s1->streams[0];
s->sample_rate = st->codecpar->sample_rate;
s->channels = st->codecpar->channels;
- ret = ff_oss_audio_open(s1, 1, s1->filename);
+ ret = ff_oss_audio_open(s1, 1, s1->url);
if (ret < 0) {
return AVERROR(EIO);
} else {
attr.fragsize = pd->fragment_size;
- if (s->filename[0] != '\0' && strcmp(s->filename, "default"))
- device = s->filename;
+ if (s->url[0] != '\0' && strcmp(s->url, "default"))
+ device = s->url;
if (!(pd->mainloop = pa_threaded_mainloop_new())) {
pulse_close(s);
st = h->streams[0];
if (!stream_name) {
- if (h->filename[0])
- stream_name = h->filename;
+ if (h->url[0])
+ stream_name = h->url;
else
stream_name = "Playback";
}
int flags = 0;
if (!sdl->window_title)
- sdl->window_title = av_strdup(s->filename);
+ sdl->window_title = av_strdup(s->url);
if (SDL_WasInit(SDL_INIT_VIDEO)) {
av_log(s, AV_LOG_WARNING,
if (!st)
return AVERROR(ENOMEM);
- ret = ff_sndio_open(s1, 0, s1->filename);
+ ret = ff_sndio_open(s1, 0, s1->url);
if (ret < 0)
return ret;
s->sample_rate = st->codecpar->sample_rate;
s->channels = st->codecpar->channels;
- ret = ff_sndio_open(s1, 1, s1->filename);
+ ret = ff_sndio_open(s1, 1, s1->url);
return ret;
}
int index;
};
-static int device_open(AVFormatContext *ctx)
+static int device_open(AVFormatContext *ctx, const char* device_path)
{
struct video_data *s = ctx->priv_data;
struct v4l2_capability cap;
flags |= O_NONBLOCK;
}
- fd = v4l2_open(ctx->filename, flags, 0);
+ fd = v4l2_open(device_path, flags, 0);
if (fd < 0) {
err = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s: %s\n",
- ctx->filename, av_err2str(err));
+ device_path, av_err2str(err));
return err;
}
v4l2_log_file = fopen("/dev/null", "w");
#endif
- s->fd = device_open(ctx);
+ s->fd = device_open(ctx, ctx->url);
if (s->fd < 0)
return s->fd;
return ret;
}
while ((entry = readdir(dir))) {
+ char device_name[256];
+
if (!v4l2_is_v4l_dev(entry->d_name))
continue;
- snprintf(ctx->filename, sizeof(ctx->filename), "/dev/%s", entry->d_name);
- if ((s->fd = device_open(ctx)) < 0)
+ snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
+ if ((s->fd = device_open(ctx, device_name)) < 0)
continue;
if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) {
ret = AVERROR(ENOMEM);
goto fail;
}
- device->device_name = av_strdup(ctx->filename);
+ device->device_name = av_strdup(device_name);
device->device_description = av_strdup(cap.card);
if (!device->device_name || !device->device_description) {
ret = AVERROR(ENOMEM);
if (s1->flags & AVFMT_FLAG_NONBLOCK)
flags |= O_NONBLOCK;
- s->fd = open(s1->filename, flags);
+ s->fd = open(s1->url, flags);
if (s->fd < 0) {
res = AVERROR(errno);
- av_log(s1, AV_LOG_ERROR, "Unable to open V4L2 device '%s'\n", s1->filename);
+ av_log(s1, AV_LOG_ERROR, "Unable to open V4L2 device '%s'\n", s1->url);
return res;
}
int ret;
AVRational framerate_q;
- if (!strcmp(s->filename, "list")) {
+ if (!strcmp(s->url, "list")) {
for (devnum = 0; devnum <= 9; devnum++) {
char driver_name[256];
char driver_ver[256];
}
/* If atoi fails, devnum==0 and the default device is used */
- devnum = atoi(s->filename);
+ devnum = atoi(s->url);
ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
if(!ret) {
XCBGrabContext *c = s->priv_data;
int screen_num, ret;
const xcb_setup_t *setup;
- char *display_name = av_strdup(s->filename);
+ char *display_name = av_strdup(s->url);
if (!display_name)
return AVERROR(ENOMEM);
- if (!sscanf(s->filename, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
+ if (!sscanf(s->url, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
*display_name = 0;
- sscanf(s->filename, "+%d,%d", &c->x, &c->y);
+ sscanf(s->url, "+%d,%d", &c->x, &c->y);
}
c->conn = xcb_connect(display_name[0] ? display_name : NULL, &screen_num);
if ((ret = xcb_connection_has_error(c->conn))) {
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
- s->filename[0] ? s->filename : "default", ret);
+ s->url[0] ? s->url : "default", ret);
return AVERROR(EIO);
}
xv->window_width, xv->window_height,
0, 0, 0);
if (!xv->window_title) {
- if (!(xv->window_title = av_strdup(s->filename))) {
+ if (!(xv->window_title = av_strdup(s->url))) {
ret = AVERROR(ENOMEM);
goto fail;
}