Revision ebb92e07

View differences:

ffmpeg.c
521 521
        AVFormatContext *s = output_files[i];
522 522
        int j;
523 523
        if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
524
            url_fclose(s->pb);
524
            avio_close(s->pb);
525 525
        avformat_free_context(s);
526 526
        av_free(output_streams_for_file[i]);
527 527
    }
......
3816 3816
        }
3817 3817

  
3818 3818
        /* open the file */
3819
        if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) {
3819
        if ((err = avio_open(&oc->pb, filename, URL_WRONLY)) < 0) {
3820 3820
            print_error(filename, err);
3821 3821
            ffmpeg_exit(1);
3822 3822
        }
ffserver.c
3764 3764
            }
3765 3765

  
3766 3766
            /* only write the header of the ffm file */
3767
            if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
3767
            if (avio_open(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
3768 3768
                http_log("Could not open output feed file '%s'\n",
3769 3769
                         feed->feed_filename);
3770 3770
                exit(1);
......
3783 3783
            }
3784 3784
            /* XXX: need better api */
3785 3785
            av_freep(&s->priv_data);
3786
            url_fclose(s->pb);
3786
            avio_close(s->pb);
3787 3787
        }
3788 3788
        /* get feed size and write index */
3789 3789
        fd = open(feed->feed_filename, O_RDONLY);
libavformat/applehttp.c
154 154
        free_segment_list(var);
155 155
        av_free_packet(&var->pkt);
156 156
        if (var->pb)
157
            url_fclose(var->pb);
157
            avio_close(var->pb);
158 158
        if (var->ctx) {
159 159
            var->ctx->pb = NULL;
160 160
            av_close_input_file(var->ctx);
......
211 211

  
212 212
    if (!in) {
213 213
        close_in = 1;
214
        if ((ret = url_fopen(&in, url, URL_RDONLY)) < 0)
214
        if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
215 215
            return ret;
216 216
    }
217 217

  
......
284 284

  
285 285
fail:
286 286
    if (close_in)
287
        url_fclose(in);
287
        avio_close(in);
288 288
    return ret;
289 289
}
290 290

  
......
338 338
        ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL);
339 339
        if (ret < 0)
340 340
            goto fail;
341
        url_fclose(v->ctx->pb);
341
        avio_close(v->ctx->pb);
342 342
        v->ctx->pb = NULL;
343 343
        v->stream_offset = stream_offset;
344 344
        /* Create new AVStreams for each stream in this variant */
......
378 378
    }
379 379
    if (c->cur_seq_no - var->start_seq_no >= var->n_segments)
380 380
        return c->finished ? AVERROR_EOF : 0;
381
    ret = url_fopen(&var->pb,
381
    ret = avio_open(&var->pb,
382 382
                    var->segments[c->cur_seq_no - var->start_seq_no]->url,
383 383
                    URL_RDONLY);
384 384
    if (ret < 0)
......
435 435
                   "Closing variant stream %d, no longer needed\n", i);
436 436
            av_free_packet(&var->pkt);
437 437
            reset_packet(&var->pkt);
438
            url_fclose(var->pb);
438
            avio_close(var->pb);
439 439
            var->pb = NULL;
440 440
            changed = 1;
441 441
        } else if (!var->pb && var->needed) {
......
484 484
    for (i = 0; i < c->n_variants; i++) {
485 485
        struct variant *var = c->variants[i];
486 486
        if (var->pb) {
487
            url_fclose(var->pb);
487
            avio_close(var->pb);
488 488
            var->pb = NULL;
489 489
        }
490 490
    }
......
558 558
    for (i = 0; i < c->n_variants; i++) {
559 559
        struct variant *var = c->variants[i];
560 560
        if (var->pb) {
561
            url_fclose(var->pb);
561
            avio_close(var->pb);
562 562
            var->pb = NULL;
563 563
        }
564 564
        av_free_packet(&var->pkt);
libavformat/avformat.h
261 261
#endif
262 262
} AVFormatParameters;
263 263

  
264
//! Demuxer will use url_fopen, no opened file should be provided by the caller.
264
//! Demuxer will use avio_open, no opened file should be provided by the caller.
265 265
#define AVFMT_NOFILE        0x0001
266 266
#define AVFMT_NEEDNUMBER    0x0002 /**< Needs '%d' in filename. */
267 267
#define AVFMT_SHOW_IDS      0x0008 /**< Show format stream IDs numbers. */
libavformat/avio.h
410 410
/**
411 411
 * @}
412 412
 */
413

  
414

  
415
/**
416
 * @defgroup old_url_f_funcs Old url_f* functions
417
 * @deprecated use the avio_ -prefixed functions instead.
418
 * @{
419
 */
420
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
421
attribute_deprecated int url_fclose(AVIOContext *s);
422
/**
423
 * @}
424
 */
413 425
#endif
414 426

  
415 427
AVIOContext *avio_alloc_context(
......
591 603
 * @return 0 in case of success, a negative value corresponding to an
592 604
 * AVERROR code in case of failure
593 605
 */
594
int url_fopen(AVIOContext **s, const char *url, int flags);
606
int avio_open(AVIOContext **s, const char *url, int flags);
595 607

  
596
int url_fclose(AVIOContext *s);
608
int avio_close(AVIOContext *s);
597 609
URLContext *url_fileno(AVIOContext *s);
598 610

  
599 611
/**
libavformat/aviobuf.c
356 356
{
357 357
    ffio_fill(s, b, count);
358 358
}
359

  
360
int url_fopen(AVIOContext **s, const char *filename, int flags)
361
{
362
    return avio_open(s, filename, flags);
363
}
364
int url_fclose(AVIOContext *s)
365
{
366
    return avio_close(s);
367
}
359 368
#endif
360 369

  
361 370
int avio_put_str(AVIOContext *s, const char *str)
......
843 852
    return 0;
844 853
}
845 854

  
846
int url_fopen(AVIOContext **s, const char *filename, int flags)
855
int avio_open(AVIOContext **s, const char *filename, int flags)
847 856
{
848 857
    URLContext *h;
849 858
    int err;
......
859 868
    return 0;
860 869
}
861 870

  
862
int url_fclose(AVIOContext *s)
871
int avio_close(AVIOContext *s)
863 872
{
864 873
    URLContext *h = s->opaque;
865 874

  
libavformat/img2.c
269 269
                                  s->path, s->img_number)<0 && s->img_number > 1)
270 270
            return AVERROR(EIO);
271 271
        for(i=0; i<3; i++){
272
            if (url_fopen(&f[i], filename, URL_RDONLY) < 0) {
272
            if (avio_open(&f[i], filename, URL_RDONLY) < 0) {
273 273
                if(i==1)
274 274
                    break;
275 275
                av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
......
300 300
        if(size[i]){
301 301
            ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]);
302 302
            if (!s->is_pipe)
303
                url_fclose(f[i]);
303
                avio_close(f[i]);
304 304
            if(ret[i]>0)
305 305
                pkt->size += ret[i];
306 306
        }
......
353 353
            return AVERROR(EIO);
354 354
        }
355 355
        for(i=0; i<3; i++){
356
            if (url_fopen(&pb[i], filename, URL_WRONLY) < 0) {
356
            if (avio_open(&pb[i], filename, URL_WRONLY) < 0) {
357 357
                av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
358 358
                return AVERROR(EIO);
359 359
            }
......
373 373
        avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
374 374
        put_flush_packet(pb[1]);
375 375
        put_flush_packet(pb[2]);
376
        url_fclose(pb[1]);
377
        url_fclose(pb[2]);
376
        avio_close(pb[1]);
377
        avio_close(pb[2]);
378 378
    }else{
379 379
        if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){
380 380
            AVStream *st = s->streams[0];
......
403 403
    }
404 404
    put_flush_packet(pb[0]);
405 405
    if (!img->is_pipe) {
406
        url_fclose(pb[0]);
406
        avio_close(pb[0]);
407 407
    }
408 408

  
409 409
    img->img_number++;
libavformat/mov.c
1718 1718

  
1719 1719
            av_strlcat(filename, ref->path + l + 1, 1024);
1720 1720

  
1721
            if (!url_fopen(pb, filename, URL_RDONLY))
1721
            if (!avio_open(pb, filename, URL_RDONLY))
1722 1722
                return 0;
1723 1723
        }
1724 1724
    }
......
2546 2546
        }
2547 2547
        av_freep(&sc->drefs);
2548 2548
        if (sc->pb && sc->pb != s->pb)
2549
            url_fclose(sc->pb);
2549
            avio_close(sc->pb);
2550 2550

  
2551 2551
        av_freep(&st->codec->palctrl);
2552 2552
    }
libavformat/output-example.c
492 492

  
493 493
    /* open the output file, if needed */
494 494
    if (!(fmt->flags & AVFMT_NOFILE)) {
495
        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
495
        if (avio_open(&oc->pb, filename, URL_WRONLY) < 0) {
496 496
            fprintf(stderr, "Could not open '%s'\n", filename);
497 497
            exit(1);
498 498
        }
......
545 545

  
546 546
    if (!(fmt->flags & AVFMT_NOFILE)) {
547 547
        /* close the output file */
548
        url_fclose(oc->pb);
548
        avio_close(oc->pb);
549 549
    }
550 550

  
551 551
    /* free the stream */
libavformat/rtpenc_chain.c
60 60

  
61 61
    if (ret) {
62 62
        if (handle) {
63
            url_fclose(rtpctx->pb);
63
            avio_close(rtpctx->pb);
64 64
        } else {
65 65
            uint8_t *ptr;
66 66
            url_close_dyn_buf(rtpctx->pb, &ptr);
libavformat/rtsp.c
498 498
                    url_close_dyn_buf(rtpctx->pb, &ptr);
499 499
                    av_free(ptr);
500 500
                } else {
501
                    url_fclose(rtpctx->pb);
501
                    avio_close(rtpctx->pb);
502 502
                }
503 503
                avformat_free_context(rtpctx);
504 504
            } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
libavformat/rtspdec.c
382 382
#if 0
383 383
    /* NOTE: it is valid to flush the buffer here */
384 384
    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
385
        url_fclose(&rt->rtsp_gb);
385
        avio_close(&rt->rtsp_gb);
386 386
    }
387 387
#endif
388 388
    ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
libavformat/sapenc.c
46 46
        if (!rtpctx)
47 47
            continue;
48 48
        av_write_trailer(rtpctx);
49
        url_fclose(rtpctx->pb);
49
        avio_close(rtpctx->pb);
50 50
        avformat_free_context(rtpctx);
51 51
        s->streams[i]->priv_data = NULL;
52 52
    }
libavformat/utils.c
616 616
       hack needed to handle RTSP/TCP */
617 617
    if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
618 618
        /* if no file needed do not try to open one */
619
        if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
619
        if ((err=avio_open(&pb, filename, URL_RDONLY)) < 0) {
620 620
            goto fail;
621 621
        }
622 622
        if (buf_size > 0) {
......
647 647
 fail:
648 648
    av_freep(&pd->buf);
649 649
    if (pb)
650
        url_fclose(pb);
650
        avio_close(pb);
651 651
    if (ap && ap->prealloced_context)
652 652
        av_free(*ic_ptr);
653 653
    *ic_ptr = NULL;
......
2623 2623
    AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
2624 2624
    av_close_input_stream(s);
2625 2625
    if (pb)
2626
        url_fclose(pb);
2626
        avio_close(pb);
2627 2627
}
2628 2628

  
2629 2629
AVStream *av_new_stream(AVFormatContext *s, int id)

Also available in: Unified diff