misc/winutils/include/libavformat/avio.h
author unc0rr
Fri, 20 Nov 2015 23:05:49 +0300
branchqmlfrontend
changeset 11422 4815e406a760
parent 7813 7ac83d79b897
permissions -rw-r--r--
Fix losing commands
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7813
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     1
/*
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     2
 * copyright (c) 2001 Fabrice Bellard
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     3
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     4
 * This file is part of Libav.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     5
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     6
 * Libav is free software; you can redistribute it and/or
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     7
 * modify it under the terms of the GNU Lesser General Public
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     8
 * License as published by the Free Software Foundation; either
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     9
 * version 2.1 of the License, or (at your option) any later version.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    10
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    11
 * Libav is distributed in the hope that it will be useful,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    14
 * Lesser General Public License for more details.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    15
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    16
 * You should have received a copy of the GNU Lesser General Public
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    17
 * License along with Libav; if not, write to the Free Software
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    19
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    20
#ifndef AVFORMAT_AVIO_H
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    21
#define AVFORMAT_AVIO_H
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    22
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    23
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    24
 * @file
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    25
 * @ingroup lavf_io
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    26
 * Buffered I/O operations
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    27
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    28
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    29
#include <stdint.h>
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    30
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    31
#include "libavutil/common.h"
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    32
#include "libavutil/dict.h"
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    33
#include "libavutil/log.h"
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    34
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    35
#include "libavformat/version.h"
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    36
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    37
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    38
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    39
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    40
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    41
 * Callback for checking whether to abort blocking functions.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    42
 * AVERROR_EXIT is returned in this case by the interrupted
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    43
 * function. During blocking operations, callback is called with
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    44
 * opaque as parameter. If the callback returns 1, the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    45
 * blocking operation will be aborted.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    46
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    47
 * No members can be added to this struct without a major bump, if
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    48
 * new elements have been added after this struct in AVFormatContext
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    49
 * or AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    50
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    51
typedef struct AVIOInterruptCB {
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    52
    int (*callback)(void*);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    53
    void *opaque;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    54
} AVIOInterruptCB;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    55
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    56
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    57
 * Bytestream IO Context.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    58
 * New fields can be added to the end with minor version bumps.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    59
 * Removal, reordering and changes to existing fields require a major
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    60
 * version bump.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    61
 * sizeof(AVIOContext) must not be used outside libav*.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    62
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    63
 * @note None of the function pointers in AVIOContext should be called
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    64
 *       directly, they should only be set by the client application
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    65
 *       when implementing custom I/O. Normally these are set to the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    66
 *       function pointers specified in avio_alloc_context()
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    67
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    68
typedef struct AVIOContext {
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    69
    /**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    70
     * A class for private options.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    71
     *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    72
     * If this AVIOContext is created by avio_open2(), av_class is set and
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    73
     * passes the options down to protocols.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    74
     *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    75
     * If this AVIOContext is manually allocated, then av_class may be set by
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    76
     * the caller.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    77
     *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    78
     * warning -- this field can be NULL, be sure to not pass this AVIOContext
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    79
     * to any av_opt_* functions in that case.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    80
     */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    81
    const AVClass *av_class;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    82
    unsigned char *buffer;  /**< Start of the buffer. */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    83
    int buffer_size;        /**< Maximum buffer size */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    84
    unsigned char *buf_ptr; /**< Current position in the buffer */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    85
    unsigned char *buf_end; /**< End of the data, may be less than
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    86
                                 buffer+buffer_size if the read function returned
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    87
                                 less data than requested, e.g. for streams where
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    88
                                 no more data has been received yet. */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    89
    void *opaque;           /**< A private pointer, passed to the read/write/seek/...
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    90
                                 functions. */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    91
    int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    92
    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    93
    int64_t (*seek)(void *opaque, int64_t offset, int whence);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    94
    int64_t pos;            /**< position in the file of the current buffer */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    95
    int must_flush;         /**< true if the next seek should flush */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    96
    int eof_reached;        /**< true if eof reached */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    97
    int write_flag;         /**< true if open for writing */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    98
    int max_packet_size;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    99
    unsigned long checksum;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   100
    unsigned char *checksum_ptr;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   101
    unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   102
    int error;              /**< contains the error code or 0 if no error happened */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   103
    /**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   104
     * Pause or resume playback for network streaming protocols - e.g. MMS.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   105
     */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   106
    int (*read_pause)(void *opaque, int pause);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   107
    /**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   108
     * Seek to a given timestamp in stream with the specified stream_index.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   109
     * Needed for some network streaming protocols which don't support seeking
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   110
     * to byte position.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   111
     */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   112
    int64_t (*read_seek)(void *opaque, int stream_index,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   113
                         int64_t timestamp, int flags);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   114
    /**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   115
     * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   116
     */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   117
    int seekable;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   118
} AVIOContext;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   119
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   120
/* unbuffered I/O */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   121
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   122
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   123
 * Return AVIO_FLAG_* access flags corresponding to the access permissions
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   124
 * of the resource in url, or a negative value corresponding to an
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   125
 * AVERROR code in case of failure. The returned access flags are
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   126
 * masked by the value in flags.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   127
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   128
 * @note This function is intrinsically unsafe, in the sense that the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   129
 * checked resource may change its existence or permission status from
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   130
 * one call to another. Thus you should not trust the returned value,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   131
 * unless you are sure that no other processes are accessing the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   132
 * checked resource.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   133
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   134
int avio_check(const char *url, int flags);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   135
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   136
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   137
 * Allocate and initialize an AVIOContext for buffered I/O. It must be later
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   138
 * freed with av_free().
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   139
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   140
 * @param buffer Memory block for input/output operations via AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   141
 *        The buffer must be allocated with av_malloc() and friends.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   142
 * @param buffer_size The buffer size is very important for performance.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   143
 *        For protocols with fixed blocksize it should be set to this blocksize.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   144
 *        For others a typical size is a cache page, e.g. 4kb.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   145
 * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   146
 * @param opaque An opaque pointer to user-specific data.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   147
 * @param read_packet  A function for refilling the buffer, may be NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   148
 * @param write_packet A function for writing the buffer contents, may be NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   149
 * @param seek A function for seeking to specified byte position, may be NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   150
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   151
 * @return Allocated AVIOContext or NULL on failure.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   152
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   153
AVIOContext *avio_alloc_context(
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   154
                  unsigned char *buffer,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   155
                  int buffer_size,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   156
                  int write_flag,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   157
                  void *opaque,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   158
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   159
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   160
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   161
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   162
void avio_w8(AVIOContext *s, int b);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   163
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   164
void avio_wl64(AVIOContext *s, uint64_t val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   165
void avio_wb64(AVIOContext *s, uint64_t val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   166
void avio_wl32(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   167
void avio_wb32(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   168
void avio_wl24(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   169
void avio_wb24(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   170
void avio_wl16(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   171
void avio_wb16(AVIOContext *s, unsigned int val);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   172
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   173
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   174
 * Write a NULL-terminated string.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   175
 * @return number of bytes written.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   176
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   177
int avio_put_str(AVIOContext *s, const char *str);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   178
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   179
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   180
 * Convert an UTF-8 string to UTF-16LE and write it.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   181
 * @return number of bytes written.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   182
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   183
int avio_put_str16le(AVIOContext *s, const char *str);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   184
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   185
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   186
 * Passing this as the "whence" parameter to a seek function causes it to
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   187
 * return the filesize without seeking anywhere. Supporting this is optional.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   188
 * If it is not supported then the seek function will return <0.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   189
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   190
#define AVSEEK_SIZE 0x10000
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   191
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   192
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   193
 * Oring this flag as into the "whence" parameter to a seek function causes it to
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   194
 * seek by any means (like reopening and linear reading) or other normally unreasonble
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   195
 * means that can be extreemly slow.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   196
 * This may be ignored by the seek code.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   197
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   198
#define AVSEEK_FORCE 0x20000
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   199
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   200
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   201
 * fseek() equivalent for AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   202
 * @return new position or AVERROR.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   203
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   204
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   205
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   206
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   207
 * Skip given number of bytes forward
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   208
 * @return new position or AVERROR.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   209
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   210
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   211
{
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   212
    return avio_seek(s, offset, SEEK_CUR);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   213
}
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   214
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   215
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   216
 * ftell() equivalent for AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   217
 * @return position or AVERROR.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   218
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   219
static av_always_inline int64_t avio_tell(AVIOContext *s)
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   220
{
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   221
    return avio_seek(s, 0, SEEK_CUR);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   222
}
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   223
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   224
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   225
 * Get the filesize.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   226
 * @return filesize or AVERROR
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   227
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   228
int64_t avio_size(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   229
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   230
/** @warning currently size is limited */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   231
int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   232
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   233
void avio_flush(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   234
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   235
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   236
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   237
 * Read size bytes from AVIOContext into buf.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   238
 * @return number of bytes read or AVERROR
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   239
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   240
int avio_read(AVIOContext *s, unsigned char *buf, int size);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   241
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   242
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   243
 * @name Functions for reading from AVIOContext
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   244
 * @{
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   245
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   246
 * @note return 0 if EOF, so you cannot use it if EOF handling is
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   247
 *       necessary
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   248
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   249
int          avio_r8  (AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   250
unsigned int avio_rl16(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   251
unsigned int avio_rl24(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   252
unsigned int avio_rl32(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   253
uint64_t     avio_rl64(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   254
unsigned int avio_rb16(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   255
unsigned int avio_rb24(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   256
unsigned int avio_rb32(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   257
uint64_t     avio_rb64(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   258
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   259
 * @}
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   260
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   261
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   262
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   263
 * Read a string from pb into buf. The reading will terminate when either
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   264
 * a NULL character was encountered, maxlen bytes have been read, or nothing
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   265
 * more can be read from pb. The result is guaranteed to be NULL-terminated, it
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   266
 * will be truncated if buf is too small.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   267
 * Note that the string is not interpreted or validated in any way, it
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   268
 * might get truncated in the middle of a sequence for multi-byte encodings.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   269
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   270
 * @return number of bytes read (is always <= maxlen).
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   271
 * If reading ends on EOF or error, the return value will be one more than
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   272
 * bytes actually read.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   273
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   274
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   275
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   276
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   277
 * Read a UTF-16 string from pb and convert it to UTF-8.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   278
 * The reading will terminate when either a null or invalid character was
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   279
 * encountered or maxlen bytes have been read.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   280
 * @return number of bytes read (is always <= maxlen)
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   281
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   282
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   283
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   284
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   285
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   286
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   287
 * @name URL open modes
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   288
 * The flags argument to avio_open must be one of the following
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   289
 * constants, optionally ORed with other flags.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   290
 * @{
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   291
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   292
#define AVIO_FLAG_READ  1                                      /**< read-only */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   293
#define AVIO_FLAG_WRITE 2                                      /**< write-only */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   294
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)  /**< read-write pseudo flag */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   295
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   296
 * @}
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   297
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   298
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   299
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   300
 * Use non-blocking mode.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   301
 * If this flag is set, operations on the context will return
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   302
 * AVERROR(EAGAIN) if they can not be performed immediately.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   303
 * If this flag is not set, operations on the context will never return
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   304
 * AVERROR(EAGAIN).
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   305
 * Note that this flag does not affect the opening/connecting of the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   306
 * context. Connecting a protocol will always block if necessary (e.g. on
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   307
 * network protocols) but never hang (e.g. on busy devices).
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   308
 * Warning: non-blocking protocols is work-in-progress; this flag may be
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   309
 * silently ignored.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   310
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   311
#define AVIO_FLAG_NONBLOCK 8
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   312
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   313
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   314
 * Create and initialize a AVIOContext for accessing the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   315
 * resource indicated by url.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   316
 * @note When the resource indicated by url has been opened in
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   317
 * read+write mode, the AVIOContext can be used only for writing.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   318
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   319
 * @param s Used to return the pointer to the created AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   320
 * In case of failure the pointed to value is set to NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   321
 * @param flags flags which control how the resource indicated by url
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   322
 * is to be opened
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   323
 * @return 0 in case of success, a negative value corresponding to an
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   324
 * AVERROR code in case of failure
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   325
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   326
int avio_open(AVIOContext **s, const char *url, int flags);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   327
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   328
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   329
 * Create and initialize a AVIOContext for accessing the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   330
 * resource indicated by url.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   331
 * @note When the resource indicated by url has been opened in
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   332
 * read+write mode, the AVIOContext can be used only for writing.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   333
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   334
 * @param s Used to return the pointer to the created AVIOContext.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   335
 * In case of failure the pointed to value is set to NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   336
 * @param flags flags which control how the resource indicated by url
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   337
 * is to be opened
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   338
 * @param int_cb an interrupt callback to be used at the protocols level
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   339
 * @param options  A dictionary filled with protocol-private options. On return
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   340
 * this parameter will be destroyed and replaced with a dict containing options
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   341
 * that were not found. May be NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   342
 * @return 0 in case of success, a negative value corresponding to an
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   343
 * AVERROR code in case of failure
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   344
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   345
int avio_open2(AVIOContext **s, const char *url, int flags,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   346
               const AVIOInterruptCB *int_cb, AVDictionary **options);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   347
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   348
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   349
 * Close the resource accessed by the AVIOContext s and free it.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   350
 * This function can only be used if s was opened by avio_open().
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   351
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   352
 * The internal buffer is automatically flushed before closing the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   353
 * resource.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   354
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   355
 * @return 0 on success, an AVERROR < 0 on error.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   356
 * @see avio_closep
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   357
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   358
int avio_close(AVIOContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   359
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   360
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   361
 * Close the resource accessed by the AVIOContext *s, free it
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   362
 * and set the pointer pointing to it to NULL.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   363
 * This function can only be used if s was opened by avio_open().
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   364
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   365
 * The internal buffer is automatically flushed before closing the
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   366
 * resource.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   367
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   368
 * @return 0 on success, an AVERROR < 0 on error.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   369
 * @see avio_close
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   370
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   371
int avio_closep(AVIOContext **s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   372
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   373
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   374
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   375
 * Open a write only memory stream.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   376
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   377
 * @param s new IO context
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   378
 * @return zero if no error.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   379
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   380
int avio_open_dyn_buf(AVIOContext **s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   381
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   382
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   383
 * Return the written size and a pointer to the buffer. The buffer
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   384
 * must be freed with av_free().
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   385
 * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   386
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   387
 * @param s IO context
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   388
 * @param pbuffer pointer to a byte buffer
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   389
 * @return the length of the byte buffer
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   390
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   391
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   392
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   393
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   394
 * Iterate through names of available protocols.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   395
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   396
 * @param opaque A private pointer representing current protocol.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   397
 *        It must be a pointer to NULL on first iteration and will
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   398
 *        be updated by successive calls to avio_enum_protocols.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   399
 * @param output If set to 1, iterate over output protocols,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   400
 *               otherwise over input protocols.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   401
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   402
 * @return A static string containing the name of current protocol or NULL
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   403
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   404
const char *avio_enum_protocols(void **opaque, int output);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   405
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   406
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   407
 * Pause and resume playing - only meaningful if using a network streaming
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   408
 * protocol (e.g. MMS).
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   409
 * @param pause 1 for pause, 0 for resume
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   410
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   411
int     avio_pause(AVIOContext *h, int pause);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   412
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   413
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   414
 * Seek to a given timestamp relative to some component stream.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   415
 * Only meaningful if using a network streaming protocol (e.g. MMS.).
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   416
 * @param stream_index The stream index that the timestamp is relative to.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   417
 *        If stream_index is (-1) the timestamp should be in AV_TIME_BASE
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   418
 *        units from the beginning of the presentation.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   419
 *        If a stream_index >= 0 is used and the protocol does not support
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   420
 *        seeking based on component streams, the call will fail with ENOTSUP.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   421
 * @param timestamp timestamp in AVStream.time_base units
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   422
 *        or if there is no stream specified then in AV_TIME_BASE units.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   423
 * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   424
 *        and AVSEEK_FLAG_ANY. The protocol may silently ignore
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   425
 *        AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   426
 *        fail with ENOTSUP if used and not supported.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   427
 * @return >= 0 on success
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   428
 * @see AVInputFormat::read_seek
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   429
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   430
int64_t avio_seek_time(AVIOContext *h, int stream_index,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   431
                       int64_t timestamp, int flags);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   432
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   433
#endif /* AVFORMAT_AVIO_H */