• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

debian/tmp/usr/include/libavformat/avio.h

Go to the documentation of this file.
00001 /*
00002  * copyright (c) 2001 Fabrice Bellard
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 #ifndef AVFORMAT_AVIO_H
00021 #define AVFORMAT_AVIO_H
00022 
00028 #include <stdint.h>
00029 
00030 #include "libavutil/common.h"
00031 #include "libavutil/log.h"
00032 
00033 #include "libavformat/version.h"
00034 
00035 
00036 #define AVIO_SEEKABLE_NORMAL 0x0001 
00050 typedef struct {
00051     unsigned char *buffer;  
00052     int buffer_size;        
00053     unsigned char *buf_ptr; 
00054     unsigned char *buf_end; 
00058     void *opaque;           
00060     int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
00061     int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
00062     int64_t (*seek)(void *opaque, int64_t offset, int whence);
00063     int64_t pos;            
00064     int must_flush;         
00065     int eof_reached;        
00066     int write_flag;         
00067 #if FF_API_OLD_AVIO
00068     attribute_deprecated int is_streamed;
00069 #endif
00070     int max_packet_size;
00071     unsigned long checksum;
00072     unsigned char *checksum_ptr;
00073     unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
00074     int error;              
00078     int (*read_pause)(void *opaque, int pause);
00084     int64_t (*read_seek)(void *opaque, int stream_index,
00085                          int64_t timestamp, int flags);
00089     int seekable;
00090 } AVIOContext;
00091 
00092 /* unbuffered I/O */
00093 
00094 #if FF_API_OLD_AVIO
00095 
00103 typedef struct URLContext {
00104 #if FF_API_URL_CLASS
00105     const AVClass *av_class; 
00106 #endif
00107     struct URLProtocol *prot;
00108     int flags;
00109     int is_streamed;  
00110     int max_packet_size;  
00111     void *priv_data;
00112     char *filename; 
00113     int is_connected;
00114 } URLContext;
00115 
00116 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
00117 
00122 typedef struct URLProtocol {
00123     const char *name;
00124     int (*url_open)(URLContext *h, const char *url, int flags);
00125     int (*url_read)(URLContext *h, unsigned char *buf, int size);
00126     int (*url_write)(URLContext *h, const unsigned char *buf, int size);
00127     int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
00128     int (*url_close)(URLContext *h);
00129     struct URLProtocol *next;
00130     int (*url_read_pause)(URLContext *h, int pause);
00131     int64_t (*url_read_seek)(URLContext *h, int stream_index,
00132                              int64_t timestamp, int flags);
00133     int (*url_get_file_handle)(URLContext *h);
00134     int priv_data_size;
00135     const AVClass *priv_data_class;
00136     int flags;
00137     int (*url_check)(URLContext *h, int mask);
00138 } URLProtocol;
00139 
00140 typedef struct URLPollEntry {
00141     URLContext *handle;
00142     int events;
00143     int revents;
00144 } URLPollEntry;
00145 
00146 /* not implemented */
00147 attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
00148 
00155 #define URL_RDONLY 0  
00156 #define URL_WRONLY 1  
00157 #define URL_RDWR   2  
00174 #define URL_FLAG_NONBLOCK 4
00175 
00176 typedef int URLInterruptCB(void);
00177 extern URLInterruptCB *url_interrupt_cb;
00178 
00184 attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
00185                                             const char *url, int flags);
00186 attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
00187 attribute_deprecated int url_connect(URLContext *h);
00188 attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
00189 attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
00190 attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
00191 attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
00192 attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
00193 attribute_deprecated int url_close(URLContext *h);
00194 attribute_deprecated int64_t url_filesize(URLContext *h);
00195 attribute_deprecated int url_get_file_handle(URLContext *h);
00196 attribute_deprecated int url_get_max_packet_size(URLContext *h);
00197 attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
00198 attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
00199 attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
00200                                               int64_t timestamp, int flags);
00201 attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
00202 
00207 URLProtocol *av_protocol_next(URLProtocol *p);
00208 
00214 attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
00220 typedef attribute_deprecated AVIOContext ByteIOContext;
00221 
00222 attribute_deprecated int init_put_byte(AVIOContext *s,
00223                   unsigned char *buffer,
00224                   int buffer_size,
00225                   int write_flag,
00226                   void *opaque,
00227                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
00228                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
00229                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
00230 attribute_deprecated AVIOContext *av_alloc_put_byte(
00231                   unsigned char *buffer,
00232                   int buffer_size,
00233                   int write_flag,
00234                   void *opaque,
00235                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
00236                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
00237                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
00238 
00244 attribute_deprecated int          get_buffer(AVIOContext *s, unsigned char *buf, int size);
00245 attribute_deprecated int          get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
00246 attribute_deprecated int          get_byte(AVIOContext *s);
00247 attribute_deprecated unsigned int get_le16(AVIOContext *s);
00248 attribute_deprecated unsigned int get_le24(AVIOContext *s);
00249 attribute_deprecated unsigned int get_le32(AVIOContext *s);
00250 attribute_deprecated uint64_t     get_le64(AVIOContext *s);
00251 attribute_deprecated unsigned int get_be16(AVIOContext *s);
00252 attribute_deprecated unsigned int get_be24(AVIOContext *s);
00253 attribute_deprecated unsigned int get_be32(AVIOContext *s);
00254 attribute_deprecated uint64_t     get_be64(AVIOContext *s);
00255 
00256 attribute_deprecated void         put_byte(AVIOContext *s, int b);
00257 attribute_deprecated void         put_nbyte(AVIOContext *s, int b, int count);
00258 attribute_deprecated void         put_buffer(AVIOContext *s, const unsigned char *buf, int size);
00259 attribute_deprecated void         put_le64(AVIOContext *s, uint64_t val);
00260 attribute_deprecated void         put_be64(AVIOContext *s, uint64_t val);
00261 attribute_deprecated void         put_le32(AVIOContext *s, unsigned int val);
00262 attribute_deprecated void         put_be32(AVIOContext *s, unsigned int val);
00263 attribute_deprecated void         put_le24(AVIOContext *s, unsigned int val);
00264 attribute_deprecated void         put_be24(AVIOContext *s, unsigned int val);
00265 attribute_deprecated void         put_le16(AVIOContext *s, unsigned int val);
00266 attribute_deprecated void         put_be16(AVIOContext *s, unsigned int val);
00267 attribute_deprecated void         put_tag(AVIOContext *s, const char *tag);
00272 attribute_deprecated int     av_url_read_fpause(AVIOContext *h,    int pause);
00273 attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h,    int stream_index,
00274                                                 int64_t timestamp, int flags);
00275 
00281 attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
00282 attribute_deprecated int url_fclose(AVIOContext *s);
00283 attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
00284 attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
00285 attribute_deprecated int64_t url_ftell(AVIOContext *s);
00286 attribute_deprecated int64_t url_fsize(AVIOContext *s);
00287 #define URL_EOF (-1)
00288 attribute_deprecated int url_fgetc(AVIOContext *s);
00289 attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
00290 #ifdef __GNUC__
00291 attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
00292 #else
00293 attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
00294 #endif
00295 attribute_deprecated void put_flush_packet(AVIOContext *s);
00296 attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
00297 attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
00298 attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
00299 attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
00304 attribute_deprecated int url_ferror(AVIOContext *s);
00305 
00306 attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
00307 attribute_deprecated int udp_get_local_port(URLContext *h);
00308 
00309 attribute_deprecated void init_checksum(AVIOContext *s,
00310                    unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
00311                    unsigned long checksum);
00312 attribute_deprecated unsigned long get_checksum(AVIOContext *s);
00313 attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
00316 attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
00320 attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
00324 attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
00325 {
00326     return !s->seekable;
00327 }
00328 attribute_deprecated URLContext *url_fileno(AVIOContext *s);
00329 
00333 attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
00334 
00335 attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
00336 
00338 attribute_deprecated int url_close_buf(AVIOContext *s);
00339 
00345 attribute_deprecated int url_exist(const char *url);
00346 #endif // FF_API_OLD_AVIO
00347 
00363 int avio_check(const char *url, int flags);
00364 
00371 void avio_set_interrupt_cb(int (*interrupt_cb)(void));
00372 
00373 #if FF_API_REGISTER_PROTOCOL
00374 extern URLProtocol *first_protocol;
00375 #endif
00376 
00377 #if FF_API_REGISTER_PROTOCOL
00378 
00381 attribute_deprecated int register_protocol(URLProtocol *protocol);
00382 
00386 attribute_deprecated int av_register_protocol(URLProtocol *protocol);
00387 #endif
00388 
00406 AVIOContext *avio_alloc_context(
00407                   unsigned char *buffer,
00408                   int buffer_size,
00409                   int write_flag,
00410                   void *opaque,
00411                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
00412                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
00413                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
00414 
00415 void avio_w8(AVIOContext *s, int b);
00416 void avio_write(AVIOContext *s, const unsigned char *buf, int size);
00417 void avio_wl64(AVIOContext *s, uint64_t val);
00418 void avio_wb64(AVIOContext *s, uint64_t val);
00419 void avio_wl32(AVIOContext *s, unsigned int val);
00420 void avio_wb32(AVIOContext *s, unsigned int val);
00421 void avio_wl24(AVIOContext *s, unsigned int val);
00422 void avio_wb24(AVIOContext *s, unsigned int val);
00423 void avio_wl16(AVIOContext *s, unsigned int val);
00424 void avio_wb16(AVIOContext *s, unsigned int val);
00425 
00430 int avio_put_str(AVIOContext *s, const char *str);
00431 
00436 int avio_put_str16le(AVIOContext *s, const char *str);
00437 
00443 #define AVSEEK_SIZE 0x10000
00444 
00451 #define AVSEEK_FORCE 0x20000
00452 
00457 int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
00458 
00463 int64_t avio_skip(AVIOContext *s, int64_t offset);
00464 
00469 static av_always_inline int64_t avio_tell(AVIOContext *s)
00470 {
00471     return avio_seek(s, 0, SEEK_CUR);
00472 }
00473 
00478 int64_t avio_size(AVIOContext *s);
00479 
00484 int url_feof(AVIOContext *s);
00485 
00487 #ifdef __GNUC__
00488 int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
00489 #else
00490 int avio_printf(AVIOContext *s, const char *fmt, ...);
00491 #endif
00492 
00493 void avio_flush(AVIOContext *s);
00494 
00495 
00500 int avio_read(AVIOContext *s, unsigned char *buf, int size);
00501 
00509 int          avio_r8  (AVIOContext *s);
00510 unsigned int avio_rl16(AVIOContext *s);
00511 unsigned int avio_rl24(AVIOContext *s);
00512 unsigned int avio_rl32(AVIOContext *s);
00513 uint64_t     avio_rl64(AVIOContext *s);
00514 unsigned int avio_rb16(AVIOContext *s);
00515 unsigned int avio_rb24(AVIOContext *s);
00516 unsigned int avio_rb32(AVIOContext *s);
00517 uint64_t     avio_rb64(AVIOContext *s);
00534 int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
00535 
00542 int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
00543 int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
00544 
00545 
00546 #if FF_API_URL_RESETBUF
00547 
00551 int url_resetbuf(AVIOContext *s, int flags);
00552 #endif
00553 
00560 #if LIBAVFORMAT_VERSION_MAJOR < 53
00561 #define AVIO_RDONLY 0  
00562 #define AVIO_WRONLY 1  
00563 #define AVIO_RDWR   2  
00564 #else
00565 #define AVIO_RDONLY 1  
00566 #define AVIO_WRONLY 2  
00567 #define AVIO_RDWR   4  
00568 #endif
00569 
00585 #if LIBAVFORMAT_VERSION_MAJOR < 53
00586 #define AVIO_FLAG_NONBLOCK 4
00587 #else
00588 #define AVIO_FLAG_NONBLOCK 8
00589 #endif
00590 
00604 int avio_open(AVIOContext **s, const char *url, int flags);
00605 
00612 int avio_close(AVIOContext *s);
00613 
00620 int avio_open_dyn_buf(AVIOContext **s);
00621 
00631 int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
00632 
00633 #if FF_API_UDP_GET_FILE
00634 int udp_get_file_handle(URLContext *h);
00635 #endif
00636 
00649 const char *avio_enum_protocols(void **opaque, int output);
00650 
00656 int     avio_pause(AVIOContext *h, int pause);
00657 
00675 int64_t avio_seek_time(AVIOContext *h, int stream_index,
00676                        int64_t timestamp, int flags);
00677 
00678 #endif /* AVFORMAT_AVIO_H */

Generated on Wed Apr 11 2012 07:31:32 for FFmpeg by  doxygen 1.7.1