Revision a8c5ab27 libavformat/aviobuf.c

View differences:

libavformat/aviobuf.c
303 303
    }
304 304
}
305 305

  
306
/* NOTE: return 0 if EOF, so you cannot use it if EOF handling is
307
   necessary */
308 306
/* XXX: put an inline version */
309 307
int get_byte(ByteIOContext *s)
310 308
{
......
319 317
    }
320 318
}
321 319

  
322
/* NOTE: return URL_EOF (-1) if EOF */
323 320
int url_fgetc(ByteIOContext *s)
324 321
{
325 322
    if (s->buf_ptr < s->buf_end) {
......
524 521
    return 0;
525 522
}
526 523

  
527
/* XXX: must be called before any I/O */
528 524
int url_setbufsize(ByteIOContext *s, int buf_size)
529 525
{
530 526
    uint8_t *buffer;
......
543 539
    return 0;
544 540
}
545 541

  
546
/* NOTE: when opened as read/write, the buffers are only used for
547
   reading */
548 542
int url_fopen(ByteIOContext *s, const char *filename, int flags)
549 543
{
550 544
    URLContext *h;
......
576 570
}
577 571

  
578 572
#ifdef CONFIG_MUXERS
579
/* XXX: currently size is limited */
580 573
int url_fprintf(ByteIOContext *s, const char *fmt, ...)
581 574
{
582 575
    va_list ap;
......
591 584
}
592 585
#endif //CONFIG_MUXERS
593 586

  
594
/* note: unlike fgets, the EOL character is not returned and a whole
595
   line is parsed. return NULL if first char read was EOF */
596 587
char *url_fgets(ByteIOContext *s, char *buf, int buf_size)
597 588
{
598 589
    int c;
......
614 605
    return buf;
615 606
}
616 607

  
617
/*
618
 * Return the maximum packet size associated to packetized buffered file
619
 * handle. If the file is not packetized (stream like http or file on
620
 * disk), then 0 is returned.
621
 *
622
 * @param h buffered file handle
623
 * @return maximum packet size in bytes
624
 */
625 608
int url_fget_max_packet_size(ByteIOContext *s)
626 609
{
627 610
    return s->max_packet_size;
......
638 621
                         NULL, NULL, NULL, NULL);
639 622
}
640 623

  
641
/* return the written or read size */
642 624
int url_close_buf(ByteIOContext *s)
643 625
{
644 626
    put_flush_packet(s);
......
746 728
    return ret;
747 729
}
748 730

  
749
/*
750
 * Open a write only memory stream.
751
 *
752
 * @param s new IO context
753
 * @return zero if no error.
754
 */
755 731
int url_open_dyn_buf(ByteIOContext *s)
756 732
{
757 733
    return url_open_dyn_buf_internal(s, 0);
758 734
}
759 735

  
760
/*
761
 * Open a write only packetized memory stream with a maximum packet
762
 * size of 'max_packet_size'.  The stream is stored in a memory buffer
763
 * with a big endian 4 byte header giving the packet size in bytes.
764
 *
765
 * @param s new IO context
766
 * @param max_packet_size maximum packet size (must be > 0)
767
 * @return zero if no error.
768
 */
769 736
int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size)
770 737
{
771 738
    if (max_packet_size <= 0)
......
773 740
    return url_open_dyn_buf_internal(s, max_packet_size);
774 741
}
775 742

  
776
/*
777
 * Return the written size and a pointer to the buffer. The buffer
778
 *  must be freed with av_free().
779
 * @param s IO context
780
 * @param pointer to a byte buffer
781
 * @return the length of the byte buffer
782
 */
783 743
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
784 744
{
785 745
    DynBuffer *d = s->opaque;

Also available in: Unified diff