annotate ffmpeg/libavformat/avio_internal.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 *
yading@11 3 * This file is part of FFmpeg.
yading@11 4 *
yading@11 5 * FFmpeg is free software; you can redistribute it and/or
yading@11 6 * modify it under the terms of the GNU Lesser General Public
yading@11 7 * License as published by the Free Software Foundation; either
yading@11 8 * version 2.1 of the License, or (at your option) any later version.
yading@11 9 *
yading@11 10 * FFmpeg is distributed in the hope that it will be useful,
yading@11 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 13 * Lesser General Public License for more details.
yading@11 14 *
yading@11 15 * You should have received a copy of the GNU Lesser General Public
yading@11 16 * License along with FFmpeg; if not, write to the Free Software
yading@11 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 18 */
yading@11 19
yading@11 20 #ifndef AVFORMAT_AVIO_INTERNAL_H
yading@11 21 #define AVFORMAT_AVIO_INTERNAL_H
yading@11 22
yading@11 23 #include "avio.h"
yading@11 24 #include "url.h"
yading@11 25
yading@11 26 #include "libavutil/log.h"
yading@11 27
yading@11 28 extern const AVClass ffio_url_class;
yading@11 29
yading@11 30 int ffio_init_context(AVIOContext *s,
yading@11 31 unsigned char *buffer,
yading@11 32 int buffer_size,
yading@11 33 int write_flag,
yading@11 34 void *opaque,
yading@11 35 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
yading@11 36 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
yading@11 37 int64_t (*seek)(void *opaque, int64_t offset, int whence));
yading@11 38
yading@11 39
yading@11 40 /**
yading@11 41 * Read size bytes from AVIOContext into buf.
yading@11 42 * This reads at most 1 packet. If that is not enough fewer bytes will be
yading@11 43 * returned.
yading@11 44 * @return number of bytes read or AVERROR
yading@11 45 */
yading@11 46 int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size);
yading@11 47
yading@11 48 void ffio_fill(AVIOContext *s, int b, int count);
yading@11 49
yading@11 50 static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
yading@11 51 {
yading@11 52 avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3]));
yading@11 53 }
yading@11 54
yading@11 55 /**
yading@11 56 * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
yading@11 57 * Used after probing to avoid seeking.
yading@11 58 * Joins buf and s->buffer, taking any overlap into consideration.
yading@11 59 * @note s->buffer must overlap with buf or they can't be joined and the function fails
yading@11 60 *
yading@11 61 * @param s The read-only AVIOContext to rewind
yading@11 62 * @param buf The probe buffer containing the first buf_size bytes of the file
yading@11 63 * @param buf_size The size of buf
yading@11 64 * @return 0 in case of success, a negative value corresponding to an
yading@11 65 * AVERROR code in case of failure
yading@11 66 */
yading@11 67 int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **buf, int buf_size);
yading@11 68
yading@11 69 uint64_t ffio_read_varlen(AVIOContext *bc);
yading@11 70
yading@11 71 /** @warning must be called before any I/O */
yading@11 72 int ffio_set_buf_size(AVIOContext *s, int buf_size);
yading@11 73
yading@11 74 int ffio_limit(AVIOContext *s, int size);
yading@11 75
yading@11 76 void ffio_init_checksum(AVIOContext *s,
yading@11 77 unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
yading@11 78 unsigned long checksum);
yading@11 79 unsigned long ffio_get_checksum(AVIOContext *s);
yading@11 80 unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
yading@11 81 unsigned int len);
yading@11 82
yading@11 83 /**
yading@11 84 * Open a write only packetized memory stream with a maximum packet
yading@11 85 * size of 'max_packet_size'. The stream is stored in a memory buffer
yading@11 86 * with a big-endian 4 byte header giving the packet size in bytes.
yading@11 87 *
yading@11 88 * @param s new IO context
yading@11 89 * @param max_packet_size maximum packet size (must be > 0)
yading@11 90 * @return zero if no error.
yading@11 91 */
yading@11 92 int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
yading@11 93
yading@11 94 /**
yading@11 95 * Create and initialize a AVIOContext for accessing the
yading@11 96 * resource referenced by the URLContext h.
yading@11 97 * @note When the URLContext h has been opened in read+write mode, the
yading@11 98 * AVIOContext can be used only for writing.
yading@11 99 *
yading@11 100 * @param s Used to return the pointer to the created AVIOContext.
yading@11 101 * In case of failure the pointed to value is set to NULL.
yading@11 102 * @return 0 in case of success, a negative value corresponding to an
yading@11 103 * AVERROR code in case of failure
yading@11 104 */
yading@11 105 int ffio_fdopen(AVIOContext **s, URLContext *h);
yading@11 106
yading@11 107 #endif /* AVFORMAT_AVIO_INTERNAL_H */