Revision f1ef2cd9

View differences:

libavformat/avio.h
601 601
#endif
602 602

  
603 603
/**
604
 * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
605
 * Used after probing to avoid seeking.
606
 * Joins buf and s->buffer, taking any overlap into consideration.
607
 * @note s->buffer must overlap with buf or they can't be joined and the function fails
608
 * @note This function is NOT part of the public API
609
 *
610
 * @param s The read-only AVIOContext to rewind
611
 * @param buf The probe buffer containing the first buf_size bytes of the file
612
 * @param buf_size The size of buf
613
 * @return 0 in case of success, a negative value corresponding to an
614
 * AVERROR code in case of failure
615
 */
616
int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size);
617

  
618
/**
619 604
 * Create and initialize a AVIOContext for accessing the
620 605
 * resource indicated by url.
621 606
 * @note When the resource indicated by url has been opened in
libavformat/avio_internal.h
47 47
    avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3]));
48 48
}
49 49

  
50
/**
51
 * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
52
 * Used after probing to avoid seeking.
53
 * Joins buf and s->buffer, taking any overlap into consideration.
54
 * @note s->buffer must overlap with buf or they can't be joined and the function fails
55
 *
56
 * @param s The read-only AVIOContext to rewind
57
 * @param buf The probe buffer containing the first buf_size bytes of the file
58
 * @param buf_size The size of buf
59
 * @return 0 in case of success, a negative value corresponding to an
60
 * AVERROR code in case of failure
61
 */
62
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size);
63

  
50 64
#endif // AVFORMAT_AVIO_INTERNAL_H
libavformat/aviobuf.c
837 837
    return 0;
838 838
}
839 839

  
840
int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)
840
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)
841 841
{
842 842
    int64_t buffer_start;
843 843
    int buffer_size;
libavformat/utils.c
19 19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
 */
21 21
#include "avformat.h"
22
#include "avio_internal.h"
22 23
#include "internal.h"
23 24
#include "libavcodec/internal.h"
24 25
#include "libavutil/opt.h"
......
585 586
    }
586 587

  
587 588
    /* rewind. reuse probe buffer to avoid seeking */
588
    if ((ret = ff_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0)
589
    if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0)
589 590
        av_free(buf);
590 591

  
591 592
    return ret;

Also available in: Unified diff