Commit 4bb04098 authored by Marton Balint's avatar Marton Balint

avdevice: migrate to AVFormatContext->url

Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 25a2d269
...@@ -177,8 +177,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, ...@@ -177,8 +177,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
snd_pcm_uframes_t buffer_size, period_size; snd_pcm_uframes_t buffer_size, period_size;
uint64_t layout = ctx->streams[0]->codecpar->channel_layout; uint64_t layout = ctx->streams[0]->codecpar->channel_layout;
if (ctx->filename[0] == 0) audio_device = "default"; if (ctx->url[0] == 0) audio_device = "default";
else audio_device = ctx->filename; else audio_device = ctx->url;
if (*codec_id == AV_CODEC_ID_NONE) if (*codec_id == AV_CODEC_ID_NONE)
*codec_id = DEFAULT_CODEC_ID; *codec_id = DEFAULT_CODEC_ID;
......
...@@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx) ...@@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx)
static void parse_device_name(AVFormatContext *s) static void parse_device_name(AVFormatContext *s)
{ {
AVFContext *ctx = (AVFContext*)s->priv_data; AVFContext *ctx = (AVFContext*)s->priv_data;
char *tmp = av_strdup(s->filename); char *tmp = av_strdup(s->url);
char *save; char *save;
if (tmp[0] != ':') { if (tmp[0] != ':') {
......
...@@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1) ...@@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1)
st->codecpar->height = s->height; st->codecpar->height = s->height;
st->avg_frame_rate = framerate; 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) { &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
ret = AVERROR(EIO); ret = AVERROR(EIO);
goto out; goto out;
......
...@@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s) ...@@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s)
} }
if (!c->window_title) 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_title(c->display, c->window_title);
caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q)); caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q));
......
...@@ -404,7 +404,7 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct ...@@ -404,7 +404,7 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct
} }
av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription", av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription",
avctx->filename); avctx->url);
while (itermode->Next(&mode) == S_OK) { while (itermode->Next(&mode) == S_OK) {
BMDTimeValue tb_num, tb_den; BMDTimeValue tb_num, tb_den;
mode->GetFrameRate(&tb_num, &tb_den); mode->GetFrameRate(&tb_num, &tb_den);
......
...@@ -951,7 +951,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) ...@@ -951,7 +951,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
cctx->raw_format = MKBETAG('v','2','1','0'); cctx->raw_format = MKBETAG('v','2','1','0');
} }
strcpy (fname, avctx->filename); av_strlcpy(fname, avctx->url, sizeof(fname));
tmp=strchr (fname, '@'); tmp=strchr (fname, '@');
if (tmp != NULL) { 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"); av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will be removed. Please use the -format_code option.\n");
...@@ -966,7 +966,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) ...@@ -966,7 +966,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
/* Get input device. */ /* Get input device. */
if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { 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", av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n",
avctx->filename); avctx->url);
ret = AVERROR(EIO); ret = AVERROR(EIO);
goto error; goto error;
} }
......
...@@ -400,14 +400,14 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) ...@@ -400,14 +400,14 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx)
return AVERROR_EXIT; return AVERROR_EXIT;
} }
ret = ff_decklink_init_device(avctx, avctx->filename); ret = ff_decklink_init_device(avctx, avctx->url);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Get output device. */ /* Get output device. */
if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) { 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", av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",
avctx->filename); avctx->url);
ret = AVERROR(EIO); ret = AVERROR(EIO);
goto error; goto error;
} }
......
...@@ -1033,7 +1033,7 @@ static int parse_device_name(AVFormatContext *avctx) ...@@ -1033,7 +1033,7 @@ static int parse_device_name(AVFormatContext *avctx)
{ {
struct dshow_ctx *ctx = avctx->priv_data; struct dshow_ctx *ctx = avctx->priv_data;
char **device_name = ctx->device_name; char **device_name = ctx->device_name;
char *name = av_strdup(avctx->filename); char *name = av_strdup(avctx->url);
char *tmp = name; char *tmp = name;
int ret = 1; int ret = 1;
char *type; char *type;
......
...@@ -78,8 +78,8 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) ...@@ -78,8 +78,8 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx)
if (avctx->flags & AVFMT_FLAG_NONBLOCK) if (avctx->flags & AVFMT_FLAG_NONBLOCK)
flags |= O_NONBLOCK; flags |= O_NONBLOCK;
if (avctx->filename[0]) if (avctx->url[0])
device = avctx->filename; device = avctx->url;
else else
device = ff_fbdev_default_device(); device = ff_fbdev_default_device();
......
...@@ -53,8 +53,8 @@ static av_cold int fbdev_write_header(AVFormatContext *h) ...@@ -53,8 +53,8 @@ static av_cold int fbdev_write_header(AVFormatContext *h)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (h->filename[0]) if (h->url[0])
device = h->filename; device = h->url;
else else
device = ff_fbdev_default_device(); device = ff_fbdev_default_device();
......
...@@ -230,7 +230,7 @@ gdigrab_read_header(AVFormatContext *s1) ...@@ -230,7 +230,7 @@ gdigrab_read_header(AVFormatContext *s1)
HBITMAP hbmp = NULL; HBITMAP hbmp = NULL;
void *buffer = NULL; void *buffer = NULL;
const char *filename = s1->filename; const char *filename = s1->url;
const char *name = NULL; const char *name = NULL;
AVStream *st = NULL; AVStream *st = NULL;
......
...@@ -259,14 +259,14 @@ static int iec61883_read_header(AVFormatContext *context) ...@@ -259,14 +259,14 @@ static int iec61883_read_header(AVFormatContext *context)
goto fail; goto fail;
} }
inport = strtol(context->filename, &endptr, 10); inport = strtol(context->url, &endptr, 10);
if (endptr != context->filename && *endptr == '\0') { if (endptr != context->url && *endptr == '\0') {
av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport); av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
j = inport; j = inport;
nb_ports = inport + 1; 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 " 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; goto fail;
} }
......
...@@ -150,8 +150,8 @@ static int start_jack(AVFormatContext *context) ...@@ -150,8 +150,8 @@ static int start_jack(AVFormatContext *context)
jack_status_t status; jack_status_t status;
int i, test; int i, test;
/* Register as a JACK client, using the context filename as client name. */ /* Register as a JACK client, using the context url as client name. */
self->client = jack_client_open(context->filename, JackNullOption, &status); self->client = jack_client_open(context->url, JackNullOption, &status);
if (!self->client) { if (!self->client) {
av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n"); av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n");
return AVERROR(EIO); return AVERROR(EIO);
...@@ -174,7 +174,7 @@ static int start_jack(AVFormatContext *context) ...@@ -174,7 +174,7 @@ static int start_jack(AVFormatContext *context)
JackPortIsInput, 0); JackPortIsInput, 0);
if (!self->ports[i]) { if (!self->ports[i]) {
av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n", av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n",
context->filename, str); context->url, str);
jack_client_close(self->client); jack_client_close(self->client);
return AVERROR(EIO); return AVERROR(EIO);
} }
......
...@@ -166,7 +166,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) ...@@ -166,7 +166,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
} }
if (!lavfi->graph_str) 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 */ /* parse the graph, create a stream for each open output */
if (!(lavfi->graph = avfilter_graph_alloc())) if (!(lavfi->graph = avfilter_graph_alloc()))
......
...@@ -60,9 +60,9 @@ static av_cold int read_header(AVFormatContext *ctx) ...@@ -60,9 +60,9 @@ static av_cold int read_header(AVFormatContext *ctx)
if (!(st = avformat_new_stream(ctx, NULL))) if (!(st = avformat_new_stream(ctx, NULL)))
return AVERROR(ENOMEM); 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) { 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); return AVERROR(EINVAL);
} }
if (err) { if (err) {
...@@ -70,7 +70,7 @@ static av_cold int read_header(AVFormatContext *ctx) ...@@ -70,7 +70,7 @@ static av_cold int read_header(AVFormatContext *ctx)
free(err); free(err);
} }
if ((ret = cdio_cddap_open(s->drive)) < 0 || !s->drive->opened) { 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); return AVERROR(EINVAL);
} }
......
...@@ -149,7 +149,7 @@ static int ndi_read_header(AVFormatContext *avctx) ...@@ -149,7 +149,7 @@ static int ndi_read_header(AVFormatContext *avctx)
} }
/* Find available sources. */ /* 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) { if (ctx->find_sources) {
return AVERROR_EXIT; return AVERROR_EXIT;
} }
......
...@@ -233,7 +233,7 @@ static int ndi_write_header(AVFormatContext *avctx) ...@@ -233,7 +233,7 @@ static int ndi_write_header(AVFormatContext *avctx)
int ret = 0; int ret = 0;
unsigned int n; unsigned int n;
struct NDIContext *ctx = avctx->priv_data; 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 }; .p_groups = NULL, .clock_video = ctx->clock_video, .clock_audio = ctx->clock_audio };
if (!NDIlib_initialize()) { if (!NDIlib_initialize()) {
...@@ -260,7 +260,7 @@ static int ndi_write_header(AVFormatContext *avctx) ...@@ -260,7 +260,7 @@ static int ndi_write_header(AVFormatContext *avctx)
ctx->ndi_send = NDIlib_send_create(&ndi_send_desc); ctx->ndi_send = NDIlib_send_create(&ndi_send_desc);
if (!ctx->ndi_send) { 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; ret = AVERROR_EXTERNAL;
} }
......
...@@ -139,7 +139,7 @@ static int read_header(AVFormatContext *ctx) ...@@ -139,7 +139,7 @@ static int read_header(AVFormatContext *ctx)
/* Open device for capture */ /* Open device for capture */
ad->device = ad->device =
alcCaptureOpenDevice(ctx->filename[0] ? ctx->filename : NULL, alcCaptureOpenDevice(ctx->url[0] ? ctx->url : NULL,
ad->sample_rate, ad->sample_rate,
ad->sample_format, ad->sample_format,
ad->sample_rate); /* Maximum 1 second of sample data to be read at once */ ad->sample_rate); /* Maximum 1 second of sample data to be read at once */
......
...@@ -1070,7 +1070,7 @@ static av_cold int opengl_write_header(AVFormatContext *h) ...@@ -1070,7 +1070,7 @@ static av_cold int opengl_write_header(AVFormatContext *h)
opengl->window_height = opengl->height; opengl->window_height = opengl->height;
if (!opengl->window_title && !opengl->no_window) 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))) if ((ret = opengl_create_window(h)))
goto fail; goto fail;
......
...@@ -52,7 +52,7 @@ static int audio_read_header(AVFormatContext *s1) ...@@ -52,7 +52,7 @@ static int audio_read_header(AVFormatContext *s1)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
ret = ff_oss_audio_open(s1, 0, s1->filename); ret = ff_oss_audio_open(s1, 0, s1->url);
if (ret < 0) { if (ret < 0) {
return AVERROR(EIO); return AVERROR(EIO);
} }
......
...@@ -46,7 +46,7 @@ static int audio_write_header(AVFormatContext *s1) ...@@ -46,7 +46,7 @@ static int audio_write_header(AVFormatContext *s1)
st = s1->streams[0]; st = s1->streams[0];
s->sample_rate = st->codecpar->sample_rate; s->sample_rate = st->codecpar->sample_rate;
s->channels = st->codecpar->channels; 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) { if (ret < 0) {
return AVERROR(EIO); return AVERROR(EIO);
} else { } else {
......
...@@ -158,8 +158,8 @@ static av_cold int pulse_read_header(AVFormatContext *s) ...@@ -158,8 +158,8 @@ static av_cold int pulse_read_header(AVFormatContext *s)
attr.fragsize = pd->fragment_size; attr.fragsize = pd->fragment_size;
if (s->filename[0] != '\0' && strcmp(s->filename, "default")) if (s->url[0] != '\0' && strcmp(s->url, "default"))
device = s->filename; device = s->url;
if (!(pd->mainloop = pa_threaded_mainloop_new())) { if (!(pd->mainloop = pa_threaded_mainloop_new())) {
pulse_close(s); pulse_close(s);
......
...@@ -459,8 +459,8 @@ static av_cold int pulse_write_header(AVFormatContext *h) ...@@ -459,8 +459,8 @@ static av_cold int pulse_write_header(AVFormatContext *h)
st = h->streams[0]; st = h->streams[0];
if (!stream_name) { if (!stream_name) {
if (h->filename[0]) if (h->url[0])
stream_name = h->filename; stream_name = h->url;
else else
stream_name = "Playback"; stream_name = "Playback";
} }
......
...@@ -165,7 +165,7 @@ static int sdl2_write_header(AVFormatContext *s) ...@@ -165,7 +165,7 @@ static int sdl2_write_header(AVFormatContext *s)
int flags = 0; int flags = 0;
if (!sdl->window_title) if (!sdl->window_title)
sdl->window_title = av_strdup(s->filename); sdl->window_title = av_strdup(s->url);
if (SDL_WasInit(SDL_INIT_VIDEO)) { if (SDL_WasInit(SDL_INIT_VIDEO)) {
av_log(s, AV_LOG_WARNING, av_log(s, AV_LOG_WARNING,
......
...@@ -41,7 +41,7 @@ static av_cold int audio_read_header(AVFormatContext *s1) ...@@ -41,7 +41,7 @@ static av_cold int audio_read_header(AVFormatContext *s1)
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = ff_sndio_open(s1, 0, s1->filename); ret = ff_sndio_open(s1, 0, s1->url);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -38,7 +38,7 @@ static av_cold int audio_write_header(AVFormatContext *s1) ...@@ -38,7 +38,7 @@ static av_cold int audio_write_header(AVFormatContext *s1)
s->sample_rate = st->codecpar->sample_rate; s->sample_rate = st->codecpar->sample_rate;
s->channels = st->codecpar->channels; s->channels = st->codecpar->channels;
ret = ff_sndio_open(s1, 1, s1->filename); ret = ff_sndio_open(s1, 1, s1->url);
return ret; return ret;
} }
......
...@@ -106,7 +106,7 @@ struct buff_data { ...@@ -106,7 +106,7 @@ struct buff_data {
int index; 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 video_data *s = ctx->priv_data;
struct v4l2_capability cap; struct v4l2_capability cap;
...@@ -147,11 +147,11 @@ static int device_open(AVFormatContext *ctx) ...@@ -147,11 +147,11 @@ static int device_open(AVFormatContext *ctx)
flags |= O_NONBLOCK; flags |= O_NONBLOCK;
} }
fd = v4l2_open(ctx->filename, flags, 0); fd = v4l2_open(device_path, flags, 0);
if (fd < 0) { if (fd < 0) {
err = AVERROR(errno); err = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s: %s\n", 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; return err;
} }
...@@ -840,7 +840,7 @@ static int v4l2_read_header(AVFormatContext *ctx) ...@@ -840,7 +840,7 @@ static int v4l2_read_header(AVFormatContext *ctx)
v4l2_log_file = fopen("/dev/null", "w"); v4l2_log_file = fopen("/dev/null", "w");
#endif #endif
s->fd = device_open(ctx); s->fd = device_open(ctx, ctx->url);
if (s->fd < 0) if (s->fd < 0)
return s->fd; return s->fd;
...@@ -1042,11 +1042,13 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l ...@@ -1042,11 +1042,13 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l
return ret; return ret;
} }
while ((entry = readdir(dir))) { while ((entry = readdir(dir))) {
char device_name[256];
if (!v4l2_is_v4l_dev(entry->d_name)) if (!v4l2_is_v4l_dev(entry->d_name))
continue; continue;
snprintf(ctx->filename, sizeof(ctx->filename), "/dev/%s", entry->d_name); snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
if ((s->fd = device_open(ctx)) < 0) if ((s->fd = device_open(ctx, device_name)) < 0)
continue; continue;
if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) { if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) {
...@@ -1060,7 +1062,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l ...@@ -1060,7 +1062,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
device->device_name = av_strdup(ctx->filename); device->device_name = av_strdup(device_name);
device->device_description = av_strdup(cap.card); device->device_description = av_strdup(cap.card);
if (!device->device_name || !device->device_description) { if (!device->device_name || !device->device_description) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
......
...@@ -39,10 +39,10 @@ static av_cold int write_header(AVFormatContext *s1) ...@@ -39,10 +39,10 @@ static av_cold int write_header(AVFormatContext *s1)
if (s1->flags & AVFMT_FLAG_NONBLOCK) if (s1->flags & AVFMT_FLAG_NONBLOCK)
flags |= O_NONBLOCK; flags |= O_NONBLOCK;
s->fd = open(s1->filename, flags); s->fd = open(s1->url, flags);
if (s->fd < 0) { if (s->fd < 0) {
res = AVERROR(errno); 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; return res;
} }
......
...@@ -256,7 +256,7 @@ static int vfw_read_header(AVFormatContext *s) ...@@ -256,7 +256,7 @@ static int vfw_read_header(AVFormatContext *s)
int ret; int ret;
AVRational framerate_q; AVRational framerate_q;
if (!strcmp(s->filename, "list")) { if (!strcmp(s->url, "list")) {
for (devnum = 0; devnum <= 9; devnum++) { for (devnum = 0; devnum <= 9; devnum++) {
char driver_name[256]; char driver_name[256];
char driver_ver[256]; char driver_ver[256];
...@@ -279,7 +279,7 @@ static int vfw_read_header(AVFormatContext *s) ...@@ -279,7 +279,7 @@ static int vfw_read_header(AVFormatContext *s)
} }
/* If atoi fails, devnum==0 and the default device is used */ /* 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); ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
if(!ret) { if(!ret) {
......
...@@ -629,14 +629,14 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s) ...@@ -629,14 +629,14 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
XCBGrabContext *c = s->priv_data; XCBGrabContext *c = s->priv_data;
int screen_num, ret; int screen_num, ret;
const xcb_setup_t *setup; const xcb_setup_t *setup;
char *display_name = av_strdup(s->filename); char *display_name = av_strdup(s->url);
if (!display_name) if (!display_name)
return AVERROR(ENOMEM); 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; *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); c->conn = xcb_connect(display_name[0] ? display_name : NULL, &screen_num);
...@@ -644,7 +644,7 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s) ...@@ -644,7 +644,7 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
if ((ret = xcb_connection_has_error(c->conn))) { if ((ret = xcb_connection_has_error(c->conn))) {
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n", 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); return AVERROR(EIO);
} }
......
...@@ -151,7 +151,7 @@ static int xv_write_header(AVFormatContext *s) ...@@ -151,7 +151,7 @@ static int xv_write_header(AVFormatContext *s)
xv->window_width, xv->window_height, xv->window_width, xv->window_height,
0, 0, 0); 0, 0, 0);
if (!xv->window_title) { if (!xv->window_title) {
if (!(xv->window_title = av_strdup(s->filename))) { if (!(xv->window_title = av_strdup(s->url))) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment