diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-04-11 04:02:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-11 04:08:08 +0200 |
commit | ab8cfd45f8dcff5a9d60271b30dc4437756d5985 (patch) | |
tree | 0f74fb858daf39079fcca2a7ebde67676234ceec | |
parent | 2e92a34cde07ea145e4b8380259881988cf7edd3 (diff) | |
parent | d1c5fdf8920b75f3b824368b8336f18c74b68803 (diff) | |
download | ffmpeg-ab8cfd45f8dcff5a9d60271b30dc4437756d5985.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master:
avio: add more documentation for AVIOContext.
Parse sprite data for WMVP and WVP2, and decode sprites for the latter
Replace outdated info on the FAQ
Redefine sameq
pad: fix example explanation
gradfun: add notice from the MPlayer manual
eval: add support for trunc, ceil, and floor functions
documentation: add setdar and setsar description to filters.texi
avio: document some members of AVIOContext.
avio: document avio_close().
avio: cosmetics, vertically align comments.
avio: cosmetics, group the reading functions.
avio: cosmetics, merge all the FF_API_OLD_AVIO blocks.
avio: cosmetics, move AVIOContext to start of the file.
avio: update file header.
os: fix OpenBSD/PowerPC compilation
pixfmt: add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE
oggdec: fix demuxing chained audio streams
fix typo
Conflicts:
doc/filters.texi
libavformat/avio.h
libavutil/pixfmt.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavcodec/vc1.c | 3 | ||||
-rw-r--r-- | libavcodec/vc1.h | 6 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 127 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavformat/avio.h | 319 | ||||
-rw-r--r-- | libavformat/oggdec.c | 16 | ||||
-rw-r--r-- | libavformat/oggdec.h | 1 | ||||
-rw-r--r-- | libavformat/riff.c | 1 | ||||
-rw-r--r-- | libavutil/ppc/cpu.c | 1 |
10 files changed, 315 insertions, 164 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 22d08d4453..e3be1f4858 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-04-10 - lavu 50.40.0 - pixfmt.h + Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats + 2011-04-08 - lavf 52.106.0 - avformat.h Minor avformat.h cleanup: a9bf9d8 deprecate av_guess_image2_codec diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 73f0cba042..1b1809588e 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -605,9 +605,6 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; - if(v->res_sprite) { - skip_bits(gb, 2); //not yet deciphered - } if(v->finterpflag) v->interpfrm = get_bits1(gb); skip_bits(gb, 2); //framecnt unused v->rangeredfrm = 0; diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 8d907c3bf0..261ac541f9 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -306,6 +306,12 @@ typedef struct VC1Context{ uint8_t range_mapuv; //@} + /** Frame decoding info for sprite modes */ + //@{ + int new_sprite; + int two_sprites; + //@} + int p_frame_skipped; int bi_type; int x8_type; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index ae035a6ce2..41322ef726 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3097,6 +3097,116 @@ static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) } } +static inline float get_float_val(GetBitContext* gb) +{ + return (float)get_bits_long(gb, 30) / (1<<15) - (1<<14); +} + +static void vc1_sprite_parse_transform(VC1Context *v, GetBitContext* gb, float c[7]) +{ + c[1] = c[3] = 0.0f; + + switch (get_bits(gb, 2)) { + case 0: + c[0] = 1.0f; + c[2] = get_float_val(gb); + c[4] = 1.0f; + break; + case 1: + c[0] = c[4] = get_float_val(gb); + c[2] = get_float_val(gb); + break; + case 2: + c[0] = get_float_val(gb); + c[2] = get_float_val(gb); + c[4] = get_float_val(gb); + break; + case 3: + av_log_ask_for_sample(v->s.avctx, NULL); + c[0] = get_float_val(gb); + c[1] = get_float_val(gb); + c[2] = get_float_val(gb); + c[3] = get_float_val(gb); + c[4] = get_float_val(gb); + break; + } + c[5] = get_float_val(gb); + if (get_bits1(gb)) + c[6] = get_float_val(gb); + else + c[6] = 1.0f; +} + +static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb) +{ + int effect_type, effect_flag, effect_pcount1, effect_pcount2, i; + float effect_params1[14], effect_params2[10]; + + float coefs[2][7]; + vc1_sprite_parse_transform(v, gb, coefs[0]); + av_log(v->s.avctx, AV_LOG_DEBUG, "S1:"); + for (i = 0; i < 7; i++) + av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[0][i]); + av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); + + if (v->two_sprites) { + vc1_sprite_parse_transform(v, gb, coefs[1]); + av_log(v->s.avctx, AV_LOG_DEBUG, "S2:"); + for (i = 0; i < 7; i++) + av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[1][i]); + av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); + } + skip_bits(gb, 2); + if (effect_type = get_bits_long(gb, 30)){ + switch (effect_pcount1 = get_bits(gb, 4)) { + case 2: + effect_params1[0] = get_float_val(gb); + effect_params1[1] = get_float_val(gb); + break; + case 7: + vc1_sprite_parse_transform(v, gb, effect_params1); + break; + case 14: + vc1_sprite_parse_transform(v, gb, effect_params1); + vc1_sprite_parse_transform(v, gb, &effect_params1[7]); + break; + default: + av_log_ask_for_sample(v->s.avctx, NULL); + return; + } + if (effect_type != 13 || effect_params1[0] != coefs[0][6]) { + // effect 13 is simple alpha blending and matches the opacity above + av_log(v->s.avctx, AV_LOG_DEBUG, "Effect: %d; params: ", effect_type); + for (i = 0; i < effect_pcount1; i++) + av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params1[i]); + av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); + } + + effect_pcount2 = get_bits(gb, 16); + if (effect_pcount2 > 10) { + av_log(v->s.avctx, AV_LOG_ERROR, "Too many effect parameters\n"); + return; + } else if (effect_pcount2) { + i = 0; + av_log(v->s.avctx, AV_LOG_DEBUG, "Effect params 2: "); + while (i < effect_pcount2){ + effect_params2[i] = get_float_val(gb); + av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params2[i]); + i++; + } + av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); + } + } + if (effect_flag = get_bits1(gb)) + av_log(v->s.avctx, AV_LOG_DEBUG, "Effect flag set\n"); + + if (get_bits_count(gb) >= gb->size_in_bits + + (v->s.avctx->codec_id == CODEC_ID_WMV3 ? 64 : 0)) + av_log(v->s.avctx, AV_LOG_ERROR, "Buffer overrun\n"); + if (get_bits_count(gb) < gb->size_in_bits - 8) + av_log(v->s.avctx, AV_LOG_WARNING, "Buffer not fully read\n"); +} + /** Initialize a VC1/WMV3 decoder * @todo TODO: Handle VC-1 IDUs (Transport level?) * @todo TODO: Decypher remaining bits in extra_data @@ -3160,7 +3270,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) { av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); } - } else { // VC1/WVC1 + } else { // VC1/WVC1/WVP2 const uint8_t *start = avctx->extradata; uint8_t *end = avctx->extradata + avctx->extradata_size; const uint8_t *next; @@ -3204,6 +3314,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); return -1; } + v->res_sprite = (avctx->codec_tag == MKTAG('W','V','P','2')); } avctx->profile = v->profile; if (v->profile == PROFILE_ADVANCED) @@ -3359,6 +3470,14 @@ static int vc1_decode_frame(AVCodecContext *avctx, init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); + + if (v->res_sprite) { + v->new_sprite = !get_bits1(&s->gb); + v->two_sprites = get_bits1(&s->gb); + if (!v->new_sprite) + goto end; + } + // do parse frame header if(v->profile < PROFILE_ADVANCED) { if(vc1_parse_frame_header(v, &s->gb) == -1) { @@ -3370,8 +3489,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, } } - if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){ - goto err; + if (v->res_sprite && s->pict_type!=FF_I_TYPE) { + av_log(v->s.avctx, AV_LOG_WARNING, "Sprite decoder: expected I-frame\n"); } s->current_picture_ptr->repeat_pict = 0; @@ -3464,6 +3583,8 @@ assert(s->current_picture.pict_type == s->pict_type); } end: + if (v->res_sprite) + vc1_parse_sprites(v, &s->gb); av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); diff --git a/libavcodec/version.h b/libavcodec/version.h index b60e264d7f..e40d4e5531 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 117 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/avio.h b/libavformat/avio.h index b9dd6494f9..fa43340f9c 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -22,10 +22,7 @@ /** * @file - * unbuffered I/O operations - * - * @warning This file has to be considered an internal but installed - * header, so it should not be directly included in your projects. + * Buffered I/O operations */ #include <stdint.h> @@ -35,6 +32,63 @@ #include "libavformat/version.h" + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct { + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ +#if FF_API_OLD_AVIO + attribute_deprecated int is_streamed; +#endif + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; +} AVIOContext; + /* unbuffered I/O */ #if FF_API_OLD_AVIO @@ -59,12 +113,38 @@ typedef struct URLContext { int is_connected; } URLContext; +#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ + +/** + * @deprecated This struct is to be made private. Use the higher-level + * AVIOContext-based API instead. + */ +typedef struct URLProtocol { + const char *name; + int (*url_open)(URLContext *h, const char *url, int flags); + int (*url_read)(URLContext *h, unsigned char *buf, int size); + int (*url_write)(URLContext *h, const unsigned char *buf, int size); + int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); + int (*url_close)(URLContext *h); + struct URLProtocol *next; + int (*url_read_pause)(URLContext *h, int pause); + int64_t (*url_read_seek)(URLContext *h, int stream_index, + int64_t timestamp, int flags); + int (*url_get_file_handle)(URLContext *h); + int priv_data_size; + const AVClass *priv_data_class; + int flags; +} URLProtocol; + typedef struct URLPollEntry { URLContext *handle; int events; int revents; } URLPollEntry; +/* not implemented */ +attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); + /** * @defgroup open_modes URL open modes * The flags argument to url_open and cosins must be one of the following @@ -93,6 +173,7 @@ typedef struct URLPollEntry { #define URL_FLAG_NONBLOCK 4 typedef int URLInterruptCB(void); +extern URLInterruptCB *url_interrupt_cb; /** * @defgroup old_url_funcs Old url_* functions @@ -117,130 +198,24 @@ attribute_deprecated int av_url_read_pause(URLContext *h, int pause); attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, int64_t timestamp, int flags); attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); -#endif /** - * Return a non-zero value if the resource indicated by url - * exists, 0 otherwise. - */ -int url_exist(const char *url); - -/** - * The callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR_EXIT is returned - * in this case by the interrupted function. 'NULL' means no interrupt - * callback is given. - */ -void avio_set_interrupt_cb(int (*interrupt_cb)(void)); - -#if FF_API_OLD_AVIO -/* not implemented */ -attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); - - -#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ - -/** - * @deprecated This struct is to be made private. Use the higher-level - * AVIOContext-based API instead. - */ -typedef struct URLProtocol { - const char *name; - int (*url_open)(URLContext *h, const char *url, int flags); - int (*url_read)(URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, const unsigned char *buf, int size); - int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; - int (*url_read_pause)(URLContext *h, int pause); - int64_t (*url_read_seek)(URLContext *h, int stream_index, - int64_t timestamp, int flags); - int (*url_get_file_handle)(URLContext *h); - int priv_data_size; - const AVClass *priv_data_class; - int flags; -} URLProtocol; -#endif - -#if FF_API_REGISTER_PROTOCOL -extern URLProtocol *first_protocol; -#endif - -#if FF_API_OLD_AVIO -extern URLInterruptCB *url_interrupt_cb; -#endif - -/** - * If protocol is NULL, returns the first registered protocol, - * if protocol is non-NULL, returns the next registered protocol after protocol, - * or NULL if protocol is the last one. + * returns the next registered protocol after the given protocol (the first if + * NULL is given), or NULL if protocol is the last one. */ URLProtocol *av_protocol_next(URLProtocol *p); -#if FF_API_REGISTER_PROTOCOL -/** - * @deprecated Use av_register_protocol() instead. - */ -attribute_deprecated int register_protocol(URLProtocol *protocol); - -/** - * @deprecated Use av_register_protocol2() instead. - */ -attribute_deprecated int av_register_protocol(URLProtocol *protocol); -#endif - -#if FF_API_OLD_AVIO /** * Register the URLProtocol protocol. * * @param size the size of the URLProtocol struct referenced */ attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size); -#endif - -#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ - /** * @} */ -/** - * Bytestream IO Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVIOContext) must not be used outside libav*. - */ -typedef struct { - unsigned char *buffer; - int buffer_size; - unsigned char *buf_ptr, *buf_end; - void *opaque; - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - int64_t (*seek)(void *opaque, int64_t offset, int whence); - int64_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ -#if FF_API_OLD_AVIO - attribute_deprecated int is_streamed; -#endif - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; ///< contains the error code or 0 if no error happened - int (*read_pause)(void *opaque, int pause); - int64_t (*read_seek)(void *opaque, int stream_index, - int64_t timestamp, int flags); - /** - * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. - */ - int seekable; -} AVIOContext; -#if FF_API_OLD_AVIO typedef attribute_deprecated AVIOContext ByteIOContext; attribute_deprecated int init_put_byte(AVIOContext *s, @@ -334,6 +309,62 @@ attribute_deprecated void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); attribute_deprecated unsigned long get_checksum(AVIOContext *s); +attribute_deprecated void put_strz(AVIOContext *s, const char *buf); +/** @note unlike fgets, the EOL character is not returned and a whole + line is parsed. return NULL if first char read was EOF */ +attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); +/** + * @deprecated use avio_get_str instead + */ +attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); +/** + * @deprecated Use AVIOContext.seekable field directly. + */ +attribute_deprecated static inline int url_is_streamed(AVIOContext *s) +{ + return !s->seekable; +} +attribute_deprecated URLContext *url_fileno(AVIOContext *s); + +/** + * @deprecated use AVIOContext.max_packet_size directly. + */ +attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); + +attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); + +/** return the written or read size */ +attribute_deprecated int url_close_buf(AVIOContext *s); +#endif // FF_API_OLD_AVIO + +/** + * Return a non-zero value if the resource indicated by url + * exists, 0 otherwise. + */ +int url_exist(const char *url); + +/** + * The callback is called in blocking functions to test regulary if + * asynchronous interruption is needed. AVERROR_EXIT is returned + * in this case by the interrupted function. 'NULL' means no interrupt + * callback is given. + */ +void avio_set_interrupt_cb(int (*interrupt_cb)(void)); + +#if FF_API_REGISTER_PROTOCOL +extern URLProtocol *first_protocol; +#endif + +#if FF_API_REGISTER_PROTOCOL +/** + * @deprecated Use av_register_protocol() instead. + */ +attribute_deprecated int register_protocol(URLProtocol *protocol); + +/** + * @deprecated Use av_register_protocol2() instead. + */ +attribute_deprecated int av_register_protocol(URLProtocol *protocol); #endif /** @@ -372,10 +403,6 @@ void avio_wb24(AVIOContext *s, unsigned int val); void avio_wl16(AVIOContext *s, unsigned int val); void avio_wb16(AVIOContext *s, unsigned int val); -#if FF_API_OLD_AVIO -attribute_deprecated void put_strz(AVIOContext *s, const char *buf); -#endif - /** * Write a NULL-terminated string. * @return number of bytes written. @@ -443,12 +470,6 @@ int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ int avio_printf(AVIOContext *s, const char *fmt, ...); #endif -#if FF_API_OLD_AVIO -/** @note unlike fgets, the EOL character is not returned and a whole - line is parsed. return NULL if first char read was EOF */ -attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); -#endif - void avio_flush(AVIOContext *s); @@ -458,13 +479,25 @@ void avio_flush(AVIOContext *s); */ int avio_read(AVIOContext *s, unsigned char *buf, int size); -/** @note return 0 if EOF, so you cannot use it if EOF handling is - necessary */ +/** + * @defgroup avio_read Functions for reading from AVIOContext. + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ int avio_r8 (AVIOContext *s); unsigned int avio_rl16(AVIOContext *s); unsigned int avio_rl24(AVIOContext *s); unsigned int avio_rl32(AVIOContext *s); uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ /** * Read a string from pb into buf. The reading will terminate when either @@ -489,26 +522,6 @@ int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); -#if FF_API_OLD_AVIO -/** - * @deprecated use avio_get_str instead - */ -attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); -#endif -unsigned int avio_rb16(AVIOContext *s); -unsigned int avio_rb24(AVIOContext *s); -unsigned int avio_rb32(AVIOContext *s); -uint64_t avio_rb64(AVIOContext *s); - -#if FF_API_OLD_AVIO -/** - * @deprecated Use AVIOContext.seekable field directly. - */ -attribute_deprecated static inline int url_is_streamed(AVIOContext *s) -{ - return !s->seekable; -} -#endif #if FF_API_URL_RESETBUF /** Reset the buffer for reading or writing. @@ -560,21 +573,13 @@ int url_resetbuf(AVIOContext *s, int flags); */ int avio_open(AVIOContext **s, const char *url, int flags); -int avio_close(AVIOContext *s); - -#if FF_API_OLD_AVIO -attribute_deprecated URLContext *url_fileno(AVIOContext *s); - /** - * @deprecated use AVIOContext.max_packet_size directly. + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * @return 0 on success, an AVERROR < 0 on error. */ -attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); - -attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); - -/** return the written or read size */ -attribute_deprecated int url_close_buf(AVIOContext *s); -#endif +int avio_close(AVIOContext *s); /** * Open a write only memory stream. diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 148505aa10..e32f8029e0 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -164,6 +164,7 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial) os->bufsize = DECODER_BUFFER_SIZE; os->buf = av_malloc(os->bufsize); os->header = -1; + os->page_begin = 1; st = av_new_stream (s, idx); if (!st) @@ -241,12 +242,27 @@ ogg_read_page (AVFormatContext * s, int *str) idx = ogg_find_stream (ogg, serial); if (idx < 0){ + for (i = 0; i < ogg->nstreams; i++) { + if (!ogg->streams[i].page_begin) { + int n; + + for (n = 0; n < ogg->nstreams; n++) { + av_free(ogg->streams[n].buf); + av_free(ogg->streams[n].private); + } + ogg->curidx = -1; + ogg->nstreams = 0; + break; + } + } idx = ogg_new_stream (s, serial); if (idx < 0) return -1; } os = ogg->streams + idx; + if (!(flags & OGG_FLAG_BOS)) + os->page_begin = 0; os->page_pos = avio_tell(bc) - 27; if(os->psize > 0) diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h index 7d66cd5638..785cd812f9 100644 --- a/libavformat/oggdec.h +++ b/libavformat/oggdec.h @@ -75,6 +75,7 @@ struct ogg_stream { int incomplete; ///< whether we're expecting a continuation in the next page int page_end; ///< current packet is the last one completed in the page int keyframe_seek; + int page_begin; ///< set to 1 if the stream only received a begin-of-stream packet, otherwise 0 void *private; }; diff --git a/libavformat/riff.c b/libavformat/riff.c index 95ae22a1be..a818fe5c94 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -232,6 +232,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', 'P') }, { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') }, { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') }, + { CODEC_ID_VC1, MKTAG('W', 'V', 'P', '2') }, { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') }, { CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') }, { CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') }, diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c index 9dc9471b3e..8db27391c0 100644 --- a/libavutil/ppc/cpu.c +++ b/libavutil/ppc/cpu.c @@ -20,6 +20,7 @@ #undef _POSIX_C_SOURCE #include <sys/sysctl.h> #elif defined(__OpenBSD__) +#undef _POSIX_C_SOURCE #include <sys/param.h> #include <sys/sysctl.h> #include <machine/cpu.h> |