* 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>
| ... | ... |
@@ -12,6 +12,9 @@ libavutil: 2009-03-08 |
| 12 | 12 |
|
| 13 | 13 |
API changes, most recent first: |
| 14 | 14 |
|
| 15 |
+2011-04-10 - lavu 50.40.0 - pixfmt.h |
|
| 16 |
+ Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats |
|
| 17 |
+ |
|
| 15 | 18 |
2011-04-08 - lavf 52.106.0 - avformat.h |
| 16 | 19 |
Minor avformat.h cleanup: |
| 17 | 20 |
a9bf9d8 deprecate av_guess_image2_codec |
| ... | ... |
@@ -605,9 +605,6 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) |
| 605 | 605 |
{
|
| 606 | 606 |
int pqindex, lowquant, status; |
| 607 | 607 |
|
| 608 |
- if(v->res_sprite) {
|
|
| 609 |
- skip_bits(gb, 2); //not yet deciphered |
|
| 610 |
- } |
|
| 611 | 608 |
if(v->finterpflag) v->interpfrm = get_bits1(gb); |
| 612 | 609 |
skip_bits(gb, 2); //framecnt unused |
| 613 | 610 |
v->rangeredfrm = 0; |
| ... | ... |
@@ -3097,6 +3097,116 @@ static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) |
| 3097 | 3097 |
} |
| 3098 | 3098 |
} |
| 3099 | 3099 |
|
| 3100 |
+static inline float get_float_val(GetBitContext* gb) |
|
| 3101 |
+{
|
|
| 3102 |
+ return (float)get_bits_long(gb, 30) / (1<<15) - (1<<14); |
|
| 3103 |
+} |
|
| 3104 |
+ |
|
| 3105 |
+static void vc1_sprite_parse_transform(VC1Context *v, GetBitContext* gb, float c[7]) |
|
| 3106 |
+{
|
|
| 3107 |
+ c[1] = c[3] = 0.0f; |
|
| 3108 |
+ |
|
| 3109 |
+ switch (get_bits(gb, 2)) {
|
|
| 3110 |
+ case 0: |
|
| 3111 |
+ c[0] = 1.0f; |
|
| 3112 |
+ c[2] = get_float_val(gb); |
|
| 3113 |
+ c[4] = 1.0f; |
|
| 3114 |
+ break; |
|
| 3115 |
+ case 1: |
|
| 3116 |
+ c[0] = c[4] = get_float_val(gb); |
|
| 3117 |
+ c[2] = get_float_val(gb); |
|
| 3118 |
+ break; |
|
| 3119 |
+ case 2: |
|
| 3120 |
+ c[0] = get_float_val(gb); |
|
| 3121 |
+ c[2] = get_float_val(gb); |
|
| 3122 |
+ c[4] = get_float_val(gb); |
|
| 3123 |
+ break; |
|
| 3124 |
+ case 3: |
|
| 3125 |
+ av_log_ask_for_sample(v->s.avctx, NULL); |
|
| 3126 |
+ c[0] = get_float_val(gb); |
|
| 3127 |
+ c[1] = get_float_val(gb); |
|
| 3128 |
+ c[2] = get_float_val(gb); |
|
| 3129 |
+ c[3] = get_float_val(gb); |
|
| 3130 |
+ c[4] = get_float_val(gb); |
|
| 3131 |
+ break; |
|
| 3132 |
+ } |
|
| 3133 |
+ c[5] = get_float_val(gb); |
|
| 3134 |
+ if (get_bits1(gb)) |
|
| 3135 |
+ c[6] = get_float_val(gb); |
|
| 3136 |
+ else |
|
| 3137 |
+ c[6] = 1.0f; |
|
| 3138 |
+} |
|
| 3139 |
+ |
|
| 3140 |
+static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb) |
|
| 3141 |
+{
|
|
| 3142 |
+ int effect_type, effect_flag, effect_pcount1, effect_pcount2, i; |
|
| 3143 |
+ float effect_params1[14], effect_params2[10]; |
|
| 3144 |
+ |
|
| 3145 |
+ float coefs[2][7]; |
|
| 3146 |
+ vc1_sprite_parse_transform(v, gb, coefs[0]); |
|
| 3147 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "S1:"); |
|
| 3148 |
+ for (i = 0; i < 7; i++) |
|
| 3149 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[0][i]); |
|
| 3150 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); |
|
| 3151 |
+ |
|
| 3152 |
+ if (v->two_sprites) {
|
|
| 3153 |
+ vc1_sprite_parse_transform(v, gb, coefs[1]); |
|
| 3154 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "S2:"); |
|
| 3155 |
+ for (i = 0; i < 7; i++) |
|
| 3156 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[1][i]); |
|
| 3157 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); |
|
| 3158 |
+ } |
|
| 3159 |
+ skip_bits(gb, 2); |
|
| 3160 |
+ if (effect_type = get_bits_long(gb, 30)){
|
|
| 3161 |
+ switch (effect_pcount1 = get_bits(gb, 4)) {
|
|
| 3162 |
+ case 2: |
|
| 3163 |
+ effect_params1[0] = get_float_val(gb); |
|
| 3164 |
+ effect_params1[1] = get_float_val(gb); |
|
| 3165 |
+ break; |
|
| 3166 |
+ case 7: |
|
| 3167 |
+ vc1_sprite_parse_transform(v, gb, effect_params1); |
|
| 3168 |
+ break; |
|
| 3169 |
+ case 14: |
|
| 3170 |
+ vc1_sprite_parse_transform(v, gb, effect_params1); |
|
| 3171 |
+ vc1_sprite_parse_transform(v, gb, &effect_params1[7]); |
|
| 3172 |
+ break; |
|
| 3173 |
+ default: |
|
| 3174 |
+ av_log_ask_for_sample(v->s.avctx, NULL); |
|
| 3175 |
+ return; |
|
| 3176 |
+ } |
|
| 3177 |
+ if (effect_type != 13 || effect_params1[0] != coefs[0][6]) {
|
|
| 3178 |
+ // effect 13 is simple alpha blending and matches the opacity above |
|
| 3179 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "Effect: %d; params: ", effect_type); |
|
| 3180 |
+ for (i = 0; i < effect_pcount1; i++) |
|
| 3181 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params1[i]); |
|
| 3182 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); |
|
| 3183 |
+ } |
|
| 3184 |
+ |
|
| 3185 |
+ effect_pcount2 = get_bits(gb, 16); |
|
| 3186 |
+ if (effect_pcount2 > 10) {
|
|
| 3187 |
+ av_log(v->s.avctx, AV_LOG_ERROR, "Too many effect parameters\n"); |
|
| 3188 |
+ return; |
|
| 3189 |
+ } else if (effect_pcount2) {
|
|
| 3190 |
+ i = 0; |
|
| 3191 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "Effect params 2: "); |
|
| 3192 |
+ while (i < effect_pcount2){
|
|
| 3193 |
+ effect_params2[i] = get_float_val(gb); |
|
| 3194 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params2[i]); |
|
| 3195 |
+ i++; |
|
| 3196 |
+ } |
|
| 3197 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "\n"); |
|
| 3198 |
+ } |
|
| 3199 |
+ } |
|
| 3200 |
+ if (effect_flag = get_bits1(gb)) |
|
| 3201 |
+ av_log(v->s.avctx, AV_LOG_DEBUG, "Effect flag set\n"); |
|
| 3202 |
+ |
|
| 3203 |
+ if (get_bits_count(gb) >= gb->size_in_bits + |
|
| 3204 |
+ (v->s.avctx->codec_id == CODEC_ID_WMV3 ? 64 : 0)) |
|
| 3205 |
+ av_log(v->s.avctx, AV_LOG_ERROR, "Buffer overrun\n"); |
|
| 3206 |
+ if (get_bits_count(gb) < gb->size_in_bits - 8) |
|
| 3207 |
+ av_log(v->s.avctx, AV_LOG_WARNING, "Buffer not fully read\n"); |
|
| 3208 |
+} |
|
| 3209 |
+ |
|
| 3100 | 3210 |
/** Initialize a VC1/WMV3 decoder |
| 3101 | 3211 |
* @todo TODO: Handle VC-1 IDUs (Transport level?) |
| 3102 | 3212 |
* @todo TODO: Decypher remaining bits in extra_data |
| ... | ... |
@@ -3160,7 +3270,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) |
| 3160 | 3160 |
{
|
| 3161 | 3161 |
av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); |
| 3162 | 3162 |
} |
| 3163 |
- } else { // VC1/WVC1
|
|
| 3163 |
+ } else { // VC1/WVC1/WVP2
|
|
| 3164 | 3164 |
const uint8_t *start = avctx->extradata; |
| 3165 | 3165 |
uint8_t *end = avctx->extradata + avctx->extradata_size; |
| 3166 | 3166 |
const uint8_t *next; |
| ... | ... |
@@ -3204,6 +3314,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) |
| 3204 | 3204 |
av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); |
| 3205 | 3205 |
return -1; |
| 3206 | 3206 |
} |
| 3207 |
+ v->res_sprite = (avctx->codec_tag == MKTAG('W','V','P','2'));
|
|
| 3207 | 3208 |
} |
| 3208 | 3209 |
avctx->profile = v->profile; |
| 3209 | 3210 |
if (v->profile == PROFILE_ADVANCED) |
| ... | ... |
@@ -3359,6 +3470,14 @@ static int vc1_decode_frame(AVCodecContext *avctx, |
| 3359 | 3359 |
init_get_bits(&s->gb, buf2, buf_size2*8); |
| 3360 | 3360 |
} else |
| 3361 | 3361 |
init_get_bits(&s->gb, buf, buf_size*8); |
| 3362 |
+ |
|
| 3363 |
+ if (v->res_sprite) {
|
|
| 3364 |
+ v->new_sprite = !get_bits1(&s->gb); |
|
| 3365 |
+ v->two_sprites = get_bits1(&s->gb); |
|
| 3366 |
+ if (!v->new_sprite) |
|
| 3367 |
+ goto end; |
|
| 3368 |
+ } |
|
| 3369 |
+ |
|
| 3362 | 3370 |
// do parse frame header |
| 3363 | 3371 |
if(v->profile < PROFILE_ADVANCED) {
|
| 3364 | 3372 |
if(vc1_parse_frame_header(v, &s->gb) == -1) {
|
| ... | ... |
@@ -3370,8 +3489,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, |
| 3370 | 3370 |
} |
| 3371 | 3371 |
} |
| 3372 | 3372 |
|
| 3373 |
- if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){
|
|
| 3374 |
- goto err; |
|
| 3373 |
+ if (v->res_sprite && s->pict_type!=FF_I_TYPE) {
|
|
| 3374 |
+ av_log(v->s.avctx, AV_LOG_WARNING, "Sprite decoder: expected I-frame\n"); |
|
| 3375 | 3375 |
} |
| 3376 | 3376 |
|
| 3377 | 3377 |
s->current_picture_ptr->repeat_pict = 0; |
| ... | ... |
@@ -3464,6 +3583,8 @@ assert(s->current_picture.pict_type == s->pict_type); |
| 3464 | 3464 |
} |
| 3465 | 3465 |
|
| 3466 | 3466 |
end: |
| 3467 |
+ if (v->res_sprite) |
|
| 3468 |
+ vc1_parse_sprites(v, &s->gb); |
|
| 3467 | 3469 |
av_free(buf2); |
| 3468 | 3470 |
for (i = 0; i < n_slices; i++) |
| 3469 | 3471 |
av_free(slices[i].buf); |
| ... | ... |
@@ -22,7 +22,7 @@ |
| 22 | 22 |
|
| 23 | 23 |
#define LIBAVCODEC_VERSION_MAJOR 52 |
| 24 | 24 |
#define LIBAVCODEC_VERSION_MINOR 117 |
| 25 |
-#define LIBAVCODEC_VERSION_MICRO 0 |
|
| 25 |
+#define LIBAVCODEC_VERSION_MICRO 1 |
|
| 26 | 26 |
|
| 27 | 27 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 28 | 28 |
LIBAVCODEC_VERSION_MINOR, \ |
| ... | ... |
@@ -22,10 +22,7 @@ |
| 22 | 22 |
|
| 23 | 23 |
/** |
| 24 | 24 |
* @file |
| 25 |
- * unbuffered I/O operations |
|
| 26 |
- * |
|
| 27 |
- * @warning This file has to be considered an internal but installed |
|
| 28 |
- * header, so it should not be directly included in your projects. |
|
| 25 |
+ * Buffered I/O operations |
|
| 29 | 26 |
*/ |
| 30 | 27 |
|
| 31 | 28 |
#include <stdint.h> |
| ... | ... |
@@ -35,6 +32,63 @@ |
| 35 | 35 |
|
| 36 | 36 |
#include "libavformat/version.h" |
| 37 | 37 |
|
| 38 |
+ |
|
| 39 |
+#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ |
|
| 40 |
+ |
|
| 41 |
+/** |
|
| 42 |
+ * Bytestream IO Context. |
|
| 43 |
+ * New fields can be added to the end with minor version bumps. |
|
| 44 |
+ * Removal, reordering and changes to existing fields require a major |
|
| 45 |
+ * version bump. |
|
| 46 |
+ * sizeof(AVIOContext) must not be used outside libav*. |
|
| 47 |
+ * |
|
| 48 |
+ * @note None of the function pointers in AVIOContext should be called |
|
| 49 |
+ * directly, they should only be set by the client application |
|
| 50 |
+ * when implementing custom I/O. Normally these are set to the |
|
| 51 |
+ * function pointers specified in avio_alloc_context() |
|
| 52 |
+ */ |
|
| 53 |
+typedef struct {
|
|
| 54 |
+ unsigned char *buffer; /**< Start of the buffer. */ |
|
| 55 |
+ int buffer_size; /**< Maximum buffer size */ |
|
| 56 |
+ unsigned char *buf_ptr; /**< Current position in the buffer */ |
|
| 57 |
+ unsigned char *buf_end; /**< End of the data, may be less than |
|
| 58 |
+ buffer+buffer_size if the read function returned |
|
| 59 |
+ less data than requested, e.g. for streams where |
|
| 60 |
+ no more data has been received yet. */ |
|
| 61 |
+ void *opaque; /**< A private pointer, passed to the read/write/seek/... |
|
| 62 |
+ functions. */ |
|
| 63 |
+ int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); |
|
| 64 |
+ int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); |
|
| 65 |
+ int64_t (*seek)(void *opaque, int64_t offset, int whence); |
|
| 66 |
+ int64_t pos; /**< position in the file of the current buffer */ |
|
| 67 |
+ int must_flush; /**< true if the next seek should flush */ |
|
| 68 |
+ int eof_reached; /**< true if eof reached */ |
|
| 69 |
+ int write_flag; /**< true if open for writing */ |
|
| 70 |
+#if FF_API_OLD_AVIO |
|
| 71 |
+ attribute_deprecated int is_streamed; |
|
| 72 |
+#endif |
|
| 73 |
+ int max_packet_size; |
|
| 74 |
+ unsigned long checksum; |
|
| 75 |
+ unsigned char *checksum_ptr; |
|
| 76 |
+ unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); |
|
| 77 |
+ int error; /**< contains the error code or 0 if no error happened */ |
|
| 78 |
+ /** |
|
| 79 |
+ * Pause or resume playback for network streaming protocols - e.g. MMS. |
|
| 80 |
+ */ |
|
| 81 |
+ int (*read_pause)(void *opaque, int pause); |
|
| 82 |
+ /** |
|
| 83 |
+ * Seek to a given timestamp in stream with the specified stream_index. |
|
| 84 |
+ * Needed for some network streaming protocols which don't support seeking |
|
| 85 |
+ * to byte position. |
|
| 86 |
+ */ |
|
| 87 |
+ int64_t (*read_seek)(void *opaque, int stream_index, |
|
| 88 |
+ int64_t timestamp, int flags); |
|
| 89 |
+ /** |
|
| 90 |
+ * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. |
|
| 91 |
+ */ |
|
| 92 |
+ int seekable; |
|
| 93 |
+} AVIOContext; |
|
| 94 |
+ |
|
| 38 | 95 |
/* unbuffered I/O */ |
| 39 | 96 |
|
| 40 | 97 |
#if FF_API_OLD_AVIO |
| ... | ... |
@@ -59,12 +113,38 @@ typedef struct URLContext {
|
| 59 | 59 |
int is_connected; |
| 60 | 60 |
} URLContext; |
| 61 | 61 |
|
| 62 |
+#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
|
| 63 |
+ |
|
| 64 |
+/** |
|
| 65 |
+ * @deprecated This struct is to be made private. Use the higher-level |
|
| 66 |
+ * AVIOContext-based API instead. |
|
| 67 |
+ */ |
|
| 68 |
+typedef struct URLProtocol {
|
|
| 69 |
+ const char *name; |
|
| 70 |
+ int (*url_open)(URLContext *h, const char *url, int flags); |
|
| 71 |
+ int (*url_read)(URLContext *h, unsigned char *buf, int size); |
|
| 72 |
+ int (*url_write)(URLContext *h, const unsigned char *buf, int size); |
|
| 73 |
+ int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); |
|
| 74 |
+ int (*url_close)(URLContext *h); |
|
| 75 |
+ struct URLProtocol *next; |
|
| 76 |
+ int (*url_read_pause)(URLContext *h, int pause); |
|
| 77 |
+ int64_t (*url_read_seek)(URLContext *h, int stream_index, |
|
| 78 |
+ int64_t timestamp, int flags); |
|
| 79 |
+ int (*url_get_file_handle)(URLContext *h); |
|
| 80 |
+ int priv_data_size; |
|
| 81 |
+ const AVClass *priv_data_class; |
|
| 82 |
+ int flags; |
|
| 83 |
+} URLProtocol; |
|
| 84 |
+ |
|
| 62 | 85 |
typedef struct URLPollEntry {
|
| 63 | 86 |
URLContext *handle; |
| 64 | 87 |
int events; |
| 65 | 88 |
int revents; |
| 66 | 89 |
} URLPollEntry; |
| 67 | 90 |
|
| 91 |
+/* not implemented */ |
|
| 92 |
+attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); |
|
| 93 |
+ |
|
| 68 | 94 |
/** |
| 69 | 95 |
* @defgroup open_modes URL open modes |
| 70 | 96 |
* The flags argument to url_open and cosins must be one of the following |
| ... | ... |
@@ -93,6 +173,7 @@ typedef struct URLPollEntry {
|
| 93 | 93 |
#define URL_FLAG_NONBLOCK 4 |
| 94 | 94 |
|
| 95 | 95 |
typedef int URLInterruptCB(void); |
| 96 |
+extern URLInterruptCB *url_interrupt_cb; |
|
| 96 | 97 |
|
| 97 | 98 |
/** |
| 98 | 99 |
* @defgroup old_url_funcs Old url_* functions |
| ... | ... |
@@ -117,130 +198,24 @@ attribute_deprecated int av_url_read_pause(URLContext *h, int pause); |
| 117 | 117 |
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, |
| 118 | 118 |
int64_t timestamp, int flags); |
| 119 | 119 |
attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); |
| 120 |
-#endif |
|
| 121 | 120 |
|
| 122 | 121 |
/** |
| 123 |
- * Return a non-zero value if the resource indicated by url |
|
| 124 |
- * exists, 0 otherwise. |
|
| 125 |
- */ |
|
| 126 |
-int url_exist(const char *url); |
|
| 127 |
- |
|
| 128 |
-/** |
|
| 129 |
- * The callback is called in blocking functions to test regulary if |
|
| 130 |
- * asynchronous interruption is needed. AVERROR_EXIT is returned |
|
| 131 |
- * in this case by the interrupted function. 'NULL' means no interrupt |
|
| 132 |
- * callback is given. |
|
| 133 |
- */ |
|
| 134 |
-void avio_set_interrupt_cb(int (*interrupt_cb)(void)); |
|
| 135 |
- |
|
| 136 |
-#if FF_API_OLD_AVIO |
|
| 137 |
-/* not implemented */ |
|
| 138 |
-attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); |
|
| 139 |
- |
|
| 140 |
- |
|
| 141 |
-#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
|
| 142 |
- |
|
| 143 |
-/** |
|
| 144 |
- * @deprecated This struct is to be made private. Use the higher-level |
|
| 145 |
- * AVIOContext-based API instead. |
|
| 146 |
- */ |
|
| 147 |
-typedef struct URLProtocol {
|
|
| 148 |
- const char *name; |
|
| 149 |
- int (*url_open)(URLContext *h, const char *url, int flags); |
|
| 150 |
- int (*url_read)(URLContext *h, unsigned char *buf, int size); |
|
| 151 |
- int (*url_write)(URLContext *h, const unsigned char *buf, int size); |
|
| 152 |
- int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); |
|
| 153 |
- int (*url_close)(URLContext *h); |
|
| 154 |
- struct URLProtocol *next; |
|
| 155 |
- int (*url_read_pause)(URLContext *h, int pause); |
|
| 156 |
- int64_t (*url_read_seek)(URLContext *h, int stream_index, |
|
| 157 |
- int64_t timestamp, int flags); |
|
| 158 |
- int (*url_get_file_handle)(URLContext *h); |
|
| 159 |
- int priv_data_size; |
|
| 160 |
- const AVClass *priv_data_class; |
|
| 161 |
- int flags; |
|
| 162 |
-} URLProtocol; |
|
| 163 |
-#endif |
|
| 164 |
- |
|
| 165 |
-#if FF_API_REGISTER_PROTOCOL |
|
| 166 |
-extern URLProtocol *first_protocol; |
|
| 167 |
-#endif |
|
| 168 |
- |
|
| 169 |
-#if FF_API_OLD_AVIO |
|
| 170 |
-extern URLInterruptCB *url_interrupt_cb; |
|
| 171 |
-#endif |
|
| 172 |
- |
|
| 173 |
-/** |
|
| 174 |
- * If protocol is NULL, returns the first registered protocol, |
|
| 175 |
- * if protocol is non-NULL, returns the next registered protocol after protocol, |
|
| 176 |
- * or NULL if protocol is the last one. |
|
| 122 |
+ * returns the next registered protocol after the given protocol (the first if |
|
| 123 |
+ * NULL is given), or NULL if protocol is the last one. |
|
| 177 | 124 |
*/ |
| 178 | 125 |
URLProtocol *av_protocol_next(URLProtocol *p); |
| 179 | 126 |
|
| 180 |
-#if FF_API_REGISTER_PROTOCOL |
|
| 181 |
-/** |
|
| 182 |
- * @deprecated Use av_register_protocol() instead. |
|
| 183 |
- */ |
|
| 184 |
-attribute_deprecated int register_protocol(URLProtocol *protocol); |
|
| 185 |
- |
|
| 186 |
-/** |
|
| 187 |
- * @deprecated Use av_register_protocol2() instead. |
|
| 188 |
- */ |
|
| 189 |
-attribute_deprecated int av_register_protocol(URLProtocol *protocol); |
|
| 190 |
-#endif |
|
| 191 |
- |
|
| 192 |
-#if FF_API_OLD_AVIO |
|
| 193 | 127 |
/** |
| 194 | 128 |
* Register the URLProtocol protocol. |
| 195 | 129 |
* |
| 196 | 130 |
* @param size the size of the URLProtocol struct referenced |
| 197 | 131 |
*/ |
| 198 | 132 |
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size); |
| 199 |
-#endif |
|
| 200 |
- |
|
| 201 |
-#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ |
|
| 202 |
- |
|
| 203 | 133 |
/** |
| 204 | 134 |
* @} |
| 205 | 135 |
*/ |
| 206 | 136 |
|
| 207 |
-/** |
|
| 208 |
- * Bytestream IO Context. |
|
| 209 |
- * New fields can be added to the end with minor version bumps. |
|
| 210 |
- * Removal, reordering and changes to existing fields require a major |
|
| 211 |
- * version bump. |
|
| 212 |
- * sizeof(AVIOContext) must not be used outside libav*. |
|
| 213 |
- */ |
|
| 214 |
-typedef struct {
|
|
| 215 |
- unsigned char *buffer; |
|
| 216 |
- int buffer_size; |
|
| 217 |
- unsigned char *buf_ptr, *buf_end; |
|
| 218 |
- void *opaque; |
|
| 219 |
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); |
|
| 220 |
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); |
|
| 221 |
- int64_t (*seek)(void *opaque, int64_t offset, int whence); |
|
| 222 |
- int64_t pos; /**< position in the file of the current buffer */ |
|
| 223 |
- int must_flush; /**< true if the next seek should flush */ |
|
| 224 |
- int eof_reached; /**< true if eof reached */ |
|
| 225 |
- int write_flag; /**< true if open for writing */ |
|
| 226 |
-#if FF_API_OLD_AVIO |
|
| 227 |
- attribute_deprecated int is_streamed; |
|
| 228 |
-#endif |
|
| 229 |
- int max_packet_size; |
|
| 230 |
- unsigned long checksum; |
|
| 231 |
- unsigned char *checksum_ptr; |
|
| 232 |
- unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); |
|
| 233 |
- int error; ///< contains the error code or 0 if no error happened |
|
| 234 |
- int (*read_pause)(void *opaque, int pause); |
|
| 235 |
- int64_t (*read_seek)(void *opaque, int stream_index, |
|
| 236 |
- int64_t timestamp, int flags); |
|
| 237 |
- /** |
|
| 238 |
- * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. |
|
| 239 |
- */ |
|
| 240 |
- int seekable; |
|
| 241 |
-} AVIOContext; |
|
| 242 | 137 |
|
| 243 |
-#if FF_API_OLD_AVIO |
|
| 244 | 138 |
typedef attribute_deprecated AVIOContext ByteIOContext; |
| 245 | 139 |
|
| 246 | 140 |
attribute_deprecated int init_put_byte(AVIOContext *s, |
| ... | ... |
@@ -334,6 +309,62 @@ attribute_deprecated void init_checksum(AVIOContext *s, |
| 334 | 334 |
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), |
| 335 | 335 |
unsigned long checksum); |
| 336 | 336 |
attribute_deprecated unsigned long get_checksum(AVIOContext *s); |
| 337 |
+attribute_deprecated void put_strz(AVIOContext *s, const char *buf); |
|
| 338 |
+/** @note unlike fgets, the EOL character is not returned and a whole |
|
| 339 |
+ line is parsed. return NULL if first char read was EOF */ |
|
| 340 |
+attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); |
|
| 341 |
+/** |
|
| 342 |
+ * @deprecated use avio_get_str instead |
|
| 343 |
+ */ |
|
| 344 |
+attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); |
|
| 345 |
+/** |
|
| 346 |
+ * @deprecated Use AVIOContext.seekable field directly. |
|
| 347 |
+ */ |
|
| 348 |
+attribute_deprecated static inline int url_is_streamed(AVIOContext *s) |
|
| 349 |
+{
|
|
| 350 |
+ return !s->seekable; |
|
| 351 |
+} |
|
| 352 |
+attribute_deprecated URLContext *url_fileno(AVIOContext *s); |
|
| 353 |
+ |
|
| 354 |
+/** |
|
| 355 |
+ * @deprecated use AVIOContext.max_packet_size directly. |
|
| 356 |
+ */ |
|
| 357 |
+attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); |
|
| 358 |
+ |
|
| 359 |
+attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); |
|
| 360 |
+ |
|
| 361 |
+/** return the written or read size */ |
|
| 362 |
+attribute_deprecated int url_close_buf(AVIOContext *s); |
|
| 363 |
+#endif // FF_API_OLD_AVIO |
|
| 364 |
+ |
|
| 365 |
+/** |
|
| 366 |
+ * Return a non-zero value if the resource indicated by url |
|
| 367 |
+ * exists, 0 otherwise. |
|
| 368 |
+ */ |
|
| 369 |
+int url_exist(const char *url); |
|
| 370 |
+ |
|
| 371 |
+/** |
|
| 372 |
+ * The callback is called in blocking functions to test regulary if |
|
| 373 |
+ * asynchronous interruption is needed. AVERROR_EXIT is returned |
|
| 374 |
+ * in this case by the interrupted function. 'NULL' means no interrupt |
|
| 375 |
+ * callback is given. |
|
| 376 |
+ */ |
|
| 377 |
+void avio_set_interrupt_cb(int (*interrupt_cb)(void)); |
|
| 378 |
+ |
|
| 379 |
+#if FF_API_REGISTER_PROTOCOL |
|
| 380 |
+extern URLProtocol *first_protocol; |
|
| 381 |
+#endif |
|
| 382 |
+ |
|
| 383 |
+#if FF_API_REGISTER_PROTOCOL |
|
| 384 |
+/** |
|
| 385 |
+ * @deprecated Use av_register_protocol() instead. |
|
| 386 |
+ */ |
|
| 387 |
+attribute_deprecated int register_protocol(URLProtocol *protocol); |
|
| 388 |
+ |
|
| 389 |
+/** |
|
| 390 |
+ * @deprecated Use av_register_protocol2() instead. |
|
| 391 |
+ */ |
|
| 392 |
+attribute_deprecated int av_register_protocol(URLProtocol *protocol); |
|
| 337 | 393 |
#endif |
| 338 | 394 |
|
| 339 | 395 |
/** |
| ... | ... |
@@ -372,10 +403,6 @@ void avio_wb24(AVIOContext *s, unsigned int val); |
| 372 | 372 |
void avio_wl16(AVIOContext *s, unsigned int val); |
| 373 | 373 |
void avio_wb16(AVIOContext *s, unsigned int val); |
| 374 | 374 |
|
| 375 |
-#if FF_API_OLD_AVIO |
|
| 376 |
-attribute_deprecated void put_strz(AVIOContext *s, const char *buf); |
|
| 377 |
-#endif |
|
| 378 |
- |
|
| 379 | 375 |
/** |
| 380 | 376 |
* Write a NULL-terminated string. |
| 381 | 377 |
* @return number of bytes written. |
| ... | ... |
@@ -443,12 +470,6 @@ int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ |
| 443 | 443 |
int avio_printf(AVIOContext *s, const char *fmt, ...); |
| 444 | 444 |
#endif |
| 445 | 445 |
|
| 446 |
-#if FF_API_OLD_AVIO |
|
| 447 |
-/** @note unlike fgets, the EOL character is not returned and a whole |
|
| 448 |
- line is parsed. return NULL if first char read was EOF */ |
|
| 449 |
-attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); |
|
| 450 |
-#endif |
|
| 451 |
- |
|
| 452 | 446 |
void avio_flush(AVIOContext *s); |
| 453 | 447 |
|
| 454 | 448 |
|
| ... | ... |
@@ -458,13 +479,25 @@ void avio_flush(AVIOContext *s); |
| 458 | 458 |
*/ |
| 459 | 459 |
int avio_read(AVIOContext *s, unsigned char *buf, int size); |
| 460 | 460 |
|
| 461 |
-/** @note return 0 if EOF, so you cannot use it if EOF handling is |
|
| 462 |
- necessary */ |
|
| 461 |
+/** |
|
| 462 |
+ * @defgroup avio_read Functions for reading from AVIOContext. |
|
| 463 |
+ * @{
|
|
| 464 |
+ * |
|
| 465 |
+ * @note return 0 if EOF, so you cannot use it if EOF handling is |
|
| 466 |
+ * necessary |
|
| 467 |
+ */ |
|
| 463 | 468 |
int avio_r8 (AVIOContext *s); |
| 464 | 469 |
unsigned int avio_rl16(AVIOContext *s); |
| 465 | 470 |
unsigned int avio_rl24(AVIOContext *s); |
| 466 | 471 |
unsigned int avio_rl32(AVIOContext *s); |
| 467 | 472 |
uint64_t avio_rl64(AVIOContext *s); |
| 473 |
+unsigned int avio_rb16(AVIOContext *s); |
|
| 474 |
+unsigned int avio_rb24(AVIOContext *s); |
|
| 475 |
+unsigned int avio_rb32(AVIOContext *s); |
|
| 476 |
+uint64_t avio_rb64(AVIOContext *s); |
|
| 477 |
+/** |
|
| 478 |
+ * @} |
|
| 479 |
+ */ |
|
| 468 | 480 |
|
| 469 | 481 |
/** |
| 470 | 482 |
* 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); |
| 489 | 489 |
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); |
| 490 | 490 |
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); |
| 491 | 491 |
|
| 492 |
-#if FF_API_OLD_AVIO |
|
| 493 |
-/** |
|
| 494 |
- * @deprecated use avio_get_str instead |
|
| 495 |
- */ |
|
| 496 |
-attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); |
|
| 497 |
-#endif |
|
| 498 |
-unsigned int avio_rb16(AVIOContext *s); |
|
| 499 |
-unsigned int avio_rb24(AVIOContext *s); |
|
| 500 |
-unsigned int avio_rb32(AVIOContext *s); |
|
| 501 |
-uint64_t avio_rb64(AVIOContext *s); |
|
| 502 |
- |
|
| 503 |
-#if FF_API_OLD_AVIO |
|
| 504 |
-/** |
|
| 505 |
- * @deprecated Use AVIOContext.seekable field directly. |
|
| 506 |
- */ |
|
| 507 |
-attribute_deprecated static inline int url_is_streamed(AVIOContext *s) |
|
| 508 |
-{
|
|
| 509 |
- return !s->seekable; |
|
| 510 |
-} |
|
| 511 |
-#endif |
|
| 512 | 492 |
|
| 513 | 493 |
#if FF_API_URL_RESETBUF |
| 514 | 494 |
/** Reset the buffer for reading or writing. |
| ... | ... |
@@ -560,21 +573,13 @@ int url_resetbuf(AVIOContext *s, int flags); |
| 560 | 560 |
*/ |
| 561 | 561 |
int avio_open(AVIOContext **s, const char *url, int flags); |
| 562 | 562 |
|
| 563 |
-int avio_close(AVIOContext *s); |
|
| 564 |
- |
|
| 565 |
-#if FF_API_OLD_AVIO |
|
| 566 |
-attribute_deprecated URLContext *url_fileno(AVIOContext *s); |
|
| 567 |
- |
|
| 568 | 563 |
/** |
| 569 |
- * @deprecated use AVIOContext.max_packet_size directly. |
|
| 564 |
+ * Close the resource accessed by the AVIOContext s and free it. |
|
| 565 |
+ * This function can only be used if s was opened by avio_open(). |
|
| 566 |
+ * |
|
| 567 |
+ * @return 0 on success, an AVERROR < 0 on error. |
|
| 570 | 568 |
*/ |
| 571 |
-attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); |
|
| 572 |
- |
|
| 573 |
-attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); |
|
| 574 |
- |
|
| 575 |
-/** return the written or read size */ |
|
| 576 |
-attribute_deprecated int url_close_buf(AVIOContext *s); |
|
| 577 |
-#endif |
|
| 569 |
+int avio_close(AVIOContext *s); |
|
| 578 | 570 |
|
| 579 | 571 |
/** |
| 580 | 572 |
* Open a write only memory stream. |
| ... | ... |
@@ -164,6 +164,7 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial) |
| 164 | 164 |
os->bufsize = DECODER_BUFFER_SIZE; |
| 165 | 165 |
os->buf = av_malloc(os->bufsize); |
| 166 | 166 |
os->header = -1; |
| 167 |
+ os->page_begin = 1; |
|
| 167 | 168 |
|
| 168 | 169 |
st = av_new_stream (s, idx); |
| 169 | 170 |
if (!st) |
| ... | ... |
@@ -241,12 +242,27 @@ ogg_read_page (AVFormatContext * s, int *str) |
| 241 | 241 |
|
| 242 | 242 |
idx = ogg_find_stream (ogg, serial); |
| 243 | 243 |
if (idx < 0){
|
| 244 |
+ for (i = 0; i < ogg->nstreams; i++) {
|
|
| 245 |
+ if (!ogg->streams[i].page_begin) {
|
|
| 246 |
+ int n; |
|
| 247 |
+ |
|
| 248 |
+ for (n = 0; n < ogg->nstreams; n++) {
|
|
| 249 |
+ av_free(ogg->streams[n].buf); |
|
| 250 |
+ av_free(ogg->streams[n].private); |
|
| 251 |
+ } |
|
| 252 |
+ ogg->curidx = -1; |
|
| 253 |
+ ogg->nstreams = 0; |
|
| 254 |
+ break; |
|
| 255 |
+ } |
|
| 256 |
+ } |
|
| 244 | 257 |
idx = ogg_new_stream (s, serial); |
| 245 | 258 |
if (idx < 0) |
| 246 | 259 |
return -1; |
| 247 | 260 |
} |
| 248 | 261 |
|
| 249 | 262 |
os = ogg->streams + idx; |
| 263 |
+ if (!(flags & OGG_FLAG_BOS)) |
|
| 264 |
+ os->page_begin = 0; |
|
| 250 | 265 |
os->page_pos = avio_tell(bc) - 27; |
| 251 | 266 |
|
| 252 | 267 |
if(os->psize > 0) |
| ... | ... |
@@ -75,6 +75,7 @@ struct ogg_stream {
|
| 75 | 75 |
int incomplete; ///< whether we're expecting a continuation in the next page |
| 76 | 76 |
int page_end; ///< current packet is the last one completed in the page |
| 77 | 77 |
int keyframe_seek; |
| 78 |
+ int page_begin; ///< set to 1 if the stream only received a begin-of-stream packet, otherwise 0 |
|
| 78 | 79 |
void *private; |
| 79 | 80 |
}; |
| 80 | 81 |
|
| ... | ... |
@@ -232,6 +232,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
|
| 232 | 232 |
{ CODEC_ID_WMV3, MKTAG('W', 'M', 'V', 'P') },
|
| 233 | 233 |
{ CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
|
| 234 | 234 |
{ CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
|
| 235 |
+ { CODEC_ID_VC1, MKTAG('W', 'V', 'P', '2') },
|
|
| 235 | 236 |
{ CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
|
| 236 | 237 |
{ CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
|
| 237 | 238 |
{ CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
|