[FFmpeg-devel] [PATCH 4/7] avdevice: migrate to AVFormatContext->url
Marton Balint
cus at passwd.hu
Sun Jan 21 20:24:08 EET 2018
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavdevice/alsa.c | 4 ++--
libavdevice/avfoundation.m | 2 +-
libavdevice/bktr.c | 2 +-
libavdevice/caca.c | 2 +-
libavdevice/decklink_common.cpp | 2 +-
libavdevice/decklink_dec.cpp | 4 ++--
libavdevice/decklink_enc.cpp | 4 ++--
libavdevice/dshow.c | 2 +-
libavdevice/fbdev_dec.c | 4 ++--
libavdevice/fbdev_enc.c | 4 ++--
libavdevice/gdigrab.c | 2 +-
libavdevice/iec61883.c | 8 ++++----
libavdevice/jack.c | 6 +++---
libavdevice/lavfi.c | 2 +-
libavdevice/libcdio.c | 6 +++---
libavdevice/libndi_newtek_dec.c | 2 +-
libavdevice/libndi_newtek_enc.c | 4 ++--
libavdevice/openal-dec.c | 2 +-
libavdevice/opengl_enc.c | 2 +-
libavdevice/oss_dec.c | 2 +-
libavdevice/oss_enc.c | 2 +-
libavdevice/pulse_audio_dec.c | 4 ++--
libavdevice/pulse_audio_enc.c | 4 ++--
libavdevice/sdl2.c | 2 +-
libavdevice/sndio_dec.c | 2 +-
libavdevice/sndio_enc.c | 2 +-
libavdevice/v4l2.c | 16 +++++++++-------
libavdevice/v4l2enc.c | 4 ++--
libavdevice/vfwcap.c | 4 ++--
libavdevice/xcbgrab.c | 8 ++++----
libavdevice/xv.c | 2 +-
31 files changed, 59 insertions(+), 57 deletions(-)
diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
index 1bbff30d5c..1b21beb6d5 100644
--- a/libavdevice/alsa.c
+++ b/libavdevice/alsa.c
@@ -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;
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;
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index e2ddf47dbe..a540f6a079 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx)
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] != ':') {
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 418247dc4e..993cc19ac7 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1)
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;
diff --git a/libavdevice/caca.c b/libavdevice/caca.c
index 93cc0ffd25..47de8247dc 100644
--- a/libavdevice/caca.c
+++ b/libavdevice/caca.c
@@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s)
}
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));
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index d1576b8553..da414ed5f8 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -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",
- avctx->filename);
+ avctx->url);
while (itermode->Next(&mode) == S_OK) {
BMDTimeValue tb_num, tb_den;
mode->GetFrameRate(&tb_num, &tb_den);
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index a69e28680b..5c116f2d13 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -951,7 +951,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
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");
@@ -966,7 +966,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
/* 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;
}
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index 89b03f2bd5..28ab928cd5 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -400,14 +400,14 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx)
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;
}
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index f2453e6114..de910c0994 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -1033,7 +1033,7 @@ static int parse_device_name(AVFormatContext *avctx)
{
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;
diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c
index d9c75df202..6a51816868 100644
--- a/libavdevice/fbdev_dec.c
+++ b/libavdevice/fbdev_dec.c
@@ -78,8 +78,8 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx)
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();
diff --git a/libavdevice/fbdev_enc.c b/libavdevice/fbdev_enc.c
index b4e5f84975..4191596825 100644
--- a/libavdevice/fbdev_enc.c
+++ b/libavdevice/fbdev_enc.c
@@ -53,8 +53,8 @@ static av_cold int fbdev_write_header(AVFormatContext *h)
return AVERROR(EINVAL);
}
- if (h->filename[0])
- device = h->filename;
+ if (h->url[0])
+ device = h->url;
else
device = ff_fbdev_default_device();
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index ff2ef3b162..ab08c11788 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -230,7 +230,7 @@ gdigrab_read_header(AVFormatContext *s1)
HBITMAP hbmp = NULL;
void *buffer = NULL;
- const char *filename = s1->filename;
+ const char *filename = s1->url;
const char *name = NULL;
AVStream *st = NULL;
diff --git a/libavdevice/iec61883.c b/libavdevice/iec61883.c
index 721dca38ee..7d4d37847c 100644
--- a/libavdevice/iec61883.c
+++ b/libavdevice/iec61883.c
@@ -259,14 +259,14 @@ static int iec61883_read_header(AVFormatContext *context)
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;
}
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index e35a4a815a..34f1c6de97 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -150,8 +150,8 @@ static int start_jack(AVFormatContext *context)
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);
@@ -174,7 +174,7 @@ static int start_jack(AVFormatContext *context)
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);
}
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 5273717e6b..6f2ae958dc 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -166,7 +166,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
}
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()))
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index f6d4fce256..a4c9f52337 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -60,9 +60,9 @@ static av_cold int read_header(AVFormatContext *ctx)
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) {
@@ -70,7 +70,7 @@ static av_cold int read_header(AVFormatContext *ctx)
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);
}
diff --git a/libavdevice/libndi_newtek_dec.c b/libavdevice/libndi_newtek_dec.c
index 2f14f4b03f..4fb719770e 100644
--- a/libavdevice/libndi_newtek_dec.c
+++ b/libavdevice/libndi_newtek_dec.c
@@ -149,7 +149,7 @@ static int ndi_read_header(AVFormatContext *avctx)
}
/* 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;
}
diff --git a/libavdevice/libndi_newtek_enc.c b/libavdevice/libndi_newtek_enc.c
index 6ca6f41b73..f3603f5a3a 100644
--- a/libavdevice/libndi_newtek_enc.c
+++ b/libavdevice/libndi_newtek_enc.c
@@ -233,7 +233,7 @@ static int ndi_write_header(AVFormatContext *avctx)
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()) {
@@ -260,7 +260,7 @@ static int ndi_write_header(AVFormatContext *avctx)
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;
}
diff --git a/libavdevice/openal-dec.c b/libavdevice/openal-dec.c
index 6eb0efe38f..c19048e15d 100644
--- a/libavdevice/openal-dec.c
+++ b/libavdevice/openal-dec.c
@@ -139,7 +139,7 @@ static int read_header(AVFormatContext *ctx)
/* 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 */
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index bb6787c6f1..54c7e610bd 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -1070,7 +1070,7 @@ static av_cold int opengl_write_header(AVFormatContext *h)
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;
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index 6fef96a450..d0dc327dc6 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -52,7 +52,7 @@ static int audio_read_header(AVFormatContext *s1)
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);
}
diff --git a/libavdevice/oss_enc.c b/libavdevice/oss_enc.c
index e7a7b6d403..e3172afaa4 100644
--- a/libavdevice/oss_enc.c
+++ b/libavdevice/oss_enc.c
@@ -46,7 +46,7 @@ static int audio_write_header(AVFormatContext *s1)
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 {
diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c
index 95a1d6ecfa..5977fb7e9e 100644
--- a/libavdevice/pulse_audio_dec.c
+++ b/libavdevice/pulse_audio_dec.c
@@ -158,8 +158,8 @@ static av_cold int pulse_read_header(AVFormatContext *s)
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);
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 0efcf0fe7e..d430b77272 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -459,8 +459,8 @@ static av_cold int pulse_write_header(AVFormatContext *h)
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";
}
diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index 5d9e91ec21..48ed977beb 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -165,7 +165,7 @@ static int sdl2_write_header(AVFormatContext *s)
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,
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 2d13232bf1..ebb485a2c7 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -41,7 +41,7 @@ static av_cold int audio_read_header(AVFormatContext *s1)
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;
diff --git a/libavdevice/sndio_enc.c b/libavdevice/sndio_enc.c
index 47f500d71e..f6dd290108 100644
--- a/libavdevice/sndio_enc.c
+++ b/libavdevice/sndio_enc.c
@@ -38,7 +38,7 @@ static av_cold int audio_write_header(AVFormatContext *s1)
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;
}
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index f087badf5c..10a0ff0dd6 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -106,7 +106,7 @@ struct buff_data {
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;
@@ -147,11 +147,11 @@ static int device_open(AVFormatContext *ctx)
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;
}
@@ -840,7 +840,7 @@ static int v4l2_read_header(AVFormatContext *ctx)
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;
@@ -1042,11 +1042,13 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l
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) {
@@ -1060,7 +1062,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l
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);
diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index faf6e07f86..85200d0a36 100644
--- a/libavdevice/v4l2enc.c
+++ b/libavdevice/v4l2enc.c
@@ -39,10 +39,10 @@ static av_cold int write_header(AVFormatContext *s1)
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;
}
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index f03d38ac26..6a923d9957 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -256,7 +256,7 @@ static int vfw_read_header(AVFormatContext *s)
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];
@@ -279,7 +279,7 @@ static int vfw_read_header(AVFormatContext *s)
}
/* 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) {
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 1968fe02d4..6d142abd4f 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -629,14 +629,14 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
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);
@@ -644,7 +644,7 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
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);
}
diff --git a/libavdevice/xv.c b/libavdevice/xv.c
index 185de7569e..c3ed2e48bd 100644
--- a/libavdevice/xv.c
+++ b/libavdevice/xv.c
@@ -151,7 +151,7 @@ static int xv_write_header(AVFormatContext *s)
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;
}
--
2.13.6
More information about the ffmpeg-devel
mailing list