History

avdevice: migrate to AVFormatContext->url

Marton Balint committed 8 years ago

Commit 4bb04091 parent 25a2d2631 files · +59 −57Browse files

Unified · Split

31 files
  1. libavdevice/alsa.c +2 −2
  2. libavdevice/avfoundation.m +1 −1
  3. libavdevice/bktr.c +1 −1
  4. libavdevice/caca.c +1 −1
  5. libavdevice/decklink_common.cpp +1 −1
  6. libavdevice/decklink_dec.cpp +2 −2
  7. libavdevice/decklink_enc.cpp +2 −2
  8. libavdevice/dshow.c +1 −1
  9. libavdevice/fbdev_dec.c +2 −2
  10. libavdevice/fbdev_enc.c +2 −2
  11. libavdevice/gdigrab.c +1 −1
  12. libavdevice/iec61883.c +4 −4
  13. libavdevice/jack.c +3 −3
  14. libavdevice/lavfi.c +1 −1
  15. libavdevice/libcdio.c +3 −3
  16. libavdevice/libndi_newtek_dec.c +1 −1
  17. libavdevice/libndi_newtek_enc.c +2 −2
  18. libavdevice/openal-dec.c +1 −1
  19. libavdevice/opengl_enc.c +1 −1
  20. libavdevice/oss_dec.c +1 −1
  21. libavdevice/oss_enc.c +1 −1
  22. libavdevice/pulse_audio_dec.c +2 −2
  23. libavdevice/pulse_audio_enc.c +2 −2
  24. libavdevice/sdl2.c +1 −1
  25. libavdevice/sndio_dec.c +1 −1
  26. libavdevice/sndio_enc.c +1 −1
  27. libavdevice/v4l2.c +9 −7
  28. libavdevice/v4l2enc.c +2 −2
  29. libavdevice/vfwcap.c +2 −2
  30. libavdevice/xcbgrab.c +4 −4
  31. libavdevice/xv.c +1 −1
libavdevice/alsa.c+2−2
@@ -177,8 +177,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, · 176 unmodified lines
177 snd_pcm_uframes_t buffer_size, period_size;177 snd_pcm_uframes_t buffer_size, period_size;
178 uint64_t layout = ctx->streams[0]->codecpar->channel_layout;178 uint64_t layout = ctx->streams[0]->codecpar->channel_layout;
179 179
180 if (ctx->filename[0] == 0) audio_device = "default";180 if (ctx->url[0] == 0) audio_device = "default";
181 else audio_device = ctx->filename;181 else audio_device = ctx->url;
182 182
183 if (*codec_id == AV_CODEC_ID_NONE)183 if (*codec_id == AV_CODEC_ID_NONE)
184 *codec_id = DEFAULT_CODEC_ID;184 *codec_id = DEFAULT_CODEC_ID;
libavdevice/avfoundation.m+1−1
@@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx) · 258 unmodified lines
259static void parse_device_name(AVFormatContext *s)259static void parse_device_name(AVFormatContext *s)
260{260{
261 AVFContext *ctx = (AVFContext*)s->priv_data;261 AVFContext *ctx = (AVFContext*)s->priv_data;
262 char *tmp = av_strdup(s->filename);262 char *tmp = av_strdup(s->url);
263 char *save;263 char *save;
264 264
265 if (tmp[0] != ':') {265 if (tmp[0] != ':') {
libavdevice/bktr.c+1−1
@@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1) · 293 unmodified lines
294 st->codecpar->height = s->height;294 st->codecpar->height = s->height;
295 st->avg_frame_rate = framerate;295 st->avg_frame_rate = framerate;
296 296
297 if (bktr_init(s1->filename, s->width, s->height, s->standard,297 if (bktr_init(s1->url, s->width, s->height, s->standard,
298 &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {298 &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
299 ret = AVERROR(EIO);299 ret = AVERROR(EIO);
300 goto out;300 goto out;
libavdevice/caca.c+1−1
@@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s) · 177 unmodified lines
178 }178 }
179 179
180 if (!c->window_title)180 if (!c->window_title)
181 c->window_title = av_strdup(s->filename);181 c->window_title = av_strdup(s->url);
182 caca_set_display_title(c->display, c->window_title);182 caca_set_display_title(c->display, c->window_title);
183 caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q));183 caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q));
184 184
libavdevice/decklink_common.cpp+1−1
@@ -404,7 +404,7 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct · 403 unmodified lines
404 }404 }
405 405
406 av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription",406 av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription",
407 avctx->filename);407 avctx->url);
408 while (itermode->Next(&mode) == S_OK) {408 while (itermode->Next(&mode) == S_OK) {
409 BMDTimeValue tb_num, tb_den;409 BMDTimeValue tb_num, tb_den;
410 mode->GetFrameRate(&tb_num, &tb_den);410 mode->GetFrameRate(&tb_num, &tb_den);
libavdevice/decklink_dec.cpp+2−2
@@ -951,7 +951,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 950 unmodified lines
951 cctx->raw_format = MKBETAG('v','2','1','0');951 cctx->raw_format = MKBETAG('v','2','1','0');
952 }952 }
953 953
954 strcpy (fname, avctx->filename);954 av_strlcpy(fname, avctx->url, sizeof(fname));
955 tmp=strchr (fname, '@');955 tmp=strchr (fname, '@');
956 if (tmp != NULL) {956 if (tmp != NULL) {
957 av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will be removed. Please use the -format_code option.\n");957 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) · 8 unmodified lines
966 /* Get input device. */966 /* Get input device. */
967 if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) {967 if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) {
968 av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n",968 av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n",
969 avctx->filename);969 avctx->url);
970 ret = AVERROR(EIO);970 ret = AVERROR(EIO);
971 goto error;971 goto error;
972 }972 }
libavdevice/decklink_enc.cpp+2−2
@@ -400,14 +400,14 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) · 399 unmodified lines
400 return AVERROR_EXIT;400 return AVERROR_EXIT;
401 }401 }
402 402
403 ret = ff_decklink_init_device(avctx, avctx->filename);403 ret = ff_decklink_init_device(avctx, avctx->url);
404 if (ret < 0)404 if (ret < 0)
405 return ret;405 return ret;
406 406
407 /* Get output device. */407 /* Get output device. */
408 if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) {408 if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) {
409 av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",409 av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",
410 avctx->filename);410 avctx->url);
411 ret = AVERROR(EIO);411 ret = AVERROR(EIO);
412 goto error;412 goto error;
413 }413 }
libavdevice/dshow.c+1−1
@@ -1033,7 +1033,7 @@ static int parse_device_name(AVFormatContext *avctx) · 1032 unmodified lines
1033{1033{
1034 struct dshow_ctx *ctx = avctx->priv_data;1034 struct dshow_ctx *ctx = avctx->priv_data;
1035 char **device_name = ctx->device_name;1035 char **device_name = ctx->device_name;
1036 char *name = av_strdup(avctx->filename);1036 char *name = av_strdup(avctx->url);
1037 char *tmp = name;1037 char *tmp = name;
1038 int ret = 1;1038 int ret = 1;
1039 char *type;1039 char *type;
libavdevice/fbdev_dec.c+2−2
@@ -78,8 +78,8 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) · 77 unmodified lines
78 if (avctx->flags & AVFMT_FLAG_NONBLOCK)78 if (avctx->flags & AVFMT_FLAG_NONBLOCK)
79 flags |= O_NONBLOCK;79 flags |= O_NONBLOCK;
80 80
81 if (avctx->filename[0])81 if (avctx->url[0])
82 device = avctx->filename;82 device = avctx->url;
83 else83 else
84 device = ff_fbdev_default_device();84 device = ff_fbdev_default_device();
85 85
libavdevice/fbdev_enc.c+2−2
@@ -53,8 +53,8 @@ static av_cold int fbdev_write_header(AVFormatContext *h) · 52 unmodified lines
53 return AVERROR(EINVAL);53 return AVERROR(EINVAL);
54 }54 }
55 55
56 if (h->filename[0])56 if (h->url[0])
57 device = h->filename;57 device = h->url;
58 else58 else
59 device = ff_fbdev_default_device();59 device = ff_fbdev_default_device();
60 60
libavdevice/gdigrab.c+1−1
@@ -230,7 +230,7 @@ gdigrab_read_header(AVFormatContext *s1) · 229 unmodified lines
230 HBITMAP hbmp = NULL;230 HBITMAP hbmp = NULL;
231 void *buffer = NULL;231 void *buffer = NULL;
232 232
233 const char *filename = s1->filename;233 const char *filename = s1->url;
234 const char *name = NULL;234 const char *name = NULL;
235 AVStream *st = NULL;235 AVStream *st = NULL;
236 236
libavdevice/iec61883.c+4−4
@@ -259,14 +259,14 @@ static int iec61883_read_header(AVFormatContext *context) · 258 unmodified lines
259 goto fail;259 goto fail;
260 }260 }
261 261
262 inport = strtol(context->filename, &endptr, 10);262 inport = strtol(context->url, &endptr, 10);
263 if (endptr != context->filename && *endptr == '\0') {263 if (endptr != context->url && *endptr == '\0') {
264 av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);264 av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
265 j = inport;265 j = inport;
266 nb_ports = inport + 1;266 nb_ports = inport + 1;
267 } else if (strcmp(context->filename, "auto")) {267 } else if (strcmp(context->url, "auto")) {
268 av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "268 av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "
269 "\"auto\" for auto-detection, or the port number.\n", context->filename);269 "\"auto\" for auto-detection, or the port number.\n", context->url);
270 goto fail;270 goto fail;
271 }271 }
272 272
libavdevice/jack.c+3−3
@@ -150,8 +150,8 @@ static int start_jack(AVFormatContext *context) · 149 unmodified lines
150 jack_status_t status;150 jack_status_t status;
151 int i, test;151 int i, test;
152 152
153 /* Register as a JACK client, using the context filename as client name. */153 /* Register as a JACK client, using the context url as client name. */
154 self->client = jack_client_open(context->filename, JackNullOption, &status);154 self->client = jack_client_open(context->url, JackNullOption, &status);
155 if (!self->client) {155 if (!self->client) {
156 av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n");156 av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n");
157 return AVERROR(EIO);157 return AVERROR(EIO);
@@ -174,7 +174,7 @@ static int start_jack(AVFormatContext *context) · 16 unmodified lines
174 JackPortIsInput, 0);174 JackPortIsInput, 0);
175 if (!self->ports[i]) {175 if (!self->ports[i]) {
176 av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n",176 av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n",
177 context->filename, str);177 context->url, str);
178 jack_client_close(self->client);178 jack_client_close(self->client);
179 return AVERROR(EIO);179 return AVERROR(EIO);
180 }180 }
libavdevice/lavfi.c+1−1
@@ -166,7 +166,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) · 165 unmodified lines
166 }166 }
167 167
168 if (!lavfi->graph_str)168 if (!lavfi->graph_str)
169 lavfi->graph_str = av_strdup(avctx->filename);169 lavfi->graph_str = av_strdup(avctx->url);
170 170
171 /* parse the graph, create a stream for each open output */171 /* parse the graph, create a stream for each open output */
172 if (!(lavfi->graph = avfilter_graph_alloc()))172 if (!(lavfi->graph = avfilter_graph_alloc()))
libavdevice/libcdio.c+3−3
@@ -60,9 +60,9 @@ static av_cold int read_header(AVFormatContext *ctx) · 59 unmodified lines
60 60
61 if (!(st = avformat_new_stream(ctx, NULL)))61 if (!(st = avformat_new_stream(ctx, NULL)))
62 return AVERROR(ENOMEM);62 return AVERROR(ENOMEM);
63 s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);63 s->drive = cdio_cddap_identify(ctx->url, CDDA_MESSAGE_LOGIT, &err);
64 if (!s->drive) {64 if (!s->drive) {
65 av_log(ctx, AV_LOG_ERROR, "Could not open drive %s.\n", ctx->filename);65 av_log(ctx, AV_LOG_ERROR, "Could not open drive %s.\n", ctx->url);
66 return AVERROR(EINVAL);66 return AVERROR(EINVAL);
67 }67 }
68 if (err) {68 if (err) {
@@ -70,7 +70,7 @@ static av_cold int read_header(AVFormatContext *ctx) · 1 unmodified line
70 free(err);70 free(err);
71 }71 }
72 if ((ret = cdio_cddap_open(s->drive)) < 0 || !s->drive->opened) {72 if ((ret = cdio_cddap_open(s->drive)) < 0 || !s->drive->opened) {
73 av_log(ctx, AV_LOG_ERROR, "Could not open disk in drive %s.\n", ctx->filename);73 av_log(ctx, AV_LOG_ERROR, "Could not open disk in drive %s.\n", ctx->url);
74 return AVERROR(EINVAL);74 return AVERROR(EINVAL);
75 }75 }
76 76
libavdevice/libndi_newtek_dec.c+1−1
@@ -149,7 +149,7 @@ static int ndi_read_header(AVFormatContext *avctx) · 148 unmodified lines
149 }149 }
150 150
151 /* Find available sources. */151 /* Find available sources. */
152 ret = ndi_find_sources(avctx, avctx->filename, &recv_create_desc.source_to_connect_to);152 ret = ndi_find_sources(avctx, avctx->url, &recv_create_desc.source_to_connect_to);
153 if (ctx->find_sources) {153 if (ctx->find_sources) {
154 return AVERROR_EXIT;154 return AVERROR_EXIT;
155 }155 }
libavdevice/libndi_newtek_enc.c+2−2
@@ -233,7 +233,7 @@ static int ndi_write_header(AVFormatContext *avctx) · 232 unmodified lines
233 int ret = 0;233 int ret = 0;
234 unsigned int n;234 unsigned int n;
235 struct NDIContext *ctx = avctx->priv_data;235 struct NDIContext *ctx = avctx->priv_data;
236 const NDIlib_send_create_t ndi_send_desc = { .p_ndi_name = avctx->filename,236 const NDIlib_send_create_t ndi_send_desc = { .p_ndi_name = avctx->url,
237 .p_groups = NULL, .clock_video = ctx->clock_video, .clock_audio = ctx->clock_audio };237 .p_groups = NULL, .clock_video = ctx->clock_video, .clock_audio = ctx->clock_audio };
238 238
239 if (!NDIlib_initialize()) {239 if (!NDIlib_initialize()) {
@@ -260,7 +260,7 @@ static int ndi_write_header(AVFormatContext *avctx) · 20 unmodified lines
260 260
261 ctx->ndi_send = NDIlib_send_create(&ndi_send_desc);261 ctx->ndi_send = NDIlib_send_create(&ndi_send_desc);
262 if (!ctx->ndi_send) {262 if (!ctx->ndi_send) {
263 av_log(avctx, AV_LOG_ERROR, "Failed to create NDI output %s\n", avctx->filename);263 av_log(avctx, AV_LOG_ERROR, "Failed to create NDI output %s\n", avctx->url);
264 ret = AVERROR_EXTERNAL;264 ret = AVERROR_EXTERNAL;
265 }265 }
266 266
libavdevice/openal-dec.c+1−1
@@ -139,7 +139,7 @@ static int read_header(AVFormatContext *ctx) · 138 unmodified lines
139 139
140 /* Open device for capture */140 /* Open device for capture */
141 ad->device =141 ad->device =
142 alcCaptureOpenDevice(ctx->filename[0] ? ctx->filename : NULL,142 alcCaptureOpenDevice(ctx->url[0] ? ctx->url : NULL,
143 ad->sample_rate,143 ad->sample_rate,
144 ad->sample_format,144 ad->sample_format,
145 ad->sample_rate); /* Maximum 1 second of sample data to be read at once */145 ad->sample_rate); /* Maximum 1 second of sample data to be read at once */
libavdevice/opengl_enc.c+1−1
@@ -1070,7 +1070,7 @@ static av_cold int opengl_write_header(AVFormatContext *h) · 1069 unmodified lines
1070 opengl->window_height = opengl->height;1070 opengl->window_height = opengl->height;
1071 1071
1072 if (!opengl->window_title && !opengl->no_window)1072 if (!opengl->window_title && !opengl->no_window)
1073 opengl->window_title = av_strdup(h->filename);1073 opengl->window_title = av_strdup(h->url);
1074 1074
1075 if ((ret = opengl_create_window(h)))1075 if ((ret = opengl_create_window(h)))
1076 goto fail;1076 goto fail;
libavdevice/oss_dec.c+1−1
@@ -52,7 +52,7 @@ static int audio_read_header(AVFormatContext *s1) · 51 unmodified lines
52 return AVERROR(ENOMEM);52 return AVERROR(ENOMEM);
53 }53 }
54 54
55 ret = ff_oss_audio_open(s1, 0, s1->filename);55 ret = ff_oss_audio_open(s1, 0, s1->url);
56 if (ret < 0) {56 if (ret < 0) {
57 return AVERROR(EIO);57 return AVERROR(EIO);
58 }58 }
libavdevice/oss_enc.c+1−1
@@ -46,7 +46,7 @@ static int audio_write_header(AVFormatContext *s1) · 45 unmodified lines
46 st = s1->streams[0];46 st = s1->streams[0];
47 s->sample_rate = st->codecpar->sample_rate;47 s->sample_rate = st->codecpar->sample_rate;
48 s->channels = st->codecpar->channels;48 s->channels = st->codecpar->channels;
49 ret = ff_oss_audio_open(s1, 1, s1->filename);49 ret = ff_oss_audio_open(s1, 1, s1->url);
50 if (ret < 0) {50 if (ret < 0) {
51 return AVERROR(EIO);51 return AVERROR(EIO);
52 } else {52 } else {
libavdevice/pulse_audio_dec.c+2−2
@@ -158,8 +158,8 @@ static av_cold int pulse_read_header(AVFormatContext *s) · 157 unmodified lines
158 158
159 attr.fragsize = pd->fragment_size;159 attr.fragsize = pd->fragment_size;
160 160
161 if (s->filename[0] != '\0' && strcmp(s->filename, "default"))161 if (s->url[0] != '\0' && strcmp(s->url, "default"))
162 device = s->filename;162 device = s->url;
163 163
164 if (!(pd->mainloop = pa_threaded_mainloop_new())) {164 if (!(pd->mainloop = pa_threaded_mainloop_new())) {
165 pulse_close(s);165 pulse_close(s);
libavdevice/pulse_audio_enc.c+2−2
@@ -459,8 +459,8 @@ static av_cold int pulse_write_header(AVFormatContext *h) · 458 unmodified lines
459 st = h->streams[0];459 st = h->streams[0];
460 460
461 if (!stream_name) {461 if (!stream_name) {
462 if (h->filename[0])462 if (h->url[0])
463 stream_name = h->filename;463 stream_name = h->url;
464 else464 else
465 stream_name = "Playback";465 stream_name = "Playback";
466 }466 }
libavdevice/sdl2.c+1−1
@@ -165,7 +165,7 @@ static int sdl2_write_header(AVFormatContext *s) · 164 unmodified lines
165 int flags = 0;165 int flags = 0;
166 166
167 if (!sdl->window_title)167 if (!sdl->window_title)
168 sdl->window_title = av_strdup(s->filename);168 sdl->window_title = av_strdup(s->url);
169 169
170 if (SDL_WasInit(SDL_INIT_VIDEO)) {170 if (SDL_WasInit(SDL_INIT_VIDEO)) {
171 av_log(s, AV_LOG_WARNING,171 av_log(s, AV_LOG_WARNING,
libavdevice/sndio_dec.c+1−1
@@ -41,7 +41,7 @@ static av_cold int audio_read_header(AVFormatContext *s1) · 40 unmodified lines
41 if (!st)41 if (!st)
42 return AVERROR(ENOMEM);42 return AVERROR(ENOMEM);
43 43
44 ret = ff_sndio_open(s1, 0, s1->filename);44 ret = ff_sndio_open(s1, 0, s1->url);
45 if (ret < 0)45 if (ret < 0)
46 return ret;46 return ret;
47 47
libavdevice/sndio_enc.c+1−1
@@ -38,7 +38,7 @@ static av_cold int audio_write_header(AVFormatContext *s1) · 37 unmodified lines
38 s->sample_rate = st->codecpar->sample_rate;38 s->sample_rate = st->codecpar->sample_rate;
39 s->channels = st->codecpar->channels;39 s->channels = st->codecpar->channels;
40 40
41 ret = ff_sndio_open(s1, 1, s1->filename);41 ret = ff_sndio_open(s1, 1, s1->url);
42 42
43 return ret;43 return ret;
44}44}
libavdevice/v4l2.c+9−7
@@ -106,7 +106,7 @@ struct buff_data { · 105 unmodified lines
106 int index;106 int index;
107};107};
108 108
109static int device_open(AVFormatContext *ctx)109static int device_open(AVFormatContext *ctx, const char* device_path)
110{110{
111 struct video_data *s = ctx->priv_data;111 struct video_data *s = ctx->priv_data;
112 struct v4l2_capability cap;112 struct v4l2_capability cap;
@@ -147,11 +147,11 @@ static int device_open(AVFormatContext *ctx) · 34 unmodified lines
147 flags |= O_NONBLOCK;147 flags |= O_NONBLOCK;
148 }148 }
149 149
150 fd = v4l2_open(ctx->filename, flags, 0);150 fd = v4l2_open(device_path, flags, 0);
151 if (fd < 0) {151 if (fd < 0) {
152 err = AVERROR(errno);152 err = AVERROR(errno);
153 av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s: %s\n",153 av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s: %s\n",
154 ctx->filename, av_err2str(err));154 device_path, av_err2str(err));
155 return err;155 return err;
156 }156 }
157 157
@@ -840,7 +840,7 @@ static int v4l2_read_header(AVFormatContext *ctx) · 682 unmodified lines
840 v4l2_log_file = fopen("/dev/null", "w");840 v4l2_log_file = fopen("/dev/null", "w");
841#endif841#endif
842 842
843 s->fd = device_open(ctx);843 s->fd = device_open(ctx, ctx->url);
844 if (s->fd < 0)844 if (s->fd < 0)
845 return s->fd;845 return s->fd;
846 846
@@ -1042,11 +1042,13 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l · 195 unmodified lines
1042 return ret;1042 return ret;
1043 }1043 }
1044 while ((entry = readdir(dir))) {1044 while ((entry = readdir(dir))) {
1045 char device_name[256];
1046
1045 if (!v4l2_is_v4l_dev(entry->d_name))1047 if (!v4l2_is_v4l_dev(entry->d_name))
1046 continue;1048 continue;
1047 1049
1048 snprintf(ctx->filename, sizeof(ctx->filename), "/dev/%s", entry->d_name);1050 snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
1049 if ((s->fd = device_open(ctx)) < 0)1051 if ((s->fd = device_open(ctx, device_name)) < 0)
1050 continue;1052 continue;
1051 1053
1052 if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) {1054 if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) {
@@ -1060,7 +1062,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l · 7 unmodified lines
1060 ret = AVERROR(ENOMEM);1062 ret = AVERROR(ENOMEM);
1061 goto fail;1063 goto fail;
1062 }1064 }
1063 device->device_name = av_strdup(ctx->filename);1065 device->device_name = av_strdup(device_name);
1064 device->device_description = av_strdup(cap.card);1066 device->device_description = av_strdup(cap.card);
1065 if (!device->device_name || !device->device_description) {1067 if (!device->device_name || !device->device_description) {
1066 ret = AVERROR(ENOMEM);1068 ret = AVERROR(ENOMEM);
libavdevice/v4l2enc.c+2−2
@@ -39,10 +39,10 @@ static av_cold int write_header(AVFormatContext *s1) · 38 unmodified lines
39 if (s1->flags & AVFMT_FLAG_NONBLOCK)39 if (s1->flags & AVFMT_FLAG_NONBLOCK)
40 flags |= O_NONBLOCK;40 flags |= O_NONBLOCK;
41 41
42 s->fd = open(s1->filename, flags);42 s->fd = open(s1->url, flags);
43 if (s->fd < 0) {43 if (s->fd < 0) {
44 res = AVERROR(errno);44 res = AVERROR(errno);
45 av_log(s1, AV_LOG_ERROR, "Unable to open V4L2 device '%s'\n", s1->filename);45 av_log(s1, AV_LOG_ERROR, "Unable to open V4L2 device '%s'\n", s1->url);
46 return res;46 return res;
47 }47 }
48 48
libavdevice/vfwcap.c+2−2
@@ -256,7 +256,7 @@ static int vfw_read_header(AVFormatContext *s) · 255 unmodified lines
256 int ret;256 int ret;
257 AVRational framerate_q;257 AVRational framerate_q;
258 258
259 if (!strcmp(s->filename, "list")) {259 if (!strcmp(s->url, "list")) {
260 for (devnum = 0; devnum <= 9; devnum++) {260 for (devnum = 0; devnum <= 9; devnum++) {
261 char driver_name[256];261 char driver_name[256];
262 char driver_ver[256];262 char driver_ver[256];
@@ -279,7 +279,7 @@ static int vfw_read_header(AVFormatContext *s) · 16 unmodified lines
279 }279 }
280 280
281 /* If atoi fails, devnum==0 and the default device is used */281 /* If atoi fails, devnum==0 and the default device is used */
282 devnum = atoi(s->filename);282 devnum = atoi(s->url);
283 283
284 ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);284 ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
285 if(!ret) {285 if(!ret) {
libavdevice/xcbgrab.c+4−4
@@ -629,14 +629,14 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s) · 628 unmodified lines
629 XCBGrabContext *c = s->priv_data;629 XCBGrabContext *c = s->priv_data;
630 int screen_num, ret;630 int screen_num, ret;
631 const xcb_setup_t *setup;631 const xcb_setup_t *setup;
632 char *display_name = av_strdup(s->filename);632 char *display_name = av_strdup(s->url);
633 633
634 if (!display_name)634 if (!display_name)
635 return AVERROR(ENOMEM);635 return AVERROR(ENOMEM);
636 636
637 if (!sscanf(s->filename, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {637 if (!sscanf(s->url, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
638 *display_name = 0;638 *display_name = 0;
639 sscanf(s->filename, "+%d,%d", &c->x, &c->y);639 sscanf(s->url, "+%d,%d", &c->x, &c->y);
640 }640 }
641 641
642 c->conn = xcb_connect(display_name[0] ? display_name : NULL, &screen_num);642 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) · 1 unmodified line
644 644
645 if ((ret = xcb_connection_has_error(c->conn))) {645 if ((ret = xcb_connection_has_error(c->conn))) {
646 av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",646 av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
647 s->filename[0] ? s->filename : "default", ret);647 s->url[0] ? s->url : "default", ret);
648 return AVERROR(EIO);648 return AVERROR(EIO);
649 }649 }
650 650
libavdevice/xv.c+1−1
@@ -151,7 +151,7 @@ static int xv_write_header(AVFormatContext *s) · 150 unmodified lines
151 xv->window_width, xv->window_height,151 xv->window_width, xv->window_height,
152 0, 0, 0);152 0, 0, 0);
153 if (!xv->window_title) {153 if (!xv->window_title) {
154 if (!(xv->window_title = av_strdup(s->filename))) {154 if (!(xv->window_title = av_strdup(s->url))) {
155 ret = AVERROR(ENOMEM);155 ret = AVERROR(ENOMEM);
156 goto fail;156 goto fail;
157 }157 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t