Browse code

Use dynamically allocated ByteIOContext in AVFormatContext

patch by: Björn Axelsson, bjorn d axelsson a intinor d se
thread: [PATCH] Remove static ByteIOContexts, 06 nov 2007

Originally committed as revision 11071 to svn://svn.ffmpeg.org/ffmpeg/trunk

Björn Axelsson authored on 2007/11/21 16:41:00
Showing 89 changed files
... ...
@@ -920,9 +920,9 @@ static void print_report(AVFormatContext **output_files,
920 920
 
921 921
     oc = output_files[0];
922 922
 
923
-    total_size = url_fsize(&oc->pb);
923
+    total_size = url_fsize(oc->pb);
924 924
     if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
925
-        total_size= url_ftell(&oc->pb);
925
+        total_size= url_ftell(oc->pb);
926 926
 
927 927
     buf[0] = '\0';
928 928
     ti1 = 1e10;
... ...
@@ -1948,7 +1948,7 @@ static int av_encode(AVFormatContext **output_files,
1948 1948
             break;
1949 1949
 
1950 1950
         /* finish if limit size exhausted */
1951
-        if (limit_filesize != 0 && limit_filesize < url_ftell(&output_files[0]->pb))
1951
+        if (limit_filesize != 0 && limit_filesize < url_ftell(output_files[0]->pb))
1952 1952
             break;
1953 1953
 
1954 1954
         /* read a frame from it and output it in the fifo */
... ...
@@ -3835,7 +3835,7 @@ static int av_exit()
3835 3835
         AVFormatContext *s = output_files[i];
3836 3836
         int j;
3837 3837
         if (!(s->oformat->flags & AVFMT_NOFILE))
3838
-            url_fclose(&s->pb);
3838
+            url_fclose(s->pb);
3839 3839
         for(j=0;j<s->nb_streams;j++) {
3840 3840
             av_free(s->streams[j]->codec);
3841 3841
             av_free(s->streams[j]);
... ...
@@ -1912,7 +1912,8 @@ static int decode_thread(void *arg)
1912 1912
         ret = -1;
1913 1913
         goto fail;
1914 1914
     }
1915
-    ic->pb.eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
1915
+    if(ic->pb)
1916
+        ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
1916 1917
 
1917 1918
     /* if seeking requested, we execute it */
1918 1919
     if (start_time != AV_NOPTS_VALUE) {
... ...
@@ -1980,7 +1981,7 @@ static int decode_thread(void *arg)
1980 1980
 #if defined(CONFIG_RTSP_DEMUXER) || defined(CONFIG_MMSH_PROTOCOL)
1981 1981
         if (is->paused &&
1982 1982
                 (!strcmp(ic->iformat->name, "rtsp") ||
1983
-                 !strcmp(url_fileno(&ic->pb)->prot->name, "mmsh"))) {
1983
+                 (ic->pb && !strcmp(url_fileno(ic->pb)->prot->name, "mmsh")))) {
1984 1984
             /* wait 10 ms to avoid trying to get another packet */
1985 1985
             /* XXX: horrible */
1986 1986
             SDL_Delay(10);
... ...
@@ -2023,14 +2024,14 @@ static int decode_thread(void *arg)
2023 2023
         if (is->audioq.size > MAX_AUDIOQ_SIZE ||
2024 2024
             is->videoq.size > MAX_VIDEOQ_SIZE ||
2025 2025
             is->subtitleq.size > MAX_SUBTITLEQ_SIZE ||
2026
-            url_feof(&ic->pb)) {
2026
+            url_feof(ic->pb)) {
2027 2027
             /* wait 10 ms */
2028 2028
             SDL_Delay(10);
2029 2029
             continue;
2030 2030
         }
2031 2031
         ret = av_read_frame(ic, pkt);
2032 2032
         if (ret < 0) {
2033
-            if (url_ferror(&ic->pb) == 0) {
2033
+            if (url_ferror(ic->pb) == 0) {
2034 2034
                 SDL_Delay(100); /* wait for user event */
2035 2035
                 continue;
2036 2036
             } else
... ...
@@ -2282,7 +2283,7 @@ static void event_loop(void)
2282 2282
             do_seek:
2283 2283
                 if (cur_stream) {
2284 2284
                     if (seek_by_bytes) {
2285
-                        pos = url_ftell(&cur_stream->ic->pb);
2285
+                        pos = url_ftell(cur_stream->ic->pb);
2286 2286
                         if (cur_stream->ic->bit_rate)
2287 2287
                             incr *= cur_stream->ic->bit_rate / 60.0;
2288 2288
                         else
... ...
@@ -752,7 +752,7 @@ static void close_connection(HTTPContext *c)
752 752
             /* prepare header */
753 753
             if (url_open_dyn_buf(&ctx->pb) >= 0) {
754 754
                 av_write_trailer(ctx);
755
-                url_close_dyn_buf(&ctx->pb, &c->pb_buffer);
755
+                url_close_dyn_buf(ctx->pb, &c->pb_buffer);
756 756
             }
757 757
         }
758 758
     }
... ...
@@ -1596,9 +1596,9 @@ static void compute_stats(HTTPContext *c)
1596 1596
     char *p;
1597 1597
     time_t ti;
1598 1598
     int i, len;
1599
-    ByteIOContext pb1, *pb = &pb1;
1599
+    ByteIOContext *pb;
1600 1600
 
1601
-    if (url_open_dyn_buf(pb) < 0) {
1601
+    if (url_open_dyn_buf(&pb) < 0) {
1602 1602
         /* XXX: return an error ? */
1603 1603
         c->buffer_ptr = c->buffer;
1604 1604
         c->buffer_end = c->buffer;
... ...
@@ -2032,13 +2032,13 @@ static int http_prepare_data(HTTPContext *c)
2032 2032
             /* XXX: potential leak */
2033 2033
             return -1;
2034 2034
         }
2035
-        c->fmt_ctx.pb.is_streamed = 1;
2035
+        c->fmt_ctx.pb->is_streamed = 1;
2036 2036
 
2037 2037
         av_set_parameters(&c->fmt_ctx, NULL);
2038 2038
         if (av_write_header(&c->fmt_ctx) < 0)
2039 2039
             return -1;
2040 2040
 
2041
-        len = url_close_dyn_buf(&c->fmt_ctx.pb, &c->pb_buffer);
2041
+        len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
2042 2042
         c->buffer_ptr = c->pb_buffer;
2043 2043
         c->buffer_end = c->pb_buffer + len;
2044 2044
 
... ...
@@ -2182,7 +2182,7 @@ static int http_prepare_data(HTTPContext *c)
2182 2182
                         if (av_write_frame(ctx, &pkt))
2183 2183
                             c->state = HTTPSTATE_SEND_DATA_TRAILER;
2184 2184
 
2185
-                        len = url_close_dyn_buf(&ctx->pb, &c->pb_buffer);
2185
+                        len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
2186 2186
                         c->cur_frame_bytes = len;
2187 2187
                         c->buffer_ptr = c->pb_buffer;
2188 2188
                         c->buffer_end = c->pb_buffer + len;
... ...
@@ -2208,7 +2208,7 @@ static int http_prepare_data(HTTPContext *c)
2208 2208
             return -1;
2209 2209
         }
2210 2210
         av_write_trailer(ctx);
2211
-        len = url_close_dyn_buf(&ctx->pb, &c->pb_buffer);
2211
+        len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
2212 2212
         c->buffer_ptr = c->pb_buffer;
2213 2213
         c->buffer_end = c->pb_buffer + len;
2214 2214
 
... ...
@@ -2261,7 +2261,7 @@ static int http_send_data(HTTPContext *c)
2261 2261
 
2262 2262
                 if (c->rtp_protocol == RTSP_PROTOCOL_RTP_TCP) {
2263 2263
                     /* RTP packets are sent inside the RTSP TCP connection */
2264
-                    ByteIOContext pb1, *pb = &pb1;
2264
+                    ByteIOContext *pb;
2265 2265
                     int interleaved_index, size;
2266 2266
                     uint8_t header[4];
2267 2267
                     HTTPContext *rtsp_c;
... ...
@@ -2273,7 +2273,7 @@ static int http_send_data(HTTPContext *c)
2273 2273
                     /* if already sending something, then wait. */
2274 2274
                     if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
2275 2275
                         break;
2276
-                    if (url_open_dyn_buf(pb) < 0)
2276
+                    if (url_open_dyn_buf(&pb) < 0)
2277 2277
                         goto fail1;
2278 2278
                     interleaved_index = c->packet_stream_index * 2;
2279 2279
                     /* RTCP packets are sent at odd indexes */
... ...
@@ -2432,14 +2432,13 @@ static int http_receive_data(HTTPContext *c)
2432 2432
             /* We have a header in our hands that contains useful data */
2433 2433
             AVFormatContext s;
2434 2434
             AVInputFormat *fmt_in;
2435
-            ByteIOContext *pb = &s.pb;
2436 2435
             int i;
2437 2436
 
2438 2437
             memset(&s, 0, sizeof(s));
2439 2438
 
2440
-            url_open_buf(pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
2441
-            pb->buf_end = c->buffer_end;        /* ?? */
2442
-            pb->is_streamed = 1;
2439
+            url_open_buf(&s.pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
2440
+            s.pb->buf_end = c->buffer_end;        /* ?? */
2441
+            s.pb->is_streamed = 1;
2443 2442
 
2444 2443
             /* use feed output format name to find corresponding input format */
2445 2444
             fmt_in = av_find_input_format(feed->fmt->name);
... ...
@@ -2553,7 +2552,6 @@ static int rtsp_parse_request(HTTPContext *c)
2553 2553
     char url[1024];
2554 2554
     char protocol[32];
2555 2555
     char line[1024];
2556
-    ByteIOContext pb1;
2557 2556
     int len;
2558 2557
     RTSPHeader header1, *header = &header1;
2559 2558
 
... ...
@@ -2568,8 +2566,7 @@ static int rtsp_parse_request(HTTPContext *c)
2568 2568
     av_strlcpy(c->url, url, sizeof(c->url));
2569 2569
     av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
2570 2570
 
2571
-    c->pb = &pb1;
2572
-    if (url_open_dyn_buf(c->pb) < 0) {
2571
+    if (url_open_dyn_buf(&c->pb) < 0) {
2573 2572
         /* XXX: cannot do more */
2574 2573
         c->pb = NULL; /* safety */
2575 2574
         return -1;
... ...
@@ -3164,7 +3161,7 @@ static int rtp_new_av_stream(HTTPContext *c,
3164 3164
         av_free(ctx);
3165 3165
         return -1;
3166 3166
     }
3167
-    url_close_dyn_buf(&ctx->pb, &dummy_buf);
3167
+    url_close_dyn_buf(ctx->pb, &dummy_buf);
3168 3168
     av_free(dummy_buf);
3169 3169
 
3170 3170
     c->rtp_ctx[stream_index] = ctx;
... ...
@@ -3479,7 +3476,7 @@ static void build_feed_streams(void)
3479 3479
             }
3480 3480
             /* XXX: need better api */
3481 3481
             av_freep(&s->priv_data);
3482
-            url_fclose(&s->pb);
3482
+            url_fclose(s->pb);
3483 3483
         }
3484 3484
         /* get feed size and write index */
3485 3485
         fd = open(feed->feed_filename, O_RDONLY);
... ...
@@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p)
92 92
 static int fourxm_read_header(AVFormatContext *s,
93 93
                               AVFormatParameters *ap)
94 94
 {
95
-    ByteIOContext *pb = &s->pb;
95
+    ByteIOContext *pb = s->pb;
96 96
     unsigned int fourcc_tag;
97 97
     unsigned int size;
98 98
     int header_size;
... ...
@@ -224,7 +224,7 @@ static int fourxm_read_packet(AVFormatContext *s,
224 224
                               AVPacket *pkt)
225 225
 {
226 226
     FourxmDemuxContext *fourxm = s->priv_data;
227
-    ByteIOContext *pb = &s->pb;
227
+    ByteIOContext *pb = s->pb;
228 228
     unsigned int fourcc_tag;
229 229
     unsigned int size, out_size;
230 230
     int ret = 0;
... ...
@@ -235,7 +235,7 @@ static int fourxm_read_packet(AVFormatContext *s,
235 235
 
236 236
     while (!packet_read) {
237 237
 
238
-        if ((ret = get_buffer(&s->pb, header, 8)) < 0)
238
+        if ((ret = get_buffer(s->pb, header, 8)) < 0)
239 239
             return ret;
240 240
         fourcc_tag = AV_RL32(&header[0]);
241 241
         size = AV_RL32(&header[4]);
... ...
@@ -265,9 +265,9 @@ static int fourxm_read_packet(AVFormatContext *s,
265 265
                 return AVERROR(EIO);
266 266
             pkt->stream_index = fourxm->video_stream_index;
267 267
             pkt->pts = fourxm->video_pts;
268
-            pkt->pos = url_ftell(&s->pb);
268
+            pkt->pos = url_ftell(s->pb);
269 269
             memcpy(pkt->data, header, 8);
270
-            ret = get_buffer(&s->pb, &pkt->data[8], size);
270
+            ret = get_buffer(s->pb, &pkt->data[8], size);
271 271
 
272 272
             if (ret < 0)
273 273
                 av_free_packet(pkt);
... ...
@@ -282,7 +282,7 @@ static int fourxm_read_packet(AVFormatContext *s,
282 282
             size-=8;
283 283
 
284 284
             if (track_number == fourxm->selected_track) {
285
-                ret= av_get_packet(&s->pb, pkt, size);
285
+                ret= av_get_packet(s->pb, pkt, size);
286 286
                 if(ret<0)
287 287
                     return AVERROR(EIO);
288 288
                 pkt->stream_index =
... ...
@@ -84,7 +84,7 @@ static int adts_write_frame_header(AVFormatContext *s, int size)
84 84
     put_bits(&pb, 2, 0);        /* number_of_raw_data_blocks_in_frame */
85 85
 
86 86
     flush_put_bits(&pb);
87
-    put_buffer(&s->pb, buf, ADTS_HEADER_SIZE);
87
+    put_buffer(s->pb, buf, ADTS_HEADER_SIZE);
88 88
 
89 89
     return 0;
90 90
 }
... ...
@@ -92,7 +92,7 @@ static int adts_write_frame_header(AVFormatContext *s, int size)
92 92
 static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
93 93
 {
94 94
     ADTSContext *adts = s->priv_data;
95
-    ByteIOContext *pb = &s->pb;
95
+    ByteIOContext *pb = s->pb;
96 96
 
97 97
     if (!pkt->size)
98 98
         return 0;
... ...
@@ -161,7 +161,7 @@ typedef struct {
161 161
 static int aiff_write_header(AVFormatContext *s)
162 162
 {
163 163
     AIFFOutputContext *aiff = s->priv_data;
164
-    ByteIOContext *pb = &s->pb;
164
+    ByteIOContext *pb = s->pb;
165 165
     AVCodecContext *enc = s->streams[0]->codec;
166 166
     AVExtFloat sample_rate;
167 167
     int aifc = 0;
... ...
@@ -231,14 +231,14 @@ static int aiff_write_header(AVFormatContext *s)
231 231
 
232 232
 static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
233 233
 {
234
-    ByteIOContext *pb = &s->pb;
234
+    ByteIOContext *pb = s->pb;
235 235
     put_buffer(pb, pkt->data, pkt->size);
236 236
     return 0;
237 237
 }
238 238
 
239 239
 static int aiff_write_trailer(AVFormatContext *s)
240 240
 {
241
-    ByteIOContext *pb = &s->pb;
241
+    ByteIOContext *pb = s->pb;
242 242
     AIFFOutputContext *aiff = s->priv_data;
243 243
     AVCodecContext *enc = s->streams[0]->codec;
244 244
 
... ...
@@ -250,7 +250,7 @@ static int aiff_write_trailer(AVFormatContext *s)
250 250
         end_size++;
251 251
     }
252 252
 
253
-    if (!url_is_streamed(&s->pb)) {
253
+    if (!url_is_streamed(s->pb)) {
254 254
         /* File length */
255 255
         url_fseek(pb, aiff->form, SEEK_SET);
256 256
         put_be32(pb, (uint32_t)(file_size - aiff->form - 4));
... ...
@@ -293,7 +293,7 @@ static int aiff_read_header(AVFormatContext *s,
293 293
     offset_t offset = 0;
294 294
     uint32_t tag;
295 295
     unsigned version = AIFF_C_VERSION1;
296
-    ByteIOContext *pb = &s->pb;
296
+    ByteIOContext *pb = s->pb;
297 297
     AVStream * st = s->streams[0];
298 298
 
299 299
     /* check FORM header */
... ...
@@ -399,11 +399,11 @@ static int aiff_read_packet(AVFormatContext *s,
399 399
     int res;
400 400
 
401 401
     /* End of stream may be reached */
402
-    if (url_feof(&s->pb))
402
+    if (url_feof(s->pb))
403 403
         return AVERROR(EIO);
404 404
 
405 405
     /* Now for that packet */
406
-    res = av_get_packet(&s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
406
+    res = av_get_packet(s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
407 407
     if (res < 0)
408 408
         return res;
409 409
 
... ...
@@ -33,7 +33,7 @@ static const char AMRWB_header [] = "#!AMR-WB\n";
33 33
 #ifdef CONFIG_MUXERS
34 34
 static int amr_write_header(AVFormatContext *s)
35 35
 {
36
-    ByteIOContext *pb = &s->pb;
36
+    ByteIOContext *pb = s->pb;
37 37
     AVCodecContext *enc = s->streams[0]->codec;
38 38
 
39 39
     s->priv_data = NULL;
... ...
@@ -56,8 +56,8 @@ static int amr_write_header(AVFormatContext *s)
56 56
 
57 57
 static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
58 58
 {
59
-    put_buffer(&s->pb, pkt->data, pkt->size);
60
-    put_flush_packet(&s->pb);
59
+    put_buffer(s->pb, pkt->data, pkt->size);
60
+    put_flush_packet(s->pb);
61 61
     return 0;
62 62
 }
63 63
 #endif /* CONFIG_MUXERS */
... ...
@@ -78,7 +78,7 @@ static int amr_probe(AVProbeData *p)
78 78
 static int amr_read_header(AVFormatContext *s,
79 79
                            AVFormatParameters *ap)
80 80
 {
81
-    ByteIOContext *pb = &s->pb;
81
+    ByteIOContext *pb = s->pb;
82 82
     AVStream *st;
83 83
     uint8_t header[9];
84 84
 
... ...
@@ -120,13 +120,13 @@ static int amr_read_packet(AVFormatContext *s,
120 120
     AVCodecContext *enc = s->streams[0]->codec;
121 121
     int read, size = 0, toc, mode;
122 122
 
123
-    if (url_feof(&s->pb))
123
+    if (url_feof(s->pb))
124 124
     {
125 125
         return AVERROR(EIO);
126 126
     }
127 127
 
128 128
 //FIXME this is wrong, this should rather be in a AVParset
129
-    toc=get_byte(&s->pb);
129
+    toc=get_byte(s->pb);
130 130
     mode = (toc >> 3) & 0x0F;
131 131
 
132 132
     if (enc->codec_id == CODEC_ID_AMR_NB)
... ...
@@ -152,10 +152,10 @@ static int amr_read_packet(AVFormatContext *s,
152 152
     }
153 153
 
154 154
     pkt->stream_index = 0;
155
-    pkt->pos= url_ftell(&s->pb);
155
+    pkt->pos= url_ftell(s->pb);
156 156
     pkt->data[0]=toc;
157 157
     pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
158
-    read = get_buffer(&s->pb, pkt->data+1, size-1);
158
+    read = get_buffer(s->pb, pkt->data+1, size-1);
159 159
 
160 160
     if (read != size-1)
161 161
     {
... ...
@@ -32,7 +32,7 @@ static int apc_probe(AVProbeData *p)
32 32
 
33 33
 static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
34 34
 {
35
-    ByteIOContext *pb = &s->pb;
35
+    ByteIOContext *pb = s->pb;
36 36
     AVStream *st;
37 37
 
38 38
     get_le32(pb); /* CRYO */
... ...
@@ -74,7 +74,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
74 74
 
75 75
 static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
76 76
 {
77
-    if (av_get_packet(&s->pb, pkt, MAX_READ_SIZE) <= 0)
77
+    if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
78 78
         return AVERROR(EIO);
79 79
     pkt->stream_index = 0;
80 80
     return 0;
... ...
@@ -110,7 +110,7 @@ typedef struct {
110 110
 
111 111
 static void ape_tag_read_field(AVFormatContext *s)
112 112
 {
113
-    ByteIOContext *pb = &s->pb;
113
+    ByteIOContext *pb = s->pb;
114 114
     uint8_t buf[1024];
115 115
     uint32_t size;
116 116
     int i;
... ...
@@ -143,7 +143,7 @@ static void ape_tag_read_field(AVFormatContext *s)
143 143
 
144 144
 static void ape_parse_tag(AVFormatContext *s)
145 145
 {
146
-    ByteIOContext *pb = &s->pb;
146
+    ByteIOContext *pb = s->pb;
147 147
     int file_size = url_fsize(pb);
148 148
     uint32_t val, fields, tag_bytes;
149 149
     uint8_t buf[8];
... ...
@@ -270,7 +270,7 @@ static void ape_dumpinfo(APEContext * ape_ctx)
270 270
 
271 271
 static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
272 272
 {
273
-    ByteIOContext *pb = &s->pb;
273
+    ByteIOContext *pb = s->pb;
274 274
     APEContext *ape = s->priv_data;
275 275
     AVStream *st;
276 276
     uint32_t tag;
... ...
@@ -456,12 +456,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
456 456
     APEContext *ape = s->priv_data;
457 457
     uint32_t extra_size = 8;
458 458
 
459
-    if (url_feof(&s->pb))
459
+    if (url_feof(s->pb))
460 460
         return AVERROR_IO;
461 461
     if (ape->currentframe > ape->totalframes)
462 462
         return AVERROR_IO;
463 463
 
464
-    url_fseek (&s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
464
+    url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
465 465
 
466 466
     /* Calculate how many blocks there are in this frame */
467 467
     if (ape->currentframe == (ape->totalframes - 1))
... ...
@@ -474,7 +474,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
474 474
 
475 475
     AV_WL32(pkt->data    , nblocks);
476 476
     AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
477
-    ret = get_buffer(&s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
477
+    ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
478 478
 
479 479
     pkt->pts = ape->frames[ape->currentframe].pts;
480 480
     pkt->stream_index = 0;
... ...
@@ -244,7 +244,7 @@ static void end_header(ByteIOContext *pb, int64_t pos)
244 244
 static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags)
245 245
 {
246 246
     ASFContext *asf = s->priv_data;
247
-    ByteIOContext *pb = &s->pb;
247
+    ByteIOContext *pb = s->pb;
248 248
     int length;
249 249
 
250 250
     length = payload_length + 8;
... ...
@@ -270,7 +270,7 @@ static int64_t unix_to_file_time(int ti)
270 270
 static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
271 271
 {
272 272
     ASFContext *asf = s->priv_data;
273
-    ByteIOContext *pb = &s->pb;
273
+    ByteIOContext *pb = s->pb;
274 274
     int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
275 275
     int has_title;
276 276
     AVCodecContext *enc;
... ...
@@ -506,7 +506,7 @@ static int asf_write_header(AVFormatContext *s)
506 506
         return -1;
507 507
     }
508 508
 
509
-    put_flush_packet(&s->pb);
509
+    put_flush_packet(s->pb);
510 510
 
511 511
     asf->packet_nb_payloads = 0;
512 512
     asf->packet_timestamp_start = -1;
... ...
@@ -535,7 +535,7 @@ static int put_payload_parsing_info(
535 535
             )
536 536
 {
537 537
     ASFContext *asf = s->priv_data;
538
-    ByteIOContext *pb = &s->pb;
538
+    ByteIOContext *pb = s->pb;
539 539
     int ppi_size, i;
540 540
     int64_t start= url_ftell(pb);
541 541
 
... ...
@@ -600,9 +600,9 @@ static void flush_packet(AVFormatContext *s)
600 600
     assert(packet_hdr_size <= asf->packet_size_left);
601 601
     memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left);
602 602
 
603
-    put_buffer(&s->pb, asf->packet_buf, asf->packet_size - packet_hdr_size);
603
+    put_buffer(s->pb, asf->packet_buf, asf->packet_size - packet_hdr_size);
604 604
 
605
-    put_flush_packet(&s->pb);
605
+    put_flush_packet(s->pb);
606 606
     asf->nb_packets++;
607 607
     asf->packet_nb_payloads = 0;
608 608
     asf->packet_timestamp_start = -1;
... ...
@@ -766,7 +766,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
766 766
 //
767 767
 static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count)
768 768
 {
769
-    ByteIOContext *pb = &s->pb;
769
+    ByteIOContext *pb = s->pb;
770 770
     int i;
771 771
 
772 772
     put_guid(pb, &simple_index_header);
... ...
@@ -793,22 +793,22 @@ static int asf_write_trailer(AVFormatContext *s)
793 793
         flush_packet(s);
794 794
 
795 795
     /* write index */
796
-    data_size = url_ftell(&s->pb);
796
+    data_size = url_ftell(s->pb);
797 797
     if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
798 798
         asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
799 799
     }
800
-    put_flush_packet(&s->pb);
800
+    put_flush_packet(s->pb);
801 801
 
802
-    if (asf->is_streamed || url_is_streamed(&s->pb)) {
802
+    if (asf->is_streamed || url_is_streamed(s->pb)) {
803 803
         put_chunk(s, 0x4524, 0, 0); /* end of stream */
804 804
     } else {
805 805
         /* rewrite an updated header */
806
-        file_size = url_ftell(&s->pb);
807
-        url_fseek(&s->pb, 0, SEEK_SET);
806
+        file_size = url_ftell(s->pb);
807
+        url_fseek(s->pb, 0, SEEK_SET);
808 808
         asf_write_header1(s, file_size, data_size - asf->data_offset);
809 809
     }
810 810
 
811
-    put_flush_packet(&s->pb);
811
+    put_flush_packet(s->pb);
812 812
     av_free(asf->index_ptr);
813 813
     return 0;
814 814
 }
... ...
@@ -148,7 +148,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
148 148
 {
149 149
     ASFContext *asf = s->priv_data;
150 150
     GUID g;
151
-    ByteIOContext *pb = &s->pb;
151
+    ByteIOContext *pb = s->pb;
152 152
     AVStream *st;
153 153
     ASFStream *asf_st;
154 154
     int size, i;
... ...
@@ -582,12 +582,12 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
582 582
 static int asf_get_packet(AVFormatContext *s)
583 583
 {
584 584
     ASFContext *asf = s->priv_data;
585
-    ByteIOContext *pb = &s->pb;
585
+    ByteIOContext *pb = s->pb;
586 586
     uint32_t packet_length, padsize;
587 587
     int rsize = 8;
588 588
     int c, d, e, off;
589 589
 
590
-    off= (url_ftell(&s->pb) - s->data_offset) % asf->packet_size + 3;
590
+    off= (url_ftell(s->pb) - s->data_offset) % asf->packet_size + 3;
591 591
 
592 592
     c=d=e=-1;
593 593
     while(off-- > 0){
... ...
@@ -658,7 +658,7 @@ static int asf_get_packet(AVFormatContext *s)
658 658
  */
659 659
 static int asf_read_frame_header(AVFormatContext *s){
660 660
     ASFContext *asf = s->priv_data;
661
-    ByteIOContext *pb = &s->pb;
661
+    ByteIOContext *pb = s->pb;
662 662
     int rsize = 1;
663 663
     int num = get_byte(pb);
664 664
     int64_t ts0, ts1;
... ...
@@ -731,7 +731,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
731 731
 {
732 732
     ASFContext *asf = s->priv_data;
733 733
     ASFStream *asf_st = 0;
734
-    ByteIOContext *pb = &s->pb;
734
+    ByteIOContext *pb = s->pb;
735 735
     //static int pc = 0;
736 736
     for (;;) {
737 737
         if(url_feof(pb))
... ...
@@ -745,7 +745,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
745 745
             /* fail safe */
746 746
             url_fskip(pb, ret);
747 747
 
748
-            asf->packet_pos= url_ftell(&s->pb);
748
+            asf->packet_pos= url_ftell(s->pb);
749 749
             if (asf->data_object_size != (uint64_t)-1 &&
750 750
                 (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
751 751
                 return AVERROR(EIO); /* Do not exceed the size of the data object */
... ...
@@ -968,7 +968,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
968 968
 
969 969
     pos= (pos+asf->packet_size-1-s->data_offset)/asf->packet_size*asf->packet_size+ s->data_offset;
970 970
     *ppos= pos;
971
-    url_fseek(&s->pb, pos, SEEK_SET);
971
+    url_fseek(s->pb, pos, SEEK_SET);
972 972
 
973 973
 //printf("asf_read_pts\n");
974 974
     asf_reset_header(s);
... ...
@@ -1012,21 +1012,21 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
1012 1012
     int i;
1013 1013
     int pct,ict;
1014 1014
 
1015
-    current_pos = url_ftell(&s->pb);
1015
+    current_pos = url_ftell(s->pb);
1016 1016
 
1017
-    url_fseek(&s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
1018
-    get_guid(&s->pb, &g);
1017
+    url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
1018
+    get_guid(s->pb, &g);
1019 1019
     if (!memcmp(&g, &index_guid, sizeof(GUID))) {
1020
-        gsize = get_le64(&s->pb);
1021
-        get_guid(&s->pb, &g);
1022
-        itime=get_le64(&s->pb);
1023
-        pct=get_le32(&s->pb);
1024
-        ict=get_le32(&s->pb);
1020
+        gsize = get_le64(s->pb);
1021
+        get_guid(s->pb, &g);
1022
+        itime=get_le64(s->pb);
1023
+        pct=get_le32(s->pb);
1024
+        ict=get_le32(s->pb);
1025 1025
         av_log(NULL, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
1026 1026
 
1027 1027
         for (i=0;i<ict;i++){
1028
-            int pktnum=get_le32(&s->pb);
1029
-            int pktct =get_le16(&s->pb);
1028
+            int pktnum=get_le32(s->pb);
1029
+            int pktct =get_le16(s->pb);
1030 1030
             av_log(NULL, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
1031 1031
 
1032 1032
             pos=s->data_offset + asf->packet_size*(int64_t)pktnum;
... ...
@@ -1036,7 +1036,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
1036 1036
         }
1037 1037
         asf->index_read= 1;
1038 1038
     }
1039
-    url_fseek(&s->pb, current_pos, SEEK_SET);
1039
+    url_fseek(s->pb, current_pos, SEEK_SET);
1040 1040
 }
1041 1041
 
1042 1042
 static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
... ...
@@ -1066,10 +1066,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
1066 1066
 
1067 1067
     // various attempts to find key frame have failed so far
1068 1068
     //    asf_reset_header(s);
1069
-    //    url_fseek(&s->pb, pos, SEEK_SET);
1069
+    //    url_fseek(s->pb, pos, SEEK_SET);
1070 1070
     //    key_pos = pos;
1071 1071
     //     for(i=0;i<16;i++){
1072
-    //         pos = url_ftell(&s->pb);
1072
+    //         pos = url_ftell(s->pb);
1073 1073
     //         if (av_read_frame(s, &pkt) < 0){
1074 1074
     //             av_log(s, AV_LOG_INFO, "seek failed\n");
1075 1075
     //             return -1;
... ...
@@ -1087,7 +1087,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
1087 1087
 
1088 1088
         /* do the seek */
1089 1089
         av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
1090
-        url_fseek(&s->pb, pos, SEEK_SET);
1090
+        url_fseek(s->pb, pos, SEEK_SET);
1091 1091
     }
1092 1092
     asf_reset_header(s);
1093 1093
     return 0;
... ...
@@ -59,7 +59,7 @@ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
59 59
 
60 60
 static int au_write_header(AVFormatContext *s)
61 61
 {
62
-    ByteIOContext *pb = &s->pb;
62
+    ByteIOContext *pb = s->pb;
63 63
 
64 64
     s->priv_data = NULL;
65 65
 
... ...
@@ -75,17 +75,17 @@ static int au_write_header(AVFormatContext *s)
75 75
 
76 76
 static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
77 77
 {
78
-    ByteIOContext *pb = &s->pb;
78
+    ByteIOContext *pb = s->pb;
79 79
     put_buffer(pb, pkt->data, pkt->size);
80 80
     return 0;
81 81
 }
82 82
 
83 83
 static int au_write_trailer(AVFormatContext *s)
84 84
 {
85
-    ByteIOContext *pb = &s->pb;
85
+    ByteIOContext *pb = s->pb;
86 86
     offset_t file_size;
87 87
 
88
-    if (!url_is_streamed(&s->pb)) {
88
+    if (!url_is_streamed(s->pb)) {
89 89
 
90 90
         /* update file size */
91 91
         file_size = url_ftell(pb);
... ...
@@ -116,7 +116,7 @@ static int au_read_header(AVFormatContext *s,
116 116
 {
117 117
     int size;
118 118
     unsigned int tag;
119
-    ByteIOContext *pb = &s->pb;
119
+    ByteIOContext *pb = s->pb;
120 120
     unsigned int id, codec, channels, rate;
121 121
     AVStream *st;
122 122
 
... ...
@@ -158,9 +158,9 @@ static int au_read_packet(AVFormatContext *s,
158 158
 {
159 159
     int ret;
160 160
 
161
-    if (url_feof(&s->pb))
161
+    if (url_feof(s->pb))
162 162
         return AVERROR(EIO);
163
-    ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
163
+    ret= av_get_packet(s->pb, pkt, MAX_SIZE);
164 164
     if (ret < 0)
165 165
         return AVERROR(EIO);
166 166
     pkt->stream_index = 0;
... ...
@@ -21,8 +21,8 @@
21 21
 #ifndef FFMPEG_AVFORMAT_H
22 22
 #define FFMPEG_AVFORMAT_H
23 23
 
24
-#define LIBAVFORMAT_VERSION_INT ((51<<16)+(19<<8)+0)
25
-#define LIBAVFORMAT_VERSION     51.19.0
24
+#define LIBAVFORMAT_VERSION_INT ((52<<16)+(0<<8)+0)
25
+#define LIBAVFORMAT_VERSION     52.0.0
26 26
 #define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
27 27
 
28 28
 #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
... ...
@@ -369,7 +369,7 @@ typedef struct AVFormatContext {
369 369
     struct AVInputFormat *iformat;
370 370
     struct AVOutputFormat *oformat;
371 371
     void *priv_data;
372
-    ByteIOContext pb;
372
+    ByteIOContext *pb;
373 373
     unsigned int nb_streams;
374 374
     AVStream *streams[MAX_STREAMS];
375 375
     char filename[1024]; /**< input or output filename */
... ...
@@ -106,7 +106,7 @@ static int get_riff(AVIContext *avi, ByteIOContext *pb)
106 106
 
107 107
 static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
108 108
     AVIContext *avi = s->priv_data;
109
-    ByteIOContext *pb = &s->pb;
109
+    ByteIOContext *pb = s->pb;
110 110
     int longs_pre_entry= get_le16(pb);
111 111
     int index_sub_type = get_byte(pb);
112 112
     int index_type     = get_byte(pb);
... ...
@@ -118,7 +118,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
118 118
     AVIStream *ast;
119 119
     int i;
120 120
     int64_t last_pos= -1;
121
-    int64_t filesize= url_fsize(&s->pb);
121
+    int64_t filesize= url_fsize(s->pb);
122 122
 
123 123
 #ifdef DEBUG_SEEK
124 124
     av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
... ...
@@ -225,7 +225,7 @@ static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen,  unsigned int
225 225
 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
226 226
 {
227 227
     AVIContext *avi = s->priv_data;
228
-    ByteIOContext *pb = &s->pb;
228
+    ByteIOContext *pb = s->pb;
229 229
     uint32_t tag, tag1, handler;
230 230
     int codec_type, stream_index, frame_period, bit_rate;
231 231
     unsigned int size, nb_frames;
... ...
@@ -583,7 +583,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
583 583
 static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
584 584
 {
585 585
     AVIContext *avi = s->priv_data;
586
-    ByteIOContext *pb = &s->pb;
586
+    ByteIOContext *pb = s->pb;
587 587
     int n, d[8], size;
588 588
     offset_t i, sync;
589 589
     void* dstr;
... ...
@@ -628,7 +628,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
628 628
         if(i>=0){
629 629
             int64_t pos= best_st->index_entries[i].pos;
630 630
             pos += best_ast->packet_size - best_ast->remaining;
631
-            url_fseek(&s->pb, pos + 8, SEEK_SET);
631
+            url_fseek(s->pb, pos + 8, SEEK_SET);
632 632
 //        av_log(NULL, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
633 633
 
634 634
             assert(best_ast->remaining <= best_ast->packet_size);
... ...
@@ -819,7 +819,7 @@ resync:
819 819
 static int avi_read_idx1(AVFormatContext *s, int size)
820 820
 {
821 821
     AVIContext *avi = s->priv_data;
822
-    ByteIOContext *pb = &s->pb;
822
+    ByteIOContext *pb = s->pb;
823 823
     int nb_index_entries, i;
824 824
     AVStream *st;
825 825
     AVIStream *ast;
... ...
@@ -890,7 +890,7 @@ static int guess_ni_flag(AVFormatContext *s){
890 890
 static int avi_load_index(AVFormatContext *s)
891 891
 {
892 892
     AVIContext *avi = s->priv_data;
893
-    ByteIOContext *pb = &s->pb;
893
+    ByteIOContext *pb = s->pb;
894 894
     uint32_t tag, size;
895 895
     offset_t pos= url_ftell(pb);
896 896
 
... ...
@@ -965,7 +965,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
965 965
         /* DV demux so it can synth correct timestamps              */
966 966
         dv_offset_reset(avi->dv_demux, timestamp);
967 967
 
968
-        url_fseek(&s->pb, pos, SEEK_SET);
968
+        url_fseek(s->pb, pos, SEEK_SET);
969 969
         avi->stream_index= -1;
970 970
         return 0;
971 971
     }
... ...
@@ -1005,7 +1005,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
1005 1005
     }
1006 1006
 
1007 1007
     /* do the seek */
1008
-    url_fseek(&s->pb, pos, SEEK_SET);
1008
+    url_fseek(s->pb, pos, SEEK_SET);
1009 1009
     avi->stream_index= -1;
1010 1010
     return 0;
1011 1011
 }
... ...
@@ -105,7 +105,7 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s
105 105
 
106 106
 static int avi_write_counters(AVFormatContext* s, int riff_id)
107 107
 {
108
-    ByteIOContext *pb = &s->pb;
108
+    ByteIOContext *pb = s->pb;
109 109
     AVIContext *avi = s->priv_data;
110 110
     int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
111 111
     offset_t file_size;
... ...
@@ -138,7 +138,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
138 138
 static int avi_write_header(AVFormatContext *s)
139 139
 {
140 140
     AVIContext *avi = s->priv_data;
141
-    ByteIOContext *pb = &s->pb;
141
+    ByteIOContext *pb = s->pb;
142 142
     int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
143 143
     AVCodecContext *stream, *video_enc;
144 144
     offset_t list1, list2, strh, strf;
... ...
@@ -332,7 +332,7 @@ static int avi_write_header(AVFormatContext *s)
332 332
 
333 333
 static int avi_write_ix(AVFormatContext *s)
334 334
 {
335
-    ByteIOContext *pb = &s->pb;
335
+    ByteIOContext *pb = s->pb;
336 336
     AVIContext *avi = s->priv_data;
337 337
     char tag[5];
338 338
     char ix_tag[] = "ix00";
... ...
@@ -389,7 +389,7 @@ static int avi_write_ix(AVFormatContext *s)
389 389
 
390 390
 static int avi_write_idx1(AVFormatContext *s)
391 391
 {
392
-    ByteIOContext *pb = &s->pb;
392
+    ByteIOContext *pb = s->pb;
393 393
     AVIContext *avi = s->priv_data;
394 394
     offset_t idx_chunk;
395 395
     int i;
... ...
@@ -435,7 +435,7 @@ static int avi_write_idx1(AVFormatContext *s)
435 435
 static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
436 436
 {
437 437
     AVIContext *avi = s->priv_data;
438
-    ByteIOContext *pb = &s->pb;
438
+    ByteIOContext *pb = s->pb;
439 439
     unsigned char tag[5];
440 440
     unsigned int flags=0;
441 441
     const int stream_index= pkt->stream_index;
... ...
@@ -476,7 +476,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
476 476
        avi->audio_strm_length[stream_index] += size;
477 477
     }
478 478
 
479
-    if (!url_is_streamed(&s->pb)) {
479
+    if (!url_is_streamed(s->pb)) {
480 480
         AVIIndex* idx = &avi->indexes[stream_index];
481 481
         int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
482 482
         int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
... ...
@@ -509,7 +509,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
509 509
 static int avi_write_trailer(AVFormatContext *s)
510 510
 {
511 511
     AVIContext *avi = s->priv_data;
512
-    ByteIOContext *pb = &s->pb;
512
+    ByteIOContext *pb = s->pb;
513 513
     int res = 0;
514 514
     int i, j, n, nb_frames;
515 515
     offset_t file_size;
... ...
@@ -201,7 +201,7 @@ static inline int url_is_streamed(ByteIOContext *s)
201 201
 
202 202
 /** @note when opened as read/write, the buffers are only used for
203 203
    writing */
204
-int url_fdopen(ByteIOContext *s, URLContext *h);
204
+int url_fdopen(ByteIOContext **s, URLContext *h);
205 205
 
206 206
 /** @warning must be called before any I/O */
207 207
 int url_setbufsize(ByteIOContext *s, int buf_size);
... ...
@@ -213,7 +213,7 @@ int url_resetbuf(ByteIOContext *s, int flags);
213 213
 
214 214
 /** @note when opened as read/write, the buffers are only used for
215 215
    writing */
216
-int url_fopen(ByteIOContext *s, const char *filename, int flags);
216
+int url_fopen(ByteIOContext **s, const char *filename, int flags);
217 217
 int url_fclose(ByteIOContext *s);
218 218
 URLContext *url_fileno(ByteIOContext *s);
219 219
 
... ...
@@ -227,7 +227,7 @@ URLContext *url_fileno(ByteIOContext *s);
227 227
  */
228 228
 int url_fget_max_packet_size(ByteIOContext *s);
229 229
 
230
-int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags);
230
+int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags);
231 231
 
232 232
 /** return the written or read size */
233 233
 int url_close_buf(ByteIOContext *s);
... ...
@@ -238,7 +238,7 @@ int url_close_buf(ByteIOContext *s);
238 238
  * @param s new IO context
239 239
  * @return zero if no error.
240 240
  */
241
-int url_open_dyn_buf(ByteIOContext *s);
241
+int url_open_dyn_buf(ByteIOContext **s);
242 242
 
243 243
 /**
244 244
  * Open a write only packetized memory stream with a maximum packet
... ...
@@ -249,7 +249,7 @@ int url_open_dyn_buf(ByteIOContext *s);
249 249
  * @param max_packet_size maximum packet size (must be > 0)
250 250
  * @return zero if no error.
251 251
  */
252
-int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size);
252
+int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size);
253 253
 
254 254
 /**
255 255
  * Return the written size and a pointer to the buffer. The buffer
... ...
@@ -111,7 +111,12 @@ void put_flush_packet(ByteIOContext *s)
111 111
 offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
112 112
 {
113 113
     offset_t offset1;
114
-    offset_t pos= s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
114
+    offset_t pos;
115
+
116
+    if(!s)
117
+        return AVERROR(EINVAL);
118
+
119
+    pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
115 120
 
116 121
     if (whence != SEEK_CUR && whence != SEEK_SET)
117 122
         return AVERROR(EINVAL);
... ...
@@ -167,6 +172,9 @@ offset_t url_fsize(ByteIOContext *s)
167 167
 {
168 168
     offset_t size;
169 169
 
170
+    if(!s)
171
+        return AVERROR(EINVAL);
172
+
170 173
     if (!s->seek)
171 174
         return AVERROR(EPIPE);
172 175
     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
... ...
@@ -181,11 +189,15 @@ offset_t url_fsize(ByteIOContext *s)
181 181
 
182 182
 int url_feof(ByteIOContext *s)
183 183
 {
184
+    if(!s)
185
+        return 0;
184 186
     return s->eof_reached;
185 187
 }
186 188
 
187 189
 int url_ferror(ByteIOContext *s)
188 190
 {
191
+    if(!s)
192
+        return 0;
189 193
     return s->error;
190 194
 }
191 195
 
... ...
@@ -508,7 +520,7 @@ static offset_t url_seek_packet(void *opaque, offset_t offset, int whence)
508 508
     //return 0;
509 509
 }
510 510
 
511
-int url_fdopen(ByteIOContext *s, URLContext *h)
511
+int url_fdopen(ByteIOContext **s, URLContext *h)
512 512
 {
513 513
     uint8_t *buffer;
514 514
     int buffer_size, max_packet_size;
... ...
@@ -524,14 +536,21 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
524 524
     if (!buffer)
525 525
         return AVERROR(ENOMEM);
526 526
 
527
-    if (init_put_byte(s, buffer, buffer_size,
527
+    *s = av_mallocz(sizeof(ByteIOContext));
528
+    if(!*s) {
529
+        av_free(buffer);
530
+        return AVERROR(ENOMEM);
531
+    }
532
+
533
+    if (init_put_byte(*s, buffer, buffer_size,
528 534
                       (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
529 535
                       url_read_packet, url_write_packet, url_seek_packet) < 0) {
530 536
         av_free(buffer);
537
+        av_freep(s);
531 538
         return AVERROR(EIO);
532 539
     }
533
-    s->is_streamed = h->is_streamed;
534
-    s->max_packet_size = max_packet_size;
540
+    (*s)->is_streamed = h->is_streamed;
541
+    (*s)->max_packet_size = max_packet_size;
535 542
     return 0;
536 543
 }
537 544
 
... ...
@@ -566,7 +585,7 @@ int url_resetbuf(ByteIOContext *s, int flags)
566 566
     return 0;
567 567
 }
568 568
 
569
-int url_fopen(ByteIOContext *s, const char *filename, int flags)
569
+int url_fopen(ByteIOContext **s, const char *filename, int flags)
570 570
 {
571 571
     URLContext *h;
572 572
     int err;
... ...
@@ -587,7 +606,7 @@ int url_fclose(ByteIOContext *s)
587 587
     URLContext *h = s->opaque;
588 588
 
589 589
     av_free(s->buffer);
590
-    memset(s, 0, sizeof(ByteIOContext));
590
+    av_free(s);
591 591
     return url_close(h);
592 592
 }
593 593
 
... ...
@@ -641,11 +660,18 @@ int url_fget_max_packet_size(ByteIOContext *s)
641 641
  * back to the server even if CONFIG_MUXERS is not set. */
642 642
 #if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
643 643
 /* buffer handling */
644
-int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
644
+int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags)
645 645
 {
646
-    return init_put_byte(s, buf, buf_size,
647
-                         (flags & URL_WRONLY || flags & URL_RDWR),
648
-                         NULL, NULL, NULL, NULL);
646
+    int ret;
647
+    *s = av_mallocz(sizeof(ByteIOContext));
648
+    if(!*s)
649
+        return AVERROR(ENOMEM);
650
+    ret = init_put_byte(*s, buf, buf_size,
651
+                        (flags & URL_WRONLY || flags & URL_RDWR),
652
+                        NULL, NULL, NULL, NULL);
653
+    if(ret != 0)
654
+        av_freep(s);
655
+    return ret;
649 656
 }
650 657
 
651 658
 int url_close_buf(ByteIOContext *s)
... ...
@@ -725,7 +751,7 @@ static offset_t dyn_buf_seek(void *opaque, offset_t offset, int whence)
725 725
     return 0;
726 726
 }
727 727
 
728
-static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
728
+static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
729 729
 {
730 730
     DynBuffer *d;
731 731
     int io_buffer_size, ret;
... ...
@@ -740,27 +766,35 @@ static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
740 740
     d = av_malloc(sizeof(DynBuffer) + io_buffer_size);
741 741
     if (!d)
742 742
         return -1;
743
+    *s = av_mallocz(sizeof(ByteIOContext));
744
+    if(!*s) {
745
+        av_free(d);
746
+        return AVERROR(ENOMEM);
747
+    }
743 748
     d->io_buffer_size = io_buffer_size;
744 749
     d->buffer = NULL;
745 750
     d->pos = 0;
746 751
     d->size = 0;
747 752
     d->allocated_size = 0;
748
-    ret = init_put_byte(s, d->io_buffer, io_buffer_size,
753
+    ret = init_put_byte(*s, d->io_buffer, io_buffer_size,
749 754
                         1, d, NULL,
750 755
                         max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
751 756
                         max_packet_size ? NULL : dyn_buf_seek);
752 757
     if (ret == 0) {
753
-        s->max_packet_size = max_packet_size;
758
+        (*s)->max_packet_size = max_packet_size;
759
+    } else {
760
+        av_free(d);
761
+        av_freep(s);
754 762
     }
755 763
     return ret;
756 764
 }
757 765
 
758
-int url_open_dyn_buf(ByteIOContext *s)
766
+int url_open_dyn_buf(ByteIOContext **s)
759 767
 {
760 768
     return url_open_dyn_buf_internal(s, 0);
761 769
 }
762 770
 
763
-int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size)
771
+int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size)
764 772
 {
765 773
     if (max_packet_size <= 0)
766 774
         return -1;
... ...
@@ -777,6 +811,7 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
777 777
     *pbuffer = d->buffer;
778 778
     size = d->size;
779 779
     av_free(d);
780
+    av_free(s);
780 781
     return size;
781 782
 }
782 783
 #endif /* CONFIG_MUXERS || CONFIG_NETWORK */
... ...
@@ -60,12 +60,12 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
60 60
 
61 61
     s->ctx_flags |= AVFMTCTX_NOHEADER;
62 62
 
63
-    url_fskip(&s->pb, 4);
64
-    avs->width = get_le16(&s->pb);
65
-    avs->height = get_le16(&s->pb);
66
-    avs->bits_per_sample = get_le16(&s->pb);
67
-    avs->fps = get_le16(&s->pb);
68
-    avs->nb_frames = get_le32(&s->pb);
63
+    url_fskip(s->pb, 4);
64
+    avs->width = get_le16(s->pb);
65
+    avs->height = get_le16(s->pb);
66
+    avs->bits_per_sample = get_le16(s->pb);
67
+    avs->fps = get_le16(s->pb);
68
+    avs->nb_frames = get_le32(s->pb);
69 69
     avs->remaining_frame_size = 0;
70 70
     avs->remaining_audio_size = 0;
71 71
 
... ...
@@ -103,7 +103,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
103 103
     pkt->data[palette_size + 1] = type;
104 104
     pkt->data[palette_size + 2] = size & 0xFF;
105 105
     pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
106
-    ret = get_buffer(&s->pb, pkt->data + palette_size + 4, size - 4) + 4;
106
+    ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
107 107
     if (ret < size) {
108 108
         av_free_packet(pkt);
109 109
         return AVERROR(EIO);
... ...
@@ -122,9 +122,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
122 122
     avs_format_t *avs = s->priv_data;
123 123
     int ret, size;
124 124
 
125
-    size = url_ftell(&s->pb);
125
+    size = url_ftell(s->pb);
126 126
     ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
127
-    size = url_ftell(&s->pb) - size;
127
+    size = url_ftell(s->pb) - size;
128 128
     avs->remaining_audio_size -= size;
129 129
 
130 130
     if (ret == AVERROR(EIO))
... ...
@@ -153,20 +153,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
153 153
 
154 154
     while (1) {
155 155
         if (avs->remaining_frame_size <= 0) {
156
-            if (!get_le16(&s->pb))    /* found EOF */
156
+            if (!get_le16(s->pb))    /* found EOF */
157 157
                 return AVERROR(EIO);
158
-            avs->remaining_frame_size = get_le16(&s->pb) - 4;
158
+            avs->remaining_frame_size = get_le16(s->pb) - 4;
159 159
         }
160 160
 
161 161
         while (avs->remaining_frame_size > 0) {
162
-            sub_type = get_byte(&s->pb);
163
-            type = get_byte(&s->pb);
164
-            size = get_le16(&s->pb);
162
+            sub_type = get_byte(s->pb);
163
+            type = get_byte(s->pb);
164
+            size = get_le16(s->pb);
165 165
             avs->remaining_frame_size -= size;
166 166
 
167 167
             switch (type) {
168 168
             case AVS_PALETTE:
169
-                ret = get_buffer(&s->pb, palette, size - 4);
169
+                ret = get_buffer(s->pb, palette, size - 4);
170 170
                 if (ret < size - 4)
171 171
                     return AVERROR(EIO);
172 172
                 palette_size = size;
... ...
@@ -203,7 +203,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
203 203
                 break;
204 204
 
205 205
             default:
206
-                url_fskip(&s->pb, size - 4);
206
+                url_fskip(s->pb, size - 4);
207 207
             }
208 208
         }
209 209
     }
... ...
@@ -59,7 +59,7 @@ static int vid_read_header(AVFormatContext *s,
59 59
                             AVFormatParameters *ap)
60 60
 {
61 61
     BVID_DemuxContext *vid = s->priv_data;
62
-    ByteIOContext *pb = &s->pb;
62
+    ByteIOContext *pb = s->pb;
63 63
     AVStream *stream;
64 64
 
65 65
     /* load main header. Contents:
... ...
@@ -173,7 +173,7 @@ static int vid_read_packet(AVFormatContext *s,
173 173
                            AVPacket *pkt)
174 174
 {
175 175
     BVID_DemuxContext *vid = s->priv_data;
176
-    ByteIOContext *pb = &s->pb;
176
+    ByteIOContext *pb = s->pb;
177 177
     unsigned char block_type;
178 178
     int audio_length;
179 179
     int ret_value;
... ...
@@ -56,7 +56,7 @@ static int read_header(AVFormatContext *s,
56 56
                            AVFormatParameters *ap)
57 57
 {
58 58
     AVStream *video;
59
-    ByteIOContext *pb = &s->pb;
59
+    ByteIOContext *pb = s->pb;
60 60
     C93DemuxContext *c93 = s->priv_data;
61 61
     int i;
62 62
     int framecount = 0;
... ...
@@ -101,7 +101,7 @@ static int read_header(AVFormatContext *s,
101 101
 
102 102
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
103 103
 {
104
-    ByteIOContext *pb = &s->pb;
104
+    ByteIOContext *pb = s->pb;
105 105
     C93DemuxContext *c93 = s->priv_data;
106 106
     C93BlockRecord *br = &c93->block_records[c93->current_block];
107 107
     int datasize;
... ...
@@ -48,8 +48,8 @@ static int crc_write_trailer(struct AVFormatContext *s)
48 48
     char buf[64];
49 49
 
50 50
     snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
51
-    put_buffer(&s->pb, buf, strlen(buf));
52
-    put_flush_packet(&s->pb);
51
+    put_buffer(s->pb, buf, strlen(buf));
52
+    put_flush_packet(s->pb);
53 53
     return 0;
54 54
 }
55 55
 
... ...
@@ -34,7 +34,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
34 34
 }
35 35
 
36 36
 static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
37
-    ByteIOContext *pb = &s->pb;
37
+    ByteIOContext *pb = s->pb;
38 38
     int ret, size;
39 39
     if (url_feof(pb))
40 40
         return AVERROR(EIO);
... ...
@@ -94,7 +94,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
94 94
     int rc;
95 95
     CinDemuxContext *cin = s->priv_data;
96 96
     CinFileHeader *hdr = &cin->file_header;
97
-    ByteIOContext *pb = &s->pb;
97
+    ByteIOContext *pb = s->pb;
98 98
     AVStream *st;
99 99
 
100 100
     rc = cin_read_file_header(cin, pb);
... ...
@@ -158,7 +158,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
158 158
 static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
159 159
 {
160 160
     CinDemuxContext *cin = s->priv_data;
161
-    ByteIOContext *pb = &s->pb;
161
+    ByteIOContext *pb = s->pb;
162 162
     CinFrameHeader *hdr = &cin->frame_header;
163 163
     int rc, palette_type, pkt_size;
164 164
 
... ...
@@ -347,7 +347,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
347 347
     // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
348 348
     const DVprofile* sys = dv_codec_profile(c->vst->codec);
349 349
     int64_t offset;
350
-    int64_t size = url_fsize(&s->pb);
350
+    int64_t size = url_fsize(s->pb);
351 351
     int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
352 352
 
353 353
     offset = sys->frame_size * timestamp;
... ...
@@ -386,8 +386,8 @@ static int dv_read_header(AVFormatContext *s,
386 386
     if (!c->dv_demux)
387 387
         return -1;
388 388
 
389
-    if (get_buffer(&s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
390
-        url_fseek(&s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
389
+    if (get_buffer(s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
390
+        url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
391 391
         return AVERROR(EIO);
392 392
 
393 393
     c->dv_demux->sys = dv_frame_profile(c->buf);
... ...
@@ -408,7 +408,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
408 408
 
409 409
     if (size < 0) {
410 410
         size = c->dv_demux->sys->frame_size;
411
-        if (get_buffer(&s->pb, c->buf, size) <= 0)
411
+        if (get_buffer(s->pb, c->buf, size) <= 0)
412 412
             return AVERROR(EIO);
413 413
 
414 414
         size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
... ...
@@ -426,7 +426,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
426 426
 
427 427
     dv_offset_reset(c, offset / c->sys->frame_size);
428 428
 
429
-    offset = url_fseek(&s->pb, offset, SEEK_SET);
429
+    offset = url_fseek(s->pb, offset, SEEK_SET);
430 430
     return (offset < 0)?offset:0;
431 431
 }
432 432
 
... ...
@@ -380,8 +380,8 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
380 380
     fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index],
381 381
                               pkt->data, pkt->size, &frame);
382 382
     if (fsize > 0) {
383
-        put_buffer(&s->pb, frame, fsize);
384
-        put_flush_packet(&s->pb);
383
+        put_buffer(s->pb, frame, fsize);
384
+        put_flush_packet(s->pb);
385 385
     }
386 386
     return 0;
387 387
 }
... ...
@@ -45,7 +45,7 @@ static int dxa_probe(AVProbeData *p)
45 45
 
46 46
 static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
47 47
 {
48
-    ByteIOContext *pb = &s->pb;
48
+    ByteIOContext *pb = s->pb;
49 49
     DXAContext *c = s->priv_data;
50 50
     AVStream *st, *ast;
51 51
     uint32_t tag;
... ...
@@ -144,19 +144,19 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
144 144
 
145 145
     if(!c->readvid && c->has_sound && c->bytes_left){
146 146
         c->readvid = 1;
147
-        url_fseek(&s->pb, c->wavpos, SEEK_SET);
147
+        url_fseek(s->pb, c->wavpos, SEEK_SET);
148 148
         size = FFMIN(c->bytes_left, c->bpc);
149
-        ret = av_get_packet(&s->pb, pkt, size);
149
+        ret = av_get_packet(s->pb, pkt, size);
150 150
         pkt->stream_index = 1;
151 151
         if(ret != size)
152 152
             return AVERROR(EIO);
153 153
         c->bytes_left -= size;
154
-        c->wavpos = url_ftell(&s->pb);
154
+        c->wavpos = url_ftell(s->pb);
155 155
         return 0;
156 156
     }
157
-    url_fseek(&s->pb, c->vidpos, SEEK_SET);
158
-    while(!url_feof(&s->pb) && c->frames){
159
-        get_buffer(&s->pb, buf, 4);
157
+    url_fseek(s->pb, c->vidpos, SEEK_SET);
158
+    while(!url_feof(s->pb) && c->frames){
159
+        get_buffer(s->pb, buf, 4);
160 160
         switch(AV_RL32(buf)){
161 161
         case MKTAG('N', 'U', 'L', 'L'):
162 162
             if(av_new_packet(pkt, 4 + pal_size) < 0)
... ...
@@ -165,16 +165,16 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
165 165
             if(pal_size) memcpy(pkt->data, pal, pal_size);
166 166
             memcpy(pkt->data + pal_size, buf, 4);
167 167
             c->frames--;
168
-            c->vidpos = url_ftell(&s->pb);
168
+            c->vidpos = url_ftell(s->pb);
169 169
             c->readvid = 0;
170 170
             return 0;
171 171
         case MKTAG('C', 'M', 'A', 'P'):
172 172
             pal_size = 768+4;
173 173
             memcpy(pal, buf, 4);
174
-            get_buffer(&s->pb, pal + 4, 768);
174
+            get_buffer(s->pb, pal + 4, 768);
175 175
             break;
176 176
         case MKTAG('F', 'R', 'A', 'M'):
177
-            get_buffer(&s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
177
+            get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
178 178
             size = AV_RB32(buf + 5);
179 179
             if(size > 0xFFFFFF){
180 180
                 av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
... ...
@@ -183,7 +183,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
183 183
             if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
184 184
                 return AVERROR(ENOMEM);
185 185
             memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
186
-            ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
186
+            ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
187 187
             if(ret != size){
188 188
                 av_free_packet(pkt);
189 189
                 return AVERROR(EIO);
... ...
@@ -191,7 +191,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
191 191
             if(pal_size) memcpy(pkt->data, pal, pal_size);
192 192
             pkt->stream_index = 0;
193 193
             c->frames--;
194
-            c->vidpos = url_ftell(&s->pb);
194
+            c->vidpos = url_ftell(s->pb);
195 195
             c->readvid = 0;
196 196
             return 0;
197 197
         default:
... ...
@@ -47,7 +47,7 @@ static int cdata_probe(AVProbeData *p)
47 47
 static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
48 48
 {
49 49
     CdataDemuxContext *cdata = s->priv_data;
50
-    ByteIOContext *pb = &s->pb;
50
+    ByteIOContext *pb = s->pb;
51 51
     unsigned int sample_rate, header;
52 52
     AVStream *st;
53 53
 
... ...
@@ -83,7 +83,7 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
83 83
     CdataDemuxContext *cdata = s->priv_data;
84 84
     int packet_size = 76*cdata->channels;
85 85
 
86
-    if (av_get_packet(&s->pb, pkt, packet_size) != packet_size)
86
+    if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
87 87
         return AVERROR(EIO);
88 88
     pkt->pts = cdata->audio_pts++;
89 89
     return 1;
... ...
@@ -90,7 +90,7 @@ static int process_audio_header_elements(AVFormatContext *s)
90 90
 {
91 91
     int inHeader = 1;
92 92
     EaDemuxContext *ea = s->priv_data;
93
-    ByteIOContext *pb = &s->pb;
93
+    ByteIOContext *pb = s->pb;
94 94
     int compression_type = -1, revision = -1;
95 95
 
96 96
     ea->bytes = 2;
... ...
@@ -188,7 +188,7 @@ static int process_audio_header_elements(AVFormatContext *s)
188 188
 static int process_audio_header_eacs(AVFormatContext *s)
189 189
 {
190 190
     EaDemuxContext *ea = s->priv_data;
191
-    ByteIOContext *pb = &s->pb;
191
+    ByteIOContext *pb = s->pb;
192 192
     int compression_type;
193 193
 
194 194
     ea->sample_rate  = ea->big_endian ? get_be32(pb) : get_le32(pb);
... ...
@@ -220,7 +220,7 @@ static int process_audio_header_eacs(AVFormatContext *s)
220 220
 static int process_audio_header_sead(AVFormatContext *s)
221 221
 {
222 222
     EaDemuxContext *ea = s->priv_data;
223
-    ByteIOContext *pb = &s->pb;
223
+    ByteIOContext *pb = s->pb;
224 224
 
225 225
     ea->sample_rate  = get_le32(pb);
226 226
     ea->bytes        = get_le32(pb);  /* 1=8-bit, 2=16-bit */
... ...
@@ -233,7 +233,7 @@ static int process_audio_header_sead(AVFormatContext *s)
233 233
 static int process_video_header_vp6(AVFormatContext *s)
234 234
 {
235 235
     EaDemuxContext *ea = s->priv_data;
236
-    ByteIOContext *pb = &s->pb;
236
+    ByteIOContext *pb = s->pb;
237 237
 
238 238
     url_fskip(pb, 16);
239 239
     ea->time_base.den = get_le32(pb);
... ...
@@ -250,7 +250,7 @@ static int process_video_header_vp6(AVFormatContext *s)
250 250
 static int process_ea_header(AVFormatContext *s) {
251 251
     uint32_t blockid, size = 0;
252 252
     EaDemuxContext *ea = s->priv_data;
253
-    ByteIOContext *pb = &s->pb;
253
+    ByteIOContext *pb = s->pb;
254 254
     int i;
255 255
 
256 256
     for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
... ...
@@ -370,7 +370,7 @@ static int ea_read_packet(AVFormatContext *s,
370 370
                           AVPacket *pkt)
371 371
 {
372 372
     EaDemuxContext *ea = s->priv_data;
373
-    ByteIOContext *pb = &s->pb;
373
+    ByteIOContext *pb = s->pb;
374 374
     int ret = 0;
375 375
     int packet_read = 0;
376 376
     unsigned int chunk_type, chunk_size;
... ...
@@ -64,7 +64,7 @@ static void flush_packet(AVFormatContext *s)
64 64
 {
65 65
     FFMContext *ffm = s->priv_data;
66 66
     int fill_size, h;
67
-    ByteIOContext *pb = &s->pb;
67
+    ByteIOContext *pb = s->pb;
68 68
 
69 69
     fill_size = ffm->packet_end - ffm->packet_ptr;
70 70
     memset(ffm->packet_ptr, 0, fill_size);
... ...
@@ -128,7 +128,7 @@ static int ffm_write_header(AVFormatContext *s)
128 128
     FFMContext *ffm = s->priv_data;
129 129
     AVStream *st;
130 130
     FFMStream *fst;
131
-    ByteIOContext *pb = &s->pb;
131
+    ByteIOContext *pb = s->pb;
132 132
     AVCodecContext *codec;
133 133
     int bit_rate, i;
134 134
 
... ...
@@ -278,7 +278,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
278 278
 
279 279
 static int ffm_write_trailer(AVFormatContext *s)
280 280
 {
281
-    ByteIOContext *pb = &s->pb;
281
+    ByteIOContext *pb = s->pb;
282 282
     FFMContext *ffm = s->priv_data;
283 283
 
284 284
     /* flush packets */
... ...
@@ -314,7 +314,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
314 314
         if (size <= len)
315 315
             return 1;
316 316
     }
317
-    pos = url_ftell(&s->pb);
317
+    pos = url_ftell(s->pb);
318 318
     if (pos == ffm->write_index) {
319 319
         /* exactly at the end of stream */
320 320
         return 0;
... ...
@@ -335,7 +335,7 @@ static int ffm_read_data(AVFormatContext *s,
335 335
                          uint8_t *buf, int size, int first)
336 336
 {
337 337
     FFMContext *ffm = s->priv_data;
338
-    ByteIOContext *pb = &s->pb;
338
+    ByteIOContext *pb = s->pb;
339 339
     int len, fill_size, size1, frame_offset;
340 340
 
341 341
     size1 = size;
... ...
@@ -393,7 +393,7 @@ static int ffm_read_data(AVFormatContext *s,
393 393
 static void adjust_write_index(AVFormatContext *s)
394 394
 {
395 395
     FFMContext *ffm = s->priv_data;
396
-    ByteIOContext *pb = &s->pb;
396
+    ByteIOContext *pb = s->pb;
397 397
     int64_t pts;
398 398
     //offset_t orig_write_index = ffm->write_index;
399 399
     offset_t pos_min, pos_max;
... ...
@@ -452,7 +452,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
452 452
     FFMContext *ffm = s->priv_data;
453 453
     AVStream *st;
454 454
     FFMStream *fst;
455
-    ByteIOContext *pb = &s->pb;
455
+    ByteIOContext *pb = s->pb;
456 456
     AVCodecContext *codec;
457 457
     int i, nb_streams;
458 458
     uint32_t tag;
... ...
@@ -585,7 +585,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
585 585
         }
586 586
 #if 0
587 587
         printf("pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
588
-               url_ftell(&s->pb), s->pb.pos, ffm->write_index, ffm->file_size);
588
+               url_ftell(s->pb), s->pb.pos, ffm->write_index, ffm->file_size);
589 589
 #endif
590 590
         if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
591 591
             FRAME_HEADER_SIZE)
... ...
@@ -610,7 +610,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
610 610
 
611 611
         av_new_packet(pkt, size);
612 612
         pkt->stream_index = ffm->header[0];
613
-        pkt->pos = url_ftell(&s->pb);
613
+        pkt->pos = url_ftell(s->pb);
614 614
         if (ffm->header[1] & FLAG_KEY_FRAME)
615 615
             pkt->flags |= PKT_FLAG_KEY;
616 616
 
... ...
@@ -638,7 +638,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
638 638
 static void ffm_seek1(AVFormatContext *s, offset_t pos1)
639 639
 {
640 640
     FFMContext *ffm = s->priv_data;
641
-    ByteIOContext *pb = &s->pb;
641
+    ByteIOContext *pb = s->pb;
642 642
     offset_t pos;
643 643
 
644 644
     pos = pos1 + ffm->write_index;
... ...
@@ -652,7 +652,7 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
652 652
 
653 653
 static int64_t get_pts(AVFormatContext *s, offset_t pos)
654 654
 {
655
-    ByteIOContext *pb = &s->pb;
655
+    ByteIOContext *pb = s->pb;
656 656
     int64_t pts;
657 657
 
658 658
     ffm_seek1(s, pos);
... ...
@@ -67,7 +67,7 @@ static int flic_read_header(AVFormatContext *s,
67 67
                             AVFormatParameters *ap)
68 68
 {
69 69
     FlicDemuxContext *flic = s->priv_data;
70
-    ByteIOContext *pb = &s->pb;
70
+    ByteIOContext *pb = s->pb;
71 71
     unsigned char header[FLIC_HEADER_SIZE];
72 72
     AVStream *st;
73 73
     int speed;
... ...
@@ -142,7 +142,7 @@ static int flic_read_packet(AVFormatContext *s,
142 142
                             AVPacket *pkt)
143 143
 {
144 144
     FlicDemuxContext *flic = s->priv_data;
145
-    ByteIOContext *pb = &s->pb;
145
+    ByteIOContext *pb = s->pb;
146 146
     int packet_read = 0;
147 147
     unsigned int size;
148 148
     int magic;
... ...
@@ -71,7 +71,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
71 71
                 vcodec->extradata_size = 1;
72 72
                 vcodec->extradata = av_malloc(1);
73 73
             }
74
-            vcodec->extradata[0] = get_byte(&s->pb);
74
+            vcodec->extradata[0] = get_byte(s->pb);
75 75
             return 1; // 1 byte body size adjustment for flv_read_packet()
76 76
         default:
77 77
             av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid);
... ...
@@ -103,7 +103,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
103 103
     double num_val;
104 104
 
105 105
     num_val = 0;
106
-    ioc = &s->pb;
106
+    ioc = s->pb;
107 107
 
108 108
     amf_type = get_byte(ioc);
109 109
 
... ...
@@ -203,7 +203,7 @@ static int flv_read_metabody(AVFormatContext *s, unsigned int next_pos) {
203 203
     astream = NULL;
204 204
     vstream = NULL;
205 205
     keylen = 0;
206
-    ioc = &s->pb;
206
+    ioc = s->pb;
207 207
 
208 208
     //first object needs to be "onMetaData" string
209 209
     type = get_byte(ioc);
... ...
@@ -238,8 +238,8 @@ static int flv_read_header(AVFormatContext *s,
238 238
 {
239 239
     int offset, flags;
240 240
 
241
-    url_fskip(&s->pb, 4);
242
-    flags = get_byte(&s->pb);
241
+    url_fskip(s->pb, 4);
242
+    flags = get_byte(s->pb);
243 243
     /* old flvtool cleared this field */
244 244
     /* FIXME: better fix needed */
245 245
     if (!flags) {
... ...
@@ -256,8 +256,8 @@ static int flv_read_header(AVFormatContext *s,
256 256
             return AVERROR(ENOMEM);
257 257
     }
258 258
 
259
-    offset = get_be32(&s->pb);
260
-    url_fseek(&s->pb, offset, SEEK_SET);
259
+    offset = get_be32(s->pb);
260
+    url_fseek(s->pb, offset, SEEK_SET);
261 261
 
262 262
     s->start_time = 0;
263 263
 
... ...
@@ -270,35 +270,35 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
270 270
     AVStream *st = NULL;
271 271
 
272 272
  for(;;){
273
-    pos = url_ftell(&s->pb);
274
-    url_fskip(&s->pb, 4); /* size of previous packet */
275
-    type = get_byte(&s->pb);
276
-    size = get_be24(&s->pb);
277
-    pts = get_be24(&s->pb);
278
-    pts |= get_byte(&s->pb) << 24;
273
+    pos = url_ftell(s->pb);
274
+    url_fskip(s->pb, 4); /* size of previous packet */
275
+    type = get_byte(s->pb);
276
+    size = get_be24(s->pb);
277
+    pts = get_be24(s->pb);
278
+    pts |= get_byte(s->pb) << 24;
279 279
 //    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
280
-    if (url_feof(&s->pb))
280
+    if (url_feof(s->pb))
281 281
         return AVERROR(EIO);
282
-    url_fskip(&s->pb, 3); /* stream id, always 0 */
282
+    url_fskip(s->pb, 3); /* stream id, always 0 */
283 283
     flags = 0;
284 284
 
285 285
     if(size == 0)
286 286
         continue;
287 287
 
288
-    next= size + url_ftell(&s->pb);
288
+    next= size + url_ftell(s->pb);
289 289
 
290 290
     if (type == FLV_TAG_TYPE_AUDIO) {
291 291
         is_audio=1;
292
-        flags = get_byte(&s->pb);
292
+        flags = get_byte(s->pb);
293 293
     } else if (type == FLV_TAG_TYPE_VIDEO) {
294 294
         is_audio=0;
295
-        flags = get_byte(&s->pb);
295
+        flags = get_byte(s->pb);
296 296
     } else {
297 297
         if (type == FLV_TAG_TYPE_META && size > 13+1+4)
298 298
             flv_read_metabody(s, next);
299 299
         else /* skip packet */
300 300
             av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
301
-        url_fseek(&s->pb, next, SEEK_SET);
301
+        url_fseek(s->pb, next, SEEK_SET);
302 302
         continue;
303 303
     }
304 304
 
... ...
@@ -317,7 +317,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
317 317
        ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
318 318
        || st->discard >= AVDISCARD_ALL
319 319
        ){
320
-        url_fseek(&s->pb, next, SEEK_SET);
320
+        url_fseek(s->pb, next, SEEK_SET);
321 321
         continue;
322 322
     }
323 323
     if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
... ...
@@ -326,17 +326,17 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
326 326
  }
327 327
 
328 328
     // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
329
-    if(!url_is_streamed(&s->pb) && s->duration==AV_NOPTS_VALUE){
329
+    if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){
330 330
         int size;
331
-        const int pos= url_ftell(&s->pb);
332
-        const int fsize= url_fsize(&s->pb);
333
-        url_fseek(&s->pb, fsize-4, SEEK_SET);
334
-        size= get_be32(&s->pb);
335
-        url_fseek(&s->pb, fsize-3-size, SEEK_SET);
336
-        if(size == get_be24(&s->pb) + 11){
337
-            s->duration= get_be24(&s->pb) * (int64_t)AV_TIME_BASE / 1000;
331
+        const int pos= url_ftell(s->pb);
332
+        const int fsize= url_fsize(s->pb);
333
+        url_fseek(s->pb, fsize-4, SEEK_SET);
334
+        size= get_be32(s->pb);
335
+        url_fseek(s->pb, fsize-3-size, SEEK_SET);
336
+        if(size == get_be24(s->pb) + 11){
337
+            s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000;
338 338
         }
339
-        url_fseek(&s->pb, pos, SEEK_SET);
339
+        url_fseek(s->pb, pos, SEEK_SET);
340 340
     }
341 341
 
342 342
     if(is_audio){
... ...
@@ -353,7 +353,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
353 353
         size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
354 354
     }
355 355
 
356
-    ret= av_get_packet(&s->pb, pkt, size - 1);
356
+    ret= av_get_packet(s->pb, pkt, size - 1);
357 357
     if (ret <= 0) {
358 358
         return AVERROR(EIO);
359 359
     }
... ...
@@ -380,7 +380,7 @@ static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
380 380
     int index = av_index_search_timestamp(st, timestamp, flags);
381 381
     if (index < 0)
382 382
         return -1;
383
-    url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
383
+    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
384 384
 
385 385
     return 0;
386 386
 }
... ...
@@ -126,7 +126,7 @@ static void put_amf_bool(ByteIOContext *pb, int b) {
126 126
 
127 127
 static int flv_write_header(AVFormatContext *s)
128 128
 {
129
-    ByteIOContext *pb = &s->pb;
129
+    ByteIOContext *pb = s->pb;
130 130
     FLVContext *flv = s->priv_data;
131 131
     int i, width, height, samplerate, samplesize, channels, audiocodecid, videocodecid;
132 132
     double framerate = 0.0;
... ...
@@ -256,7 +256,7 @@ static int flv_write_trailer(AVFormatContext *s)
256 256
 {
257 257
     int64_t file_size;
258 258
 
259
-    ByteIOContext *pb = &s->pb;
259
+    ByteIOContext *pb = s->pb;
260 260
     FLVContext *flv = s->priv_data;
261 261
 
262 262
     file_size = url_ftell(pb);
... ...
@@ -273,7 +273,7 @@ static int flv_write_trailer(AVFormatContext *s)
273 273
 
274 274
 static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
275 275
 {
276
-    ByteIOContext *pb = &s->pb;
276
+    ByteIOContext *pb = s->pb;
277 277
     AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
278 278
     FLVContext *flv = s->priv_data;
279 279
     int size= pkt->size;
... ...
@@ -27,8 +27,8 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
27 27
     char buf[256];
28 28
 
29 29
     snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
30
-    put_buffer(&s->pb, buf, strlen(buf));
31
-    put_flush_packet(&s->pb);
30
+    put_buffer(s->pb, buf, strlen(buf));
31
+    put_flush_packet(s->pb);
32 32
     return 0;
33 33
 }
34 34
 
... ...
@@ -313,7 +313,7 @@ typedef struct {
313 313
 static int gif_write_header(AVFormatContext *s)
314 314
 {
315 315
     GIFContext *gif = s->priv_data;
316
-    ByteIOContext *pb = &s->pb;
316
+    ByteIOContext *pb = s->pb;
317 317
     AVCodecContext *enc, *video_enc;
318 318
     int i, width, height, loop_count /*, rate*/;
319 319
 
... ...
@@ -348,14 +348,14 @@ static int gif_write_header(AVFormatContext *s)
348 348
 
349 349
     gif_image_write_header(pb, width, height, loop_count, NULL);
350 350
 
351
-    put_flush_packet(&s->pb);
351
+    put_flush_packet(s->pb);
352 352
     return 0;
353 353
 }
354 354
 
355 355
 static int gif_write_video(AVFormatContext *s,
356 356
                            AVCodecContext *enc, const uint8_t *buf, int size)
357 357
 {
358
-    ByteIOContext *pb = &s->pb;
358
+    ByteIOContext *pb = s->pb;
359 359
     GIFContext *gif = s->priv_data;
360 360
     int jiffies;
361 361
     int64_t delay;
... ...
@@ -383,7 +383,7 @@ static int gif_write_video(AVFormatContext *s,
383 383
     gif_image_write_image(pb, 0, 0, enc->width, enc->height,
384 384
                           buf, enc->width * 3, PIX_FMT_RGB24);
385 385
 
386
-    put_flush_packet(&s->pb);
386
+    put_flush_packet(s->pb);
387 387
     return 0;
388 388
 }
389 389
 
... ...
@@ -398,10 +398,10 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
398 398
 
399 399
 static int gif_write_trailer(AVFormatContext *s)
400 400
 {
401
-    ByteIOContext *pb = &s->pb;
401
+    ByteIOContext *pb = s->pb;
402 402
 
403 403
     put_byte(pb, 0x3b);
404
-    put_flush_packet(&s->pb);
404
+    put_flush_packet(s->pb);
405 405
     return 0;
406 406
 }
407 407
 
... ...
@@ -526,7 +526,7 @@ static int gif_read_header(AVFormatContext * s1,
526 526
                            AVFormatParameters * ap)
527 527
 {
528 528
     GifState *s = s1->priv_data;
529
-    ByteIOContext *f = &s1->pb;
529
+    ByteIOContext *f = s1->pb;
530 530
     AVStream *st;
531 531
 
532 532
     s->f = f;
... ...
@@ -228,7 +228,7 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, st_info_t *si) {
228 228
  * \brief read index from FLT packet into stream 0 av_index
229 229
  */
230 230
 static void gxf_read_index(AVFormatContext *s, int pkt_len) {
231
-    ByteIOContext *pb = &s->pb;
231
+    ByteIOContext *pb = s->pb;
232 232
     AVStream *st = s->streams[0];
233 233
     uint32_t fields_per_map = get_le32(pb);
234 234
     uint32_t map_cnt = get_le32(pb);
... ...
@@ -252,7 +252,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
252 252
 }
253 253
 
254 254
 static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
255
-    ByteIOContext *pb = &s->pb;
255
+    ByteIOContext *pb = s->pb;
256 256
     pkt_type_t pkt_type;
257 257
     int map_len;
258 258
     int len;
... ...
@@ -378,7 +378,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t
378 378
     int cur_track;
379 379
     int64_t cur_timestamp = AV_NOPTS_VALUE;
380 380
     int len;
381
-    ByteIOContext *pb = &s->pb;
381
+    ByteIOContext *pb = s->pb;
382 382
     pkt_type_t type;
383 383
     tmp = get_be32(pb);
384 384
 start:
... ...
@@ -408,7 +408,7 @@ out:
408 408
 }
409 409
 
410 410
 static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
411
-    ByteIOContext *pb = &s->pb;
411
+    ByteIOContext *pb = s->pb;
412 412
     pkt_type_t pkt_type;
413 413
     int pkt_len;
414 414
     while (!url_feof(pb)) {
... ...
@@ -466,7 +466,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
466 466
     if (idx < st->nb_index_entries - 2)
467 467
         maxlen = st->index_entries[idx + 2].pos - pos;
468 468
     maxlen = FFMAX(maxlen, 200 * 1024);
469
-    url_fseek(&s->pb, pos, SEEK_SET);
469
+    url_fseek(s->pb, pos, SEEK_SET);
470 470
     found = gxf_resync_media(s, maxlen, -1, timestamp);
471 471
     if (FFABS(found - timestamp) > 4)
472 472
         return -1;
... ...
@@ -475,7 +475,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
475 475
 
476 476
 static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
477 477
                                   int64_t *pos, int64_t pos_limit) {
478
-    ByteIOContext *pb = &s->pb;
478
+    ByteIOContext *pb = s->pb;
479 479
     int64_t res;
480 480
     url_fseek(pb, *pos, SEEK_SET);
481 481
     res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
... ...
@@ -576,7 +576,7 @@ static int gxf_write_umf_packet(ByteIOContext *pb, GXFContext *ctx)
576 576
 
577 577
 static int gxf_write_header(AVFormatContext *s)
578 578
 {
579
-    ByteIOContext *pb = &s->pb;
579
+    ByteIOContext *pb = s->pb;
580 580
     GXFContext *gxf = s->priv_data;
581 581
     int i;
582 582
 
... ...
@@ -671,7 +671,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb, GXFContext *ctx)
671 671
 
672 672
 static int gxf_write_trailer(AVFormatContext *s)
673 673
 {
674
-    ByteIOContext *pb = &s->pb;
674
+    ByteIOContext *pb = s->pb;
675 675
     GXFContext *gxf = s->priv_data;
676 676
     offset_t end;
677 677
     int i;
... ...
@@ -763,8 +763,8 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
763 763
 {
764 764
     GXFContext *gxf = s->priv_data;
765 765
 
766
-    gxf_write_media_packet(&s->pb, gxf, pkt);
767
-    put_flush_packet(&s->pb);
766
+    gxf_write_media_packet(s->pb, gxf, pkt);
767
+    put_flush_packet(s->pb);
768 768
     return 0;
769 769
 }
770 770
 
... ...
@@ -136,7 +136,7 @@ static int idcin_probe(AVProbeData *p)
136 136
 static int idcin_read_header(AVFormatContext *s,
137 137
                              AVFormatParameters *ap)
138 138
 {
139
-    ByteIOContext *pb = &s->pb;
139
+    ByteIOContext *pb = s->pb;
140 140
     IdcinDemuxContext *idcin = s->priv_data;
141 141
     AVStream *st;
142 142
     unsigned int width, height;
... ...
@@ -215,13 +215,13 @@ static int idcin_read_packet(AVFormatContext *s,
215 215
     unsigned int command;
216 216
     unsigned int chunk_size;
217 217
     IdcinDemuxContext *idcin = s->priv_data;
218
-    ByteIOContext *pb = &s->pb;
218
+    ByteIOContext *pb = s->pb;
219 219
     int i;
220 220
     int palette_scale;
221 221
     unsigned char r, g, b;
222 222
     unsigned char palette_buffer[768];
223 223
 
224
-    if (url_feof(&s->pb))
224
+    if (url_feof(s->pb))
225 225
         return AVERROR(EIO);
226 226
 
227 227
     if (idcin->next_chunk_is_video) {
... ...
@@ -69,7 +69,7 @@ static int roq_read_header(AVFormatContext *s,
69 69
                            AVFormatParameters *ap)
70 70
 {
71 71
     RoqDemuxContext *roq = s->priv_data;
72
-    ByteIOContext *pb = &s->pb;
72
+    ByteIOContext *pb = s->pb;
73 73
     AVStream *st;
74 74
     unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
75 75
     int i;
... ...
@@ -174,7 +174,7 @@ static int roq_read_packet(AVFormatContext *s,
174 174
                            AVPacket *pkt)
175 175
 {
176 176
     RoqDemuxContext *roq = s->priv_data;
177
-    ByteIOContext *pb = &s->pb;
177
+    ByteIOContext *pb = s->pb;
178 178
     int ret = 0;
179 179
     unsigned int chunk_size;
180 180
     unsigned int chunk_type;
... ...
@@ -185,7 +185,7 @@ static int roq_read_packet(AVFormatContext *s,
185 185
 
186 186
     while (!packet_read) {
187 187
 
188
-        if (url_feof(&s->pb))
188
+        if (url_feof(s->pb))
189 189
             return AVERROR(EIO);
190 190
 
191 191
         /* get the next chunk preamble */
... ...
@@ -239,7 +239,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
239 239
     char filename[1024];
240 240
     int i;
241 241
     int size[3]={0}, ret[3]={0};
242
-    ByteIOContext f1[3], *f[3]= {&f1[0], &f1[1], &f1[2]};
242
+    ByteIOContext *f[3];
243 243
     AVCodecContext *codec= s1->streams[0]->codec;
244 244
 
245 245
     if (!s->is_pipe) {
... ...
@@ -251,7 +251,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
251 251
                                   s->path, s->img_number)<0 && s->img_number > 1)
252 252
             return AVERROR(EIO);
253 253
         for(i=0; i<3; i++){
254
-            if (url_fopen(f[i], filename, URL_RDONLY) < 0)
254
+            if (url_fopen(&f[i], filename, URL_RDONLY) < 0)
255 255
                 return AVERROR(EIO);
256 256
             size[i]= url_fsize(f[i]);
257 257
 
... ...
@@ -263,7 +263,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
263 263
         if(codec->codec_id == CODEC_ID_RAWVIDEO && !codec->width)
264 264
             infer_size(&codec->width, &codec->height, size[0]);
265 265
     } else {
266
-        f[0] = &s1->pb;
266
+        f[0] = s1->pb;
267 267
         if (url_feof(f[0]))
268 268
             return AVERROR(EIO);
269 269
         size[0]= 4096;
... ...
@@ -322,7 +322,7 @@ static int img_write_header(AVFormatContext *s)
322 322
 static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
323 323
 {
324 324
     VideoData *img = s->priv_data;
325
-    ByteIOContext pb1[3], *pb[3]= {&pb1[0], &pb1[1], &pb1[2]};
325
+    ByteIOContext *pb[3];
326 326
     char filename[1024];
327 327
     AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
328 328
     int i;
... ...
@@ -332,7 +332,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
332 332
                                   img->path, img->img_number) < 0 && img->img_number>1)
333 333
             return AVERROR(EIO);
334 334
         for(i=0; i<3; i++){
335
-            if (url_fopen(pb[i], filename, URL_WRONLY) < 0)
335
+            if (url_fopen(&pb[i], filename, URL_WRONLY) < 0)
336 336
                 return AVERROR(EIO);
337 337
 
338 338
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
... ...
@@ -340,7 +340,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
340 340
             filename[ strlen(filename) - 1 ]= 'U' + i;
341 341
         }
342 342
     } else {
343
-        pb[0] = &s->pb;
343
+        pb[0] = s->pb;
344 344
     }
345 345
 
346 346
     if(codec->codec_id == CODEC_ID_RAWVIDEO){
... ...
@@ -517,7 +517,7 @@ static int ipmovie_read_header(AVFormatContext *s,
517 517
                                AVFormatParameters *ap)
518 518
 {
519 519
     IPMVEContext *ipmovie = s->priv_data;
520
-    ByteIOContext *pb = &s->pb;
520
+    ByteIOContext *pb = s->pb;
521 521
     AVPacket pkt;
522 522
     AVStream *st;
523 523
     unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
... ...
@@ -589,7 +589,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
589 589
                                AVPacket *pkt)
590 590
 {
591 591
     IPMVEContext *ipmovie = s->priv_data;
592
-    ByteIOContext *pb = &s->pb;
592
+    ByteIOContext *pb = s->pb;
593 593
     int ret;
594 594
 
595 595
     ret = process_ipmovie_chunk(ipmovie, pb, pkt);
... ...
@@ -54,7 +54,7 @@ static int av_write(void * h, size_t len, const uint8_t * buf) {
54 54
 
55 55
 static int nut_write_header(AVFormatContext * avf) {
56 56
     NUTContext * priv = avf->priv_data;
57
-    ByteIOContext * bc = &avf->pb;
57
+    ByteIOContext * bc = avf->pb;
58 58
     nut_muxer_opts_t mopts = {
59 59
         .output = {
60 60
             .priv = bc,
... ...
@@ -137,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
137 137
 }
138 138
 
139 139
 static int nut_write_trailer(AVFormatContext * avf) {
140
-    ByteIOContext * bc = &avf->pb;
140
+    ByteIOContext * bc = avf->pb;
141 141
     NUTContext * priv = avf->priv_data;
142 142
     int i;
143 143
 
... ...
@@ -187,7 +187,7 @@ static off_t av_seek(void * h, long long pos, int whence) {
187 187
 
188 188
 static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
189 189
     NUTContext * priv = avf->priv_data;
190
-    ByteIOContext * bc = &avf->pb;
190
+    ByteIOContext * bc = avf->pb;
191 191
     nut_demuxer_opts_t dopts = {
192 192
         .input = {
193 193
             .priv = bc,
... ...
@@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
272 272
     if (pd.flags & NUT_FLAG_KEY) pkt->flags |= PKT_FLAG_KEY;
273 273
     pkt->pts = pd.pts;
274 274
     pkt->stream_index = pd.stream;
275
-    pkt->pos = url_ftell(&avf->pb);
275
+    pkt->pos = url_ftell(avf->pb);
276 276
 
277 277
     ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
278 278
 
... ...
@@ -176,7 +176,7 @@ typedef struct MatroskaDemuxContext {
176 176
 static int
177 177
 ebml_read_element_level_up (MatroskaDemuxContext *matroska)
178 178
 {
179
-    ByteIOContext *pb = &matroska->ctx->pb;
179
+    ByteIOContext *pb = matroska->ctx->pb;
180 180
     offset_t pos = url_ftell(pb);
181 181
     int num = 0;
182 182
 
... ...
@@ -208,7 +208,7 @@ ebml_read_num (MatroskaDemuxContext *matroska,
208 208
                int                   max_size,
209 209
                uint64_t             *number)
210 210
 {
211
-    ByteIOContext *pb = &matroska->ctx->pb;
211
+    ByteIOContext *pb = matroska->ctx->pb;
212 212
     int len_mask = 0x80, read = 1, n = 1;
213 213
     int64_t total = 0;
214 214
 
... ...
@@ -325,7 +325,7 @@ static int
325 325
 ebml_read_seek (MatroskaDemuxContext *matroska,
326 326
                 offset_t              offset)
327 327
 {
328
-    ByteIOContext *pb = &matroska->ctx->pb;
328
+    ByteIOContext *pb = matroska->ctx->pb;
329 329
 
330 330
     /* clear ID cache, if any */
331 331
     matroska->peek_id = 0;
... ...
@@ -341,7 +341,7 @@ ebml_read_seek (MatroskaDemuxContext *matroska,
341 341
 static int
342 342
 ebml_read_skip (MatroskaDemuxContext *matroska)
343 343
 {
344
-    ByteIOContext *pb = &matroska->ctx->pb;
344
+    ByteIOContext *pb = matroska->ctx->pb;
345 345
     uint32_t id;
346 346
     uint64_t length;
347 347
     int res;
... ...
@@ -365,7 +365,7 @@ ebml_read_uint (MatroskaDemuxContext *matroska,
365 365
                 uint32_t             *id,
366 366
                 uint64_t             *num)
367 367
 {
368
-    ByteIOContext *pb = &matroska->ctx->pb;
368
+    ByteIOContext *pb = matroska->ctx->pb;
369 369
     int n = 0, size, res;
370 370
     uint64_t rlength;
371 371
 
... ...
@@ -399,7 +399,7 @@ ebml_read_sint (MatroskaDemuxContext *matroska,
399 399
                 uint32_t             *id,
400 400
                 int64_t              *num)
401 401
 {
402
-    ByteIOContext *pb = &matroska->ctx->pb;
402
+    ByteIOContext *pb = matroska->ctx->pb;
403 403
     int size, n = 1, negative = 0, res;
404 404
     uint64_t rlength;
405 405
 
... ...
@@ -438,7 +438,7 @@ ebml_read_float (MatroskaDemuxContext *matroska,
438 438
                  uint32_t             *id,
439 439
                  double               *num)
440 440
 {
441
-    ByteIOContext *pb = &matroska->ctx->pb;
441
+    ByteIOContext *pb = matroska->ctx->pb;
442 442
     int size, res;
443 443
     uint64_t rlength;
444 444
 
... ...
@@ -472,7 +472,7 @@ ebml_read_ascii (MatroskaDemuxContext *matroska,
472 472
                  uint32_t             *id,
473 473
                  char                **str)
474 474
 {
475
-    ByteIOContext *pb = &matroska->ctx->pb;
475
+    ByteIOContext *pb = matroska->ctx->pb;
476 476
     int size, res;
477 477
     uint64_t rlength;
478 478
 
... ...
@@ -534,7 +534,7 @@ static int
534 534
 ebml_read_master (MatroskaDemuxContext *matroska,
535 535
                   uint32_t             *id)
536 536
 {
537
-    ByteIOContext *pb = &matroska->ctx->pb;
537
+    ByteIOContext *pb = matroska->ctx->pb;
538 538
     uint64_t length;
539 539
     MatroskaLevel *level;
540 540
     int res;
... ...
@@ -569,7 +569,7 @@ ebml_read_binary (MatroskaDemuxContext *matroska,
569 569
                   uint8_t             **binary,
570 570
                   int                  *size)
571 571
 {
572
-    ByteIOContext *pb = &matroska->ctx->pb;
572
+    ByteIOContext *pb = matroska->ctx->pb;
573 573
     uint64_t rlength;
574 574
     int res;
575 575
 
... ...
@@ -1748,7 +1748,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1748 1748
 
1749 1749
                         /* remember the peeked ID and the current position */
1750 1750
                         peek_id_cache = matroska->peek_id;
1751
-                        before_pos = url_ftell(&matroska->ctx->pb);
1751
+                        before_pos = url_ftell(matroska->ctx->pb);
1752 1752
 
1753 1753
                         /* seek */
1754 1754
                         if ((res = ebml_read_seek(matroska, seek_pos +
... ...
@@ -1788,14 +1788,14 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1788 1788
                         switch (id) {
1789 1789
                             case MATROSKA_ID_CUES:
1790 1790
                                 if (!(res = matroska_parse_index(matroska)) ||
1791
-                                    url_feof(&matroska->ctx->pb)) {
1791
+                                    url_feof(matroska->ctx->pb)) {
1792 1792
                                     matroska->index_parsed = 1;
1793 1793
                                     res = 0;
1794 1794
                                 }
1795 1795
                                 break;
1796 1796
                             case MATROSKA_ID_TAGS:
1797 1797
                                 if (!(res = matroska_parse_metadata(matroska)) ||
1798
-                                   url_feof(&matroska->ctx->pb)) {
1798
+                                   url_feof(matroska->ctx->pb)) {
1799 1799
                                     matroska->metadata_parsed = 1;
1800 1800
                                     res = 0;
1801 1801
                                 }
... ...
@@ -1931,7 +1931,7 @@ matroska_read_header (AVFormatContext    *s,
1931 1931
      * after the segment ID/length. */
1932 1932
     if ((res = ebml_read_master(matroska, &id)) < 0)
1933 1933
         return res;
1934
-    matroska->segment_start = url_ftell(&s->pb);
1934
+    matroska->segment_start = url_ftell(s->pb);
1935 1935
 
1936 1936
     matroska->time_scale = 1000000;
1937 1937
     /* we've found our segment, start reading the different contents in here */
... ...
@@ -2485,7 +2485,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
2485 2485
              * of the harder things, so this code is a bit complicated.
2486 2486
              * See http://www.matroska.org/ for documentation. */
2487 2487
             case MATROSKA_ID_BLOCK: {
2488
-                pos = url_ftell(&matroska->ctx->pb);
2488
+                pos = url_ftell(matroska->ctx->pb);
2489 2489
                 res = ebml_read_binary(matroska, &id, &data, &size);
2490 2490
                 break;
2491 2491
             }
... ...
@@ -2547,7 +2547,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
2547 2547
     int size;
2548 2548
 
2549 2549
     av_log(matroska->ctx, AV_LOG_DEBUG,
2550
-           "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb));
2550
+           "parsing cluster at %"PRId64"\n", url_ftell(matroska->ctx->pb));
2551 2551
 
2552 2552
     while (res == 0) {
2553 2553
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
... ...
@@ -2576,7 +2576,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
2576 2576
                 break;
2577 2577
 
2578 2578
             case MATROSKA_ID_SIMPLEBLOCK:
2579
-                pos = url_ftell(&matroska->ctx->pb);
2579
+                pos = url_ftell(matroska->ctx->pb);
2580 2580
                 res = ebml_read_binary(matroska, &id, &data, &size);
2581 2581
                 if (res == 0)
2582 2582
                     res = matroska_parse_block(matroska, data, size, pos,
... ...
@@ -2668,7 +2668,7 @@ matroska_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp,
2668 2668
         return 0;
2669 2669
 
2670 2670
     /* do the seek */
2671
-    url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
2671
+    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
2672 2672
     matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
2673 2673
     matroska->skip_to_stream = st;
2674 2674
     matroska->num_packets = 0;
... ...
@@ -466,19 +466,21 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int
466 466
 
467 467
 static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id)
468 468
 {
469
-    ByteIOContext dyn_cp;
469
+    ByteIOContext *dyn_cp;
470 470
     uint8_t *codecpriv;
471
-    int ret = 0, codecpriv_size;
471
+    int ret, codecpriv_size;
472 472
 
473
-    url_open_dyn_buf(&dyn_cp);
473
+    ret = url_open_dyn_buf(&dyn_cp);
474
+    if(ret < 0)
475
+        return ret;
474 476
 
475 477
     if (native_id) {
476 478
         if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA)
477
-            ret = put_xiph_codecpriv(s, &dyn_cp, codec);
479
+            ret = put_xiph_codecpriv(s, dyn_cp, codec);
478 480
         else if (codec->codec_id == CODEC_ID_FLAC)
479
-            ret = put_flac_codecpriv(s, &dyn_cp, codec);
481
+            ret = put_flac_codecpriv(s, dyn_cp, codec);
480 482
         else if (codec->extradata_size)
481
-            put_buffer(&dyn_cp, codec->extradata, codec->extradata_size);
483
+            put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
482 484
     } else if (codec->codec_type == CODEC_TYPE_VIDEO) {
483 485
         if (!codec->codec_tag)
484 486
             codec->codec_tag = codec_get_tag(codec_bmp_tags, codec->codec_id);
... ...
@@ -487,7 +489,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
487 487
             ret = -1;
488 488
         }
489 489
 
490
-        put_bmp_header(&dyn_cp, codec, codec_bmp_tags, 0);
490
+        put_bmp_header(dyn_cp, codec, codec_bmp_tags, 0);
491 491
 
492 492
     } else if (codec->codec_type == CODEC_TYPE_AUDIO) {
493 493
         if (!codec->codec_tag)
... ...
@@ -497,10 +499,10 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
497 497
             ret = -1;
498 498
         }
499 499
 
500
-        put_wav_header(&dyn_cp, codec);
500
+        put_wav_header(dyn_cp, codec);
501 501
     }
502 502
 
503
-    codecpriv_size = url_close_dyn_buf(&dyn_cp, &codecpriv);
503
+    codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
504 504
     if (codecpriv_size)
505 505
         put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
506 506
     av_free(codecpriv);
... ...
@@ -510,7 +512,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
510 510
 static int mkv_write_tracks(AVFormatContext *s)
511 511
 {
512 512
     MatroskaMuxContext *mkv = s->priv_data;
513
-    ByteIOContext *pb = &s->pb;
513
+    ByteIOContext *pb = s->pb;
514 514
     ebml_master tracks;
515 515
     int i, j, ret;
516 516
 
... ...
@@ -613,7 +615,7 @@ static int mkv_write_tracks(AVFormatContext *s)
613 613
 static int mkv_write_header(AVFormatContext *s)
614 614
 {
615 615
     MatroskaMuxContext *mkv = s->priv_data;
616
-    ByteIOContext *pb = &s->pb;
616
+    ByteIOContext *pb = s->pb;
617 617
     ebml_master ebml_header, segment_info;
618 618
     int ret;
619 619
 
... ...
@@ -703,7 +705,7 @@ static int mkv_blockgroup_size(AVPacket *pkt)
703 703
 static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *pkt, int flags)
704 704
 {
705 705
     MatroskaMuxContext *mkv = s->priv_data;
706
-    ByteIOContext *pb = &s->pb;
706
+    ByteIOContext *pb = s->pb;
707 707
 
708 708
     av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
709 709
            "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
... ...
@@ -719,7 +721,7 @@ static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *
719 719
 static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
720 720
 {
721 721
     MatroskaMuxContext *mkv = s->priv_data;
722
-    ByteIOContext *pb = &s->pb;
722
+    ByteIOContext *pb = s->pb;
723 723
     AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
724 724
     int keyframe = !!(pkt->flags & PKT_FLAG_KEY);
725 725
     int ret;
... ...
@@ -761,7 +763,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
761 761
 static int mkv_write_trailer(AVFormatContext *s)
762 762
 {
763 763
     MatroskaMuxContext *mkv = s->priv_data;
764
-    ByteIOContext *pb = &s->pb;
764
+    ByteIOContext *pb = s->pb;
765 765
     offset_t currentpos, second_seekhead, cuespos;
766 766
     int ret;
767 767
 
... ...
@@ -72,7 +72,7 @@ static int mm_read_header(AVFormatContext *s,
72 72
                            AVFormatParameters *ap)
73 73
 {
74 74
     MmDemuxContext *mm = s->priv_data;
75
-    ByteIOContext *pb = &s->pb;
75
+    ByteIOContext *pb = s->pb;
76 76
     AVStream *st;
77 77
 
78 78
     unsigned int type, length;
... ...
@@ -127,7 +127,7 @@ static int mm_read_packet(AVFormatContext *s,
127 127
                            AVPacket *pkt)
128 128
 {
129 129
     MmDemuxContext *mm = s->priv_data;
130
-    ByteIOContext *pb = &s->pb;
130
+    ByteIOContext *pb = s->pb;
131 131
     unsigned char preamble[MM_PREAMBLE_SIZE];
132 132
     unsigned char pal[MM_PALETTE_SIZE];
133 133
     unsigned int type, length;
... ...
@@ -178,7 +178,7 @@ static int mm_read_packet(AVFormatContext *s,
178 178
             return 0;
179 179
 
180 180
         case MM_TYPE_AUDIO :
181
-            if (av_get_packet(&s->pb, pkt, length)<0)
181
+            if (av_get_packet(s->pb, pkt, length)<0)
182 182
                 return AVERROR(ENOMEM);
183 183
             pkt->size = length;
184 184
             pkt->stream_index = 1;
... ...
@@ -60,7 +60,7 @@ static void end_tag_be(ByteIOContext *pb, offset_t start)
60 60
 static int mmf_write_header(AVFormatContext *s)
61 61
 {
62 62
     MMFContext *mmf = s->priv_data;
63
-    ByteIOContext *pb = &s->pb;
63
+    ByteIOContext *pb = s->pb;
64 64
     offset_t pos;
65 65
     int rate;
66 66
 
... ...
@@ -108,7 +108,7 @@ static int mmf_write_header(AVFormatContext *s)
108 108
 
109 109
 static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
110 110
 {
111
-    ByteIOContext *pb = &s->pb;
111
+    ByteIOContext *pb = s->pb;
112 112
     put_buffer(pb, pkt->data, pkt->size);
113 113
     return 0;
114 114
 }
... ...
@@ -127,12 +127,12 @@ static void put_varlength(ByteIOContext *pb, int val)
127 127
 
128 128
 static int mmf_write_trailer(AVFormatContext *s)
129 129
 {
130
-    ByteIOContext *pb = &s->pb;
130
+    ByteIOContext *pb = s->pb;
131 131
     MMFContext *mmf = s->priv_data;
132 132
     offset_t pos, size;
133 133
     int gatetime;
134 134
 
135
-    if (!url_is_streamed(&s->pb)) {
135
+    if (!url_is_streamed(s->pb)) {
136 136
         /* Fill in length fields */
137 137
         end_tag_be(pb, mmf->awapos);
138 138
         end_tag_be(pb, mmf->atrpos);
... ...
@@ -183,7 +183,7 @@ static int mmf_read_header(AVFormatContext *s,
183 183
 {
184 184
     MMFContext *mmf = s->priv_data;
185 185
     unsigned int tag;
186
-    ByteIOContext *pb = &s->pb;
186
+    ByteIOContext *pb = s->pb;
187 187
     AVStream *st;
188 188
     offset_t file_size, size;
189 189
     int rate, params;
... ...
@@ -265,7 +265,7 @@ static int mmf_read_packet(AVFormatContext *s,
265 265
     AVStream *st;
266 266
     int ret, size;
267 267
 
268
-    if (url_feof(&s->pb))
268
+    if (url_feof(s->pb))
269 269
         return AVERROR(EIO);
270 270
     st = s->streams[0];
271 271
 
... ...
@@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s,
280 280
         return AVERROR(EIO);
281 281
     pkt->stream_index = 0;
282 282
 
283
-    ret = get_buffer(&s->pb, pkt->data, pkt->size);
283
+    ret = get_buffer(s->pb, pkt->data, pkt->size);
284 284
     if (ret < 0)
285 285
         av_free_packet(pkt);
286 286
 
... ...
@@ -1423,7 +1423,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
1423 1423
 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
1424 1424
 {
1425 1425
     MOVContext *mov = s->priv_data;
1426
-    ByteIOContext *pb = &s->pb;
1426
+    ByteIOContext *pb = s->pb;
1427 1427
     int i, err;
1428 1428
     MOV_atom_t atom = { 0, 0, 0 };
1429 1429
 
... ...
@@ -1516,7 +1516,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
1516 1516
         return -1;
1517 1517
     /* must be done just before reading, to avoid infinite loop on sample */
1518 1518
     sc->current_sample++;
1519
-    if (sample->pos >= url_fsize(&s->pb)) {
1519
+    if (sample->pos >= url_fsize(s->pb)) {
1520 1520
         av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos);
1521 1521
         return -1;
1522 1522
     }
... ...
@@ -1526,8 +1526,8 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
1526 1526
         dprintf(s, "dv audio pkt size %d\n", pkt->size);
1527 1527
     } else {
1528 1528
 #endif
1529
-        url_fseek(&s->pb, sample->pos, SEEK_SET);
1530
-        av_get_packet(&s->pb, pkt, sample->size);
1529
+        url_fseek(s->pb, sample->pos, SEEK_SET);
1530
+        av_get_packet(s->pb, pkt, sample->size);
1531 1531
 #ifdef CONFIG_DV_DEMUXER
1532 1532
         if (mov->dv_demux) {
1533 1533
             void *pkt_destruct_func = pkt->destruct;
... ...
@@ -442,24 +442,27 @@ static uint8_t *avc_find_startcode( uint8_t *p, uint8_t *end )
442 442
     return end + 3;
443 443
 }
444 444
 
445
-static void avc_parse_nal_units(uint8_t **buf, int *size)
445
+static int avc_parse_nal_units(uint8_t **buf, int *size)
446 446
 {
447
-    ByteIOContext pb;
447
+    ByteIOContext *pb;
448 448
     uint8_t *p = *buf;
449 449
     uint8_t *end = p + *size;
450 450
     uint8_t *nal_start, *nal_end;
451
+    int ret = url_open_dyn_buf(&pb);
452
+    if(ret < 0)
453
+        return ret;
451 454
 
452
-    url_open_dyn_buf(&pb);
453 455
     nal_start = avc_find_startcode(p, end);
454 456
     while (nal_start < end) {
455 457
         while(!*(nal_start++));
456 458
         nal_end = avc_find_startcode(nal_start, end);
457
-        put_be32(&pb, nal_end - nal_start);
458
-        put_buffer(&pb, nal_start, nal_end - nal_start);
459
+        put_be32(pb, nal_end - nal_start);
460
+        put_buffer(pb, nal_start, nal_end - nal_start);
459 461
         nal_start = nal_end;
460 462
     }
461 463
     av_freep(buf);
462
-    *size = url_close_dyn_buf(&pb, buf);
464
+    *size = url_close_dyn_buf(pb, buf);
465
+    return 0;
463 466
 }
464 467
 
465 468
 static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
... ...
@@ -1508,11 +1511,11 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
1508 1508
 
1509 1509
 static int mov_write_header(AVFormatContext *s)
1510 1510
 {
1511
-    ByteIOContext *pb = &s->pb;
1511
+    ByteIOContext *pb = s->pb;
1512 1512
     MOVContext *mov = s->priv_data;
1513 1513
     int i;
1514 1514
 
1515
-    if (url_is_streamed(&s->pb)) {
1515
+    if (url_is_streamed(s->pb)) {
1516 1516
         av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
1517 1517
         return -1;
1518 1518
     }
... ...
@@ -1579,13 +1582,13 @@ static int mov_write_header(AVFormatContext *s)
1579 1579
 static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
1580 1580
 {
1581 1581
     MOVContext *mov = s->priv_data;
1582
-    ByteIOContext *pb = &s->pb;
1582
+    ByteIOContext *pb = s->pb;
1583 1583
     MOVTrack *trk = &mov->tracks[pkt->stream_index];
1584 1584
     AVCodecContext *enc = trk->enc;
1585 1585
     unsigned int samplesInChunk = 0;
1586 1586
     int size= pkt->size;
1587 1587
 
1588
-    if (url_is_streamed(&s->pb)) return 0; /* Can't handle that */
1588
+    if (url_is_streamed(s->pb)) return 0; /* Can't handle that */
1589 1589
     if (!size) return 0; /* Discard 0 sized packets */
1590 1590
 
1591 1591
     if (enc->codec_id == CODEC_ID_AMR_NB) {
... ...
@@ -1663,7 +1666,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
1663 1663
 static int mov_write_trailer(AVFormatContext *s)
1664 1664
 {
1665 1665
     MOVContext *mov = s->priv_data;
1666
-    ByteIOContext *pb = &s->pb;
1666
+    ByteIOContext *pb = s->pb;
1667 1667
     int res = 0;
1668 1668
     int i;
1669 1669
 
... ...
@@ -190,20 +190,20 @@ static void id3v2_read_ttag(AVFormatContext *s, int taglen, char *dst, int dstle
190 190
     taglen--; /* account for encoding type byte */
191 191
     dstlen--; /* Leave space for zero terminator */
192 192
 
193
-    switch(get_byte(&s->pb)) { /* encoding type */
193
+    switch(get_byte(s->pb)) { /* encoding type */
194 194
 
195 195
     case 0:  /* ISO-8859-1 (0 - 255 maps directly into unicode) */
196 196
         q = dst;
197 197
         while(taglen--) {
198 198
             uint8_t tmp;
199
-            PUT_UTF8(get_byte(&s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
199
+            PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
200 200
         }
201 201
         *q = '\0';
202 202
         break;
203 203
 
204 204
     case 3:  /* UTF-8 */
205 205
         len = FFMIN(taglen, dstlen);
206
-        get_buffer(&s->pb, dst, len);
206
+        get_buffer(s->pb, dst, len);
207 207
         dst[len] = 0;
208 208
         break;
209 209
     }
... ...
@@ -252,23 +252,23 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
252 252
     }
253 253
 
254 254
     if(isv34 && flags & 0x40) /* Extended header present, just skip over it */
255
-        url_fskip(&s->pb, id3v2_get_size(&s->pb, 4));
255
+        url_fskip(s->pb, id3v2_get_size(s->pb, 4));
256 256
 
257 257
     while(len >= taghdrlen) {
258 258
         if(isv34) {
259
-            tag  = get_be32(&s->pb);
260
-            tlen = id3v2_get_size(&s->pb, 4);
261
-            get_be16(&s->pb); /* flags */
259
+            tag  = get_be32(s->pb);
260
+            tlen = id3v2_get_size(s->pb, 4);
261
+            get_be16(s->pb); /* flags */
262 262
         } else {
263
-            tag  = get_be24(&s->pb);
264
-            tlen = id3v2_get_size(&s->pb, 3);
263
+            tag  = get_be24(s->pb);
264
+            tlen = id3v2_get_size(s->pb, 3);
265 265
         }
266 266
         len -= taghdrlen + tlen;
267 267
 
268 268
         if(len < 0)
269 269
             break;
270 270
 
271
-        next = url_ftell(&s->pb) + tlen;
271
+        next = url_ftell(s->pb) + tlen;
272 272
 
273 273
         switch(tag) {
274 274
         case MKBETAG('T', 'I', 'T', '2'):
... ...
@@ -298,21 +298,21 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
298 298
             break;
299 299
         case 0:
300 300
             /* padding, skip to end */
301
-            url_fskip(&s->pb, len);
301
+            url_fskip(s->pb, len);
302 302
             len = 0;
303 303
             continue;
304 304
         }
305 305
         /* Skip to end of tag */
306
-        url_fseek(&s->pb, next, SEEK_SET);
306
+        url_fseek(s->pb, next, SEEK_SET);
307 307
     }
308 308
 
309 309
     if(version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
310
-        url_fskip(&s->pb, 10);
310
+        url_fskip(s->pb, 10);
311 311
     return;
312 312
 
313 313
   error:
314 314
     av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
315
-    url_fskip(&s->pb, len);
315
+    url_fskip(s->pb, len);
316 316
 }
317 317
 
318 318
 static void id3v1_get_string(char *str, int str_size,
... ...
@@ -435,7 +435,7 @@ static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, offset_t base)
435 435
     const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
436 436
     MPADecodeContext c;
437 437
 
438
-    v = get_be32(&s->pb);
438
+    v = get_be32(s->pb);
439 439
     if(ff_mpa_check_header(v) < 0)
440 440
       return;
441 441
 
... ...
@@ -444,23 +444,23 @@ static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, offset_t base)
444 444
         return;
445 445
 
446 446
     /* Check for Xing / Info tag */
447
-    url_fseek(&s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
448
-    v = get_be32(&s->pb);
447
+    url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
448
+    v = get_be32(s->pb);
449 449
     if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
450
-        v = get_be32(&s->pb);
450
+        v = get_be32(s->pb);
451 451
         if(v & 0x1)
452
-            frames = get_be32(&s->pb);
452
+            frames = get_be32(s->pb);
453 453
     }
454 454
 
455 455
     /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
456
-    url_fseek(&s->pb, base + 4 + 32, SEEK_SET);
457
-    v = get_be32(&s->pb);
456
+    url_fseek(s->pb, base + 4 + 32, SEEK_SET);
457
+    v = get_be32(s->pb);
458 458
     if(v == MKBETAG('V', 'B', 'R', 'I')) {
459 459
         /* Check tag version */
460
-        if(get_be16(&s->pb) == 1) {
460
+        if(get_be16(s->pb) == 1) {
461 461
             /* skip delay, quality and total bytes */
462
-            url_fseek(&s->pb, 8, SEEK_CUR);
463
-            frames = get_be32(&s->pb);
462
+            url_fseek(s->pb, 8, SEEK_CUR);
463
+            frames = get_be32(s->pb);
464 464
         }
465 465
     }
466 466
 
... ...
@@ -490,21 +490,21 @@ static int mp3_read_header(AVFormatContext *s,
490 490
     st->start_time = 0;
491 491
 
492 492
     /* try to get the TAG */
493
-    if (!url_is_streamed(&s->pb)) {
493
+    if (!url_is_streamed(s->pb)) {
494 494
         /* XXX: change that */
495
-        filesize = url_fsize(&s->pb);
495
+        filesize = url_fsize(s->pb);
496 496
         if (filesize > 128) {
497
-            url_fseek(&s->pb, filesize - 128, SEEK_SET);
498
-            ret = get_buffer(&s->pb, buf, ID3v1_TAG_SIZE);
497
+            url_fseek(s->pb, filesize - 128, SEEK_SET);
498
+            ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
499 499
             if (ret == ID3v1_TAG_SIZE) {
500 500
                 id3v1_parse_tag(s, buf);
501 501
             }
502
-            url_fseek(&s->pb, 0, SEEK_SET);
502
+            url_fseek(s->pb, 0, SEEK_SET);
503 503
         }
504 504
     }
505 505
 
506 506
     /* if ID3v2 header found, skip it */
507
-    ret = get_buffer(&s->pb, buf, ID3v2_HEADER_SIZE);
507
+    ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
508 508
     if (ret != ID3v2_HEADER_SIZE)
509 509
         return -1;
510 510
     if (id3v2_match(buf)) {
... ...
@@ -515,12 +515,12 @@ static int mp3_read_header(AVFormatContext *s,
515 515
             (buf[9] & 0x7f);
516 516
         id3v2_parse(s, len, buf[3], buf[5]);
517 517
     } else {
518
-        url_fseek(&s->pb, 0, SEEK_SET);
518
+        url_fseek(s->pb, 0, SEEK_SET);
519 519
     }
520 520
 
521
-    off = url_ftell(&s->pb);
521
+    off = url_ftell(s->pb);
522 522
     mp3_parse_vbr_tags(s, st, off);
523
-    url_fseek(&s->pb, off, SEEK_SET);
523
+    url_fseek(s->pb, off, SEEK_SET);
524 524
 
525 525
     /* the parameters will be extracted from the compressed bitstream */
526 526
     return 0;
... ...
@@ -535,7 +535,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
535 535
 
536 536
     size= MP3_PACKET_SIZE;
537 537
 
538
-    ret= av_get_packet(&s->pb, pkt, size);
538
+    ret= av_get_packet(s->pb, pkt, size);
539 539
 
540 540
     pkt->stream_index = 0;
541 541
     if (ret <= 0) {
... ...
@@ -557,20 +557,20 @@ static int mp3_read_close(AVFormatContext *s)
557 557
 
558 558
 static void id3v2_put_size(AVFormatContext *s, int size)
559 559
 {
560
-    put_byte(&s->pb, size >> 21 & 0x7f);
561
-    put_byte(&s->pb, size >> 14 & 0x7f);
562
-    put_byte(&s->pb, size >> 7  & 0x7f);
563
-    put_byte(&s->pb, size       & 0x7f);
560
+    put_byte(s->pb, size >> 21 & 0x7f);
561
+    put_byte(s->pb, size >> 14 & 0x7f);
562
+    put_byte(s->pb, size >> 7  & 0x7f);
563
+    put_byte(s->pb, size       & 0x7f);
564 564
 }
565 565
 
566 566
 static void id3v2_put_ttag(AVFormatContext *s, char *string, uint32_t tag)
567 567
 {
568 568
     int len = strlen(string);
569
-    put_be32(&s->pb, tag);
569
+    put_be32(s->pb, tag);
570 570
     id3v2_put_size(s, len + 1);
571
-    put_be16(&s->pb, 0);
572
-    put_byte(&s->pb, 3); /* UTF-8 */
573
-    put_buffer(&s->pb, string, len);
571
+    put_be16(s->pb, 0);
572
+    put_byte(s->pb, 3); /* UTF-8 */
573
+    put_buffer(s->pb, string, len);
574 574
 }
575 575
 
576 576
 
... ...
@@ -602,9 +602,9 @@ static int mp3_write_header(struct AVFormatContext *s)
602 602
     if(totlen == 0)
603 603
         return 0;
604 604
 
605
-    put_be32(&s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
606
-    put_byte(&s->pb, 0);
607
-    put_byte(&s->pb, 0); /* flags */
605
+    put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
606
+    put_byte(s->pb, 0);
607
+    put_byte(s->pb, 0); /* flags */
608 608
 
609 609
     id3v2_put_size(s, totlen);
610 610
 
... ...
@@ -622,8 +622,8 @@ static int mp3_write_header(struct AVFormatContext *s)
622 622
 
623 623
 static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
624 624
 {
625
-    put_buffer(&s->pb, pkt->data, pkt->size);
626
-    put_flush_packet(&s->pb);
625
+    put_buffer(s->pb, pkt->data, pkt->size);
626
+    put_flush_packet(s->pb);
627 627
     return 0;
628 628
 }
629 629
 
... ...
@@ -634,8 +634,8 @@ static int mp3_write_trailer(struct AVFormatContext *s)
634 634
     /* write the id3v1 tag */
635 635
     if (s->title[0] != '\0') {
636 636
         id3v1_create_tag(s, buf);
637
-        put_buffer(&s->pb, buf, ID3v1_TAG_SIZE);
638
-        put_flush_packet(&s->pb);
637
+        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
638
+        put_flush_packet(s->pb);
639 639
     }
640 640
     return 0;
641 641
 }
... ...
@@ -55,31 +55,31 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
55 55
     AVStream *st;
56 56
     int t;
57 57
 
58
-    t = get_le24(&s->pb);
58
+    t = get_le24(s->pb);
59 59
     if(t != MKTAG('M', 'P', '+', 0)){
60 60
         if(t != MKTAG('I', 'D', '3', 0)){
61 61
             av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
62 62
             return -1;
63 63
         }
64 64
         /* skip ID3 tags and try again */
65
-        url_fskip(&s->pb, 3);
66
-        t  = get_byte(&s->pb) << 21;
67
-        t |= get_byte(&s->pb) << 14;
68
-        t |= get_byte(&s->pb) <<  7;
69
-        t |= get_byte(&s->pb);
65
+        url_fskip(s->pb, 3);
66
+        t  = get_byte(s->pb) << 21;
67
+        t |= get_byte(s->pb) << 14;
68
+        t |= get_byte(s->pb) <<  7;
69
+        t |= get_byte(s->pb);
70 70
         av_log(s, AV_LOG_DEBUG, "Skipping %d(%X) bytes of ID3 data\n", t, t);
71
-        url_fskip(&s->pb, t);
72
-        if(get_le24(&s->pb) != MKTAG('M', 'P', '+', 0)){
71
+        url_fskip(s->pb, t);
72
+        if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
73 73
             av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
74 74
             return -1;
75 75
         }
76 76
     }
77
-    c->ver = get_byte(&s->pb);
77
+    c->ver = get_byte(s->pb);
78 78
     if(c->ver != 0x07 && c->ver != 0x17){
79 79
         av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
80 80
         return -1;
81 81
     }
82
-    c->fcount = get_le32(&s->pb);
82
+    c->fcount = get_le32(s->pb);
83 83
     if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
84 84
         av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
85 85
         return -1;
... ...
@@ -100,7 +100,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
100 100
 
101 101
     st->codec->extradata_size = 16;
102 102
     st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
103
-    get_buffer(&s->pb, st->codec->extradata, 16);
103
+    get_buffer(s->pb, st->codec->extradata, 16);
104 104
     st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
105 105
     av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
106 106
     /* scan for seekpoints */
... ...
@@ -120,22 +120,22 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
120 120
         return -1;
121 121
 
122 122
     if(c->curframe != c->lastframe + 1){
123
-        url_fseek(&s->pb, c->frames[c->curframe].pos, SEEK_SET);
123
+        url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
124 124
         c->curbits = c->frames[c->curframe].skip;
125 125
     }
126 126
     c->lastframe = c->curframe;
127 127
     c->curframe++;
128 128
     curbits = c->curbits;
129
-    pos = url_ftell(&s->pb);
130
-    tmp = get_le32(&s->pb);
129
+    pos = url_ftell(s->pb);
130
+    tmp = get_le32(s->pb);
131 131
     if(curbits <= 12){
132 132
         size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
133 133
     }else{
134
-        tmp = (tmp << 32) | get_le32(&s->pb);
134
+        tmp = (tmp << 32) | get_le32(s->pb);
135 135
         size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
136 136
     }
137 137
     curbits += 20;
138
-    url_fseek(&s->pb, pos, SEEK_SET);
138
+    url_fseek(s->pb, pos, SEEK_SET);
139 139
 
140 140
     size = ((size2 + curbits + 31) & ~31) >> 3;
141 141
     if(cur == c->frames_noted){
... ...
@@ -155,9 +155,9 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
155 155
 
156 156
     pkt->stream_index = 0;
157 157
     pkt->pts = cur;
158
-    ret = get_buffer(&s->pb, pkt->data + 4, size);
158
+    ret = get_buffer(s->pb, pkt->data + 4, size);
159 159
     if(c->curbits)
160
-        url_fseek(&s->pb, -4, SEEK_CUR);
160
+        url_fseek(s->pb, -4, SEEK_CUR);
161 161
     if(ret < size){
162 162
         av_free_packet(pkt);
163 163
         return AVERROR(EIO);
... ...
@@ -90,15 +90,15 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
90 90
     int i, t, seekd;
91 91
     GetBitContext gb;
92 92
 
93
-    url_fseek(&s->pb, off, SEEK_SET);
94
-    mpc8_get_chunk_header(&s->pb, &tag, &size);
93
+    url_fseek(s->pb, off, SEEK_SET);
94
+    mpc8_get_chunk_header(s->pb, &tag, &size);
95 95
     if(tag != TAG_SEEKTABLE){
96 96
         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
97 97
         return;
98 98
     }
99 99
     if(!(buf = av_malloc(size)))
100 100
         return;
101
-    get_buffer(&s->pb, buf, size);
101
+    get_buffer(s->pb, buf, size);
102 102
     init_get_bits(&gb, buf, size * 8);
103 103
     size = gb_get_v(&gb);
104 104
     if(size > UINT_MAX/4 || size > c->samples/1152){
... ...
@@ -126,7 +126,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
126 126
 
127 127
 static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size)
128 128
 {
129
-    ByteIOContext *pb = &s->pb;
129
+    ByteIOContext *pb = s->pb;
130 130
     int64_t pos, off;
131 131
 
132 132
     switch(tag){
... ...
@@ -144,7 +144,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
144 144
 static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
145 145
 {
146 146
     MPCContext *c = s->priv_data;
147
-    ByteIOContext *pb = &s->pb;
147
+    ByteIOContext *pb = s->pb;
148 148
     AVStream *st;
149 149
     int tag = 0;
150 150
     int64_t size, pos;
... ...
@@ -202,11 +202,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
202 202
     int tag;
203 203
     int64_t pos, size;
204 204
 
205
-    while(!url_feof(&s->pb)){
206
-        pos = url_ftell(&s->pb);
207
-        mpc8_get_chunk_header(&s->pb, &tag, &size);
205
+    while(!url_feof(s->pb)){
206
+        pos = url_ftell(s->pb);
207
+        mpc8_get_chunk_header(s->pb, &tag, &size);
208 208
         if(tag == TAG_AUDIOPACKET){
209
-            if(av_get_packet(&s->pb, pkt, size) < 0)
209
+            if(av_get_packet(s->pb, pkt, size) < 0)
210 210
                 return AVERROR(ENOMEM);
211 211
             pkt->stream_index = 0;
212 212
             pkt->pts = c->frame;
... ...
@@ -226,7 +226,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
226 226
     int index = av_index_search_timestamp(st, timestamp, flags);
227 227
 
228 228
     if(index < 0) return -1;
229
-    url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
229
+    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
230 230
     c->frame = st->index_entries[index].timestamp;
231 231
     return 0;
232 232
 }
... ...
@@ -122,7 +122,7 @@ static int mpegps_read_header(AVFormatContext *s,
122 122
 
123 123
     m->sofdec = -1;
124 124
     do {
125
-        v = get_byte(&s->pb);
125
+        v = get_byte(s->pb);
126 126
         m->header_state = m->header_state << 8 | v;
127 127
         m->sofdec++;
128 128
     } while (v == sofdec[i] && i++ < 6);
... ...
@@ -253,17 +253,17 @@ static int mpegps_read_pes_header(AVFormatContext *s,
253 253
     int len, size, startcode, c, flags, header_len;
254 254
     int pes_ext, ext2_len, id_ext, skip;
255 255
     int64_t pts, dts;
256
-    int64_t last_sync= url_ftell(&s->pb);
256
+    int64_t last_sync= url_ftell(s->pb);
257 257
 
258 258
  error_redo:
259
-        url_fseek(&s->pb, last_sync, SEEK_SET);
259
+        url_fseek(s->pb, last_sync, SEEK_SET);
260 260
  redo:
261 261
         /* next start code (should be immediately after) */
262 262
         m->header_state = 0xff;
263 263
         size = MAX_SYNC_SIZE;
264
-        startcode = find_next_start_code(&s->pb, &size, &m->header_state);
265
-        last_sync = url_ftell(&s->pb);
266
-    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb));
264
+        startcode = find_next_start_code(s->pb, &size, &m->header_state);
265
+        last_sync = url_ftell(s->pb);
266
+    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
267 267
     if (startcode < 0)
268 268
         return AVERROR(EIO);
269 269
     if (startcode == PACK_START_CODE)
... ...
@@ -271,16 +271,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
271 271
     if (startcode == SYSTEM_HEADER_START_CODE)
272 272
         goto redo;
273 273
     if (startcode == PADDING_STREAM) {
274
-        url_fskip(&s->pb, get_be16(&s->pb));
274
+        url_fskip(s->pb, get_be16(s->pb));
275 275
         goto redo;
276 276
     }
277 277
     if (startcode == PRIVATE_STREAM_2) {
278
-        len = get_be16(&s->pb);
278
+        len = get_be16(s->pb);
279 279
         if (!m->sofdec) {
280 280
             while (len-- >= 6) {
281
-                if (get_byte(&s->pb) == 'S') {
281
+                if (get_byte(s->pb) == 'S') {
282 282
                     uint8_t buf[5];
283
-                    get_buffer(&s->pb, buf, sizeof(buf));
283
+                    get_buffer(s->pb, buf, sizeof(buf));
284 284
                     m->sofdec = !memcmp(buf, "ofdec", 5);
285 285
                     len -= sizeof(buf);
286 286
                     break;
... ...
@@ -288,11 +288,11 @@ static int mpegps_read_pes_header(AVFormatContext *s,
288 288
             }
289 289
             m->sofdec -= !m->sofdec;
290 290
         }
291
-        url_fskip(&s->pb, len);
291
+        url_fskip(s->pb, len);
292 292
         goto redo;
293 293
     }
294 294
     if (startcode == PROGRAM_STREAM_MAP) {
295
-        mpegps_psm_parse(m, &s->pb);
295
+        mpegps_psm_parse(m, s->pb);
296 296
         goto redo;
297 297
     }
298 298
 
... ...
@@ -302,16 +302,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
302 302
           (startcode == 0x1bd) || (startcode == 0x1fd)))
303 303
         goto redo;
304 304
     if (ppos) {
305
-        *ppos = url_ftell(&s->pb) - 4;
305
+        *ppos = url_ftell(s->pb) - 4;
306 306
     }
307
-    len = get_be16(&s->pb);
307
+    len = get_be16(s->pb);
308 308
     pts =
309 309
     dts = AV_NOPTS_VALUE;
310 310
     /* stuffing */
311 311
     for(;;) {
312 312
         if (len < 1)
313 313
             goto error_redo;
314
-        c = get_byte(&s->pb);
314
+        c = get_byte(s->pb);
315 315
         len--;
316 316
         /* XXX: for mpeg1, should test only bit 7 */
317 317
         if (c != 0xff)
... ...
@@ -319,15 +319,15 @@ static int mpegps_read_pes_header(AVFormatContext *s,
319 319
     }
320 320
     if ((c & 0xc0) == 0x40) {
321 321
         /* buffer scale & size */
322
-        get_byte(&s->pb);
323
-        c = get_byte(&s->pb);
322
+        get_byte(s->pb);
323
+        c = get_byte(s->pb);
324 324
         len -= 2;
325 325
     }
326 326
     if ((c & 0xe0) == 0x20) {
327
-        dts = pts = get_pts(&s->pb, c);
327
+        dts = pts = get_pts(s->pb, c);
328 328
         len -= 4;
329 329
         if (c & 0x10){
330
-            dts = get_pts(&s->pb, -1);
330
+            dts = get_pts(s->pb, -1);
331 331
             len -= 5;
332 332
         }
333 333
     } else if ((c & 0xc0) == 0x80) {
... ...
@@ -338,22 +338,22 @@ static int mpegps_read_pes_header(AVFormatContext *s,
338 338
             goto redo;
339 339
         }
340 340
 #endif
341
-        flags = get_byte(&s->pb);
342
-        header_len = get_byte(&s->pb);
341
+        flags = get_byte(s->pb);
342
+        header_len = get_byte(s->pb);
343 343
         len -= 2;
344 344
         if (header_len > len)
345 345
             goto error_redo;
346 346
         len -= header_len;
347 347
         if (flags & 0x80) {
348
-            dts = pts = get_pts(&s->pb, -1);
348
+            dts = pts = get_pts(s->pb, -1);
349 349
             header_len -= 5;
350 350
             if (flags & 0x40) {
351
-                dts = get_pts(&s->pb, -1);
351
+                dts = get_pts(s->pb, -1);
352 352
                 header_len -= 5;
353 353
             }
354 354
         }
355 355
         if (flags & 0x01) { /* PES extension */
356
-            pes_ext = get_byte(&s->pb);
356
+            pes_ext = get_byte(s->pb);
357 357
             header_len--;
358 358
             if (pes_ext & 0x40) { /* pack header - should be zero in PS */
359 359
                 goto error_redo;
... ...
@@ -361,14 +361,14 @@ static int mpegps_read_pes_header(AVFormatContext *s,
361 361
             /* Skip PES private data, program packet sequence counter and P-STD buffer */
362 362
             skip = (pes_ext >> 4) & 0xb;
363 363
             skip += skip & 0x9;
364
-            url_fskip(&s->pb, skip);
364
+            url_fskip(s->pb, skip);
365 365
             header_len -= skip;
366 366
 
367 367
             if (pes_ext & 0x01) { /* PES extension 2 */
368
-                ext2_len = get_byte(&s->pb);
368
+                ext2_len = get_byte(s->pb);
369 369
                 header_len--;
370 370
                 if ((ext2_len & 0x7f) > 0) {
371
-                    id_ext = get_byte(&s->pb);
371
+                    id_ext = get_byte(s->pb);
372 372
                     if ((id_ext & 0x80) == 0)
373 373
                         startcode = ((startcode & 0xff) << 8) | id_ext;
374 374
                     header_len--;
... ...
@@ -377,23 +377,23 @@ static int mpegps_read_pes_header(AVFormatContext *s,
377 377
         }
378 378
         if(header_len < 0)
379 379
             goto error_redo;
380
-        url_fskip(&s->pb, header_len);
380
+        url_fskip(s->pb, header_len);
381 381
     }
382 382
     else if( c!= 0xf )
383 383
         goto redo;
384 384
 
385 385
     if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
386
-        startcode = get_byte(&s->pb);
386
+        startcode = get_byte(s->pb);
387 387
         len--;
388 388
         if (startcode >= 0x80 && startcode <= 0xcf) {
389 389
             /* audio: skip header */
390
-            get_byte(&s->pb);
391
-            get_byte(&s->pb);
392
-            get_byte(&s->pb);
390
+            get_byte(s->pb);
391
+            get_byte(s->pb);
392
+            get_byte(s->pb);
393 393
             len -= 3;
394 394
             if (startcode >= 0xb0 && startcode <= 0xbf) {
395 395
                 /* MLP/TrueHD audio has a 4-byte header */
396
-                get_byte(&s->pb);
396
+                get_byte(s->pb);
397 397
                 len--;
398 398
             }
399 399
         }
... ...
@@ -465,8 +465,8 @@ static int mpegps_read_packet(AVFormatContext *s,
465 465
     } else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
466 466
         static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
467 467
         unsigned char buf[8];
468
-        get_buffer(&s->pb, buf, 8);
469
-        url_fseek(&s->pb, -8, SEEK_CUR);
468
+        get_buffer(s->pb, buf, 8);
469
+        url_fseek(s->pb, -8, SEEK_CUR);
470 470
         if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
471 471
             codec_id = CODEC_ID_CAVS;
472 472
         else
... ...
@@ -502,7 +502,7 @@ static int mpegps_read_packet(AVFormatContext *s,
502 502
     } else {
503 503
     skip:
504 504
         /* skip packet */
505
-        url_fskip(&s->pb, len);
505
+        url_fskip(s->pb, len);
506 506
         goto redo;
507 507
     }
508 508
     /* no stream found: add a new stream */
... ...
@@ -523,9 +523,9 @@ static int mpegps_read_packet(AVFormatContext *s,
523 523
            audio data */
524 524
         if (len <= 3)
525 525
             goto skip;
526
-        get_byte(&s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
527
-        b1 = get_byte(&s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
528
-        get_byte(&s->pb); /* dynamic range control (0x80 = off) */
526
+        get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
527
+        b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
528
+        get_byte(s->pb); /* dynamic range control (0x80 = off) */
529 529
         len -= 3;
530 530
         freq = (b1 >> 4) & 3;
531 531
         st->codec->sample_rate = lpcm_freq_tab[freq];
... ...
@@ -533,7 +533,7 @@ static int mpegps_read_packet(AVFormatContext *s,
533 533
         st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
534 534
     }
535 535
     av_new_packet(pkt, len);
536
-    get_buffer(&s->pb, pkt->data, pkt->size);
536
+    get_buffer(s->pb, pkt->data, pkt->size);
537 537
     pkt->pts = pts;
538 538
     pkt->dts = dts;
539 539
     pkt->stream_index = st->index;
... ...
@@ -560,7 +560,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
560 560
 #ifdef DEBUG_SEEK
561 561
     printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next);
562 562
 #endif
563
-    url_fseek(&s->pb, pos, SEEK_SET);
563
+    url_fseek(s->pb, pos, SEEK_SET);
564 564
     for(;;) {
565 565
         len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
566 566
         if (len < 0) {
... ...
@@ -573,7 +573,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
573 573
             dts != AV_NOPTS_VALUE) {
574 574
             break;
575 575
         }
576
-        url_fskip(&s->pb, len);
576
+        url_fskip(s->pb, len);
577 577
     }
578 578
 #ifdef DEBUG_SEEK
579 579
     printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
... ...
@@ -690,19 +690,19 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
690 690
                     size = put_system_header(ctx, buf_ptr, 0);
691 691
                     buf_ptr += size;
692 692
                     size = buf_ptr - buffer;
693
-                    put_buffer(&ctx->pb, buffer, size);
693
+                    put_buffer(ctx->pb, buffer, size);
694 694
 
695
-                    put_be32(&ctx->pb, PRIVATE_STREAM_2);
696
-                    put_be16(&ctx->pb, 0x03d4);         // length
697
-                    put_byte(&ctx->pb, 0x00);           // substream ID, 00=PCI
695
+                    put_be32(ctx->pb, PRIVATE_STREAM_2);
696
+                    put_be16(ctx->pb, 0x03d4);         // length
697
+                    put_byte(ctx->pb, 0x00);           // substream ID, 00=PCI
698 698
                     for (i = 0; i < 979; i++)
699
-                        put_byte(&ctx->pb, 0x00);
699
+                        put_byte(ctx->pb, 0x00);
700 700
 
701
-                    put_be32(&ctx->pb, PRIVATE_STREAM_2);
702
-                    put_be16(&ctx->pb, 0x03fa);         // length
703
-                    put_byte(&ctx->pb, 0x01);           // substream ID, 01=DSI
701
+                    put_be32(ctx->pb, PRIVATE_STREAM_2);
702
+                    put_be16(ctx->pb, 0x03fa);         // length
703
+                    put_byte(ctx->pb, 0x01);           // substream ID, 01=DSI
704 704
                     for (i = 0; i < 1017; i++)
705
-                        put_byte(&ctx->pb, 0x00);
705
+                        put_byte(ctx->pb, 0x00);
706 706
 
707 707
                     memset(buffer, 0, 128);
708 708
                     buf_ptr = buffer;
... ...
@@ -725,7 +725,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
725 725
         }
726 726
     }
727 727
     size = buf_ptr - buffer;
728
-    put_buffer(&ctx->pb, buffer, size);
728
+    put_buffer(ctx->pb, buffer, size);
729 729
 
730 730
     packet_size = s->packet_size - size;
731 731
 
... ...
@@ -830,16 +830,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
830 830
 
831 831
         nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
832 832
 
833
-        put_be32(&ctx->pb, startcode);
833
+        put_be32(ctx->pb, startcode);
834 834
 
835
-        put_be16(&ctx->pb, packet_size);
835
+        put_be16(ctx->pb, packet_size);
836 836
 
837 837
         if (!s->is_mpeg2)
838 838
             for(i=0;i<stuffing_size;i++)
839
-                put_byte(&ctx->pb, 0xff);
839
+                put_byte(ctx->pb, 0xff);
840 840
 
841 841
         if (s->is_mpeg2) {
842
-            put_byte(&ctx->pb, 0x80); /* mpeg2 id */
842
+            put_byte(ctx->pb, 0x80); /* mpeg2 id */
843 843
 
844 844
             pes_flags=0;
845 845
 
... ...
@@ -856,64 +856,64 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
856 856
             if (stream->packet_number == 0)
857 857
                 pes_flags |= 0x01;
858 858
 
859
-            put_byte(&ctx->pb, pes_flags); /* flags */
860
-            put_byte(&ctx->pb, header_len - 3 + stuffing_size);
859
+            put_byte(ctx->pb, pes_flags); /* flags */
860
+            put_byte(ctx->pb, header_len - 3 + stuffing_size);
861 861
 
862 862
             if (pes_flags & 0x80)  /*write pts*/
863
-                put_timestamp(&ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
863
+                put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
864 864
             if (pes_flags & 0x40)  /*write dts*/
865
-                put_timestamp(&ctx->pb, 0x01, dts);
865
+                put_timestamp(ctx->pb, 0x01, dts);
866 866
 
867 867
             if (pes_flags & 0x01) {  /*write pes extension*/
868
-                put_byte(&ctx->pb, 0x10); /* flags */
868
+                put_byte(ctx->pb, 0x10); /* flags */
869 869
 
870 870
                 /* P-STD buffer info */
871 871
                 if (id == AUDIO_ID)
872
-                    put_be16(&ctx->pb, 0x4000 | stream->max_buffer_size/128);
872
+                    put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/128);
873 873
                 else
874
-                    put_be16(&ctx->pb, 0x6000 | stream->max_buffer_size/1024);
874
+                    put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
875 875
             }
876 876
 
877 877
         } else {
878 878
             if (pts != AV_NOPTS_VALUE) {
879 879
                 if (dts != pts) {
880
-                    put_timestamp(&ctx->pb, 0x03, pts);
881
-                    put_timestamp(&ctx->pb, 0x01, dts);
880
+                    put_timestamp(ctx->pb, 0x03, pts);
881
+                    put_timestamp(ctx->pb, 0x01, dts);
882 882
                 } else {
883
-                    put_timestamp(&ctx->pb, 0x02, pts);
883
+                    put_timestamp(ctx->pb, 0x02, pts);
884 884
                 }
885 885
             } else {
886
-                put_byte(&ctx->pb, 0x0f);
886
+                put_byte(ctx->pb, 0x0f);
887 887
             }
888 888
         }
889 889
 
890 890
         if (s->is_mpeg2) {
891 891
             /* special stuffing byte that is always written
892 892
                to prevent accidental generation of start codes. */
893
-            put_byte(&ctx->pb, 0xff);
893
+            put_byte(ctx->pb, 0xff);
894 894
 
895 895
             for(i=0;i<stuffing_size;i++)
896
-                put_byte(&ctx->pb, 0xff);
896
+                put_byte(ctx->pb, 0xff);
897 897
         }
898 898
 
899 899
         if (startcode == PRIVATE_STREAM_1) {
900
-            put_byte(&ctx->pb, id);
900
+            put_byte(ctx->pb, id);
901 901
             if (id >= 0xa0) {
902 902
                 /* LPCM (XXX: check nb_frames) */
903
-                put_byte(&ctx->pb, 7);
904
-                put_be16(&ctx->pb, 4); /* skip 3 header bytes */
905
-                put_byte(&ctx->pb, stream->lpcm_header[0]);
906
-                put_byte(&ctx->pb, stream->lpcm_header[1]);
907
-                put_byte(&ctx->pb, stream->lpcm_header[2]);
903
+                put_byte(ctx->pb, 7);
904
+                put_be16(ctx->pb, 4); /* skip 3 header bytes */
905
+                put_byte(ctx->pb, stream->lpcm_header[0]);
906
+                put_byte(ctx->pb, stream->lpcm_header[1]);
907
+                put_byte(ctx->pb, stream->lpcm_header[2]);
908 908
             } else if (id >= 0x40) {
909 909
                 /* AC3 */
910
-                put_byte(&ctx->pb, nb_frames);
911
-                put_be16(&ctx->pb, trailer_size+1);
910
+                put_byte(ctx->pb, nb_frames);
911
+                put_be16(ctx->pb, trailer_size+1);
912 912
             }
913 913
         }
914 914
 
915 915
         /* output data */
916
-        if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, &ctx->pb) < 0)
916
+        if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb) < 0)
917 917
             return -1;
918 918
         stream->bytes_to_iframe -= payload_size - stuffing_size;
919 919
     }else{
... ...
@@ -922,12 +922,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
922 922
     }
923 923
 
924 924
     if (pad_packet_bytes > 0)
925
-        put_padding_packet(ctx,&ctx->pb, pad_packet_bytes);
925
+        put_padding_packet(ctx,ctx->pb, pad_packet_bytes);
926 926
 
927 927
     for(i=0;i<zero_trail_bytes;i++)
928
-        put_byte(&ctx->pb, 0x00);
928
+        put_byte(ctx->pb, 0x00);
929 929
 
930
-    put_flush_packet(&ctx->pb);
930
+    put_flush_packet(ctx->pb);
931 931
 
932 932
     s->packet_number++;
933 933
 
... ...
@@ -952,11 +952,11 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
952 952
     int i;
953 953
 
954 954
     for(i=0;i<s->packet_size;i++)
955
-        put_byte(&ctx->pb, 0);
955
+        put_byte(ctx->pb, 0);
956 956
 
957 957
     s->vcd_padding_bytes_written += s->packet_size;
958 958
 
959
-    put_flush_packet(&ctx->pb);
959
+    put_flush_packet(ctx->pb);
960 960
 
961 961
     /* increasing the packet number is correct. The SCR of the following packs
962 962
        is calculated from the packet_number and it has to include the padding
... ...
@@ -1206,8 +1206,8 @@ static int mpeg_mux_end(AVFormatContext *ctx)
1206 1206
     /* End header according to MPEG1 systems standard. We do not write
1207 1207
        it as it is usually not needed by decoders and because it
1208 1208
        complicates MPEG stream concatenation. */
1209
-    //put_be32(&ctx->pb, ISO_11172_END_CODE);
1210
-    //put_flush_packet(&ctx->pb);
1209
+    //put_be32(ctx->pb, ISO_11172_END_CODE);
1210
+    //put_flush_packet(ctx->pb);
1211 1211
 
1212 1212
     for(i=0;i<ctx->nb_streams;i++) {
1213 1213
         stream = ctx->streams[i]->priv_data;
... ...
@@ -1098,7 +1098,7 @@ static int read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size)
1098 1098
 static int handle_packets(MpegTSContext *ts, int nb_packets)
1099 1099
 {
1100 1100
     AVFormatContext *s = ts->stream;
1101
-    ByteIOContext *pb = &s->pb;
1101
+    ByteIOContext *pb = s->pb;
1102 1102
     uint8_t packet[TS_PACKET_SIZE];
1103 1103
     int packet_num, ret;
1104 1104
 
... ...
@@ -1180,7 +1180,7 @@ static int mpegts_read_header(AVFormatContext *s,
1180 1180
                               AVFormatParameters *ap)
1181 1181
 {
1182 1182
     MpegTSContext *ts = s->priv_data;
1183
-    ByteIOContext *pb = &s->pb;
1183
+    ByteIOContext *pb = s->pb;
1184 1184
     uint8_t buf[1024];
1185 1185
     int len;
1186 1186
     int64_t pos;
... ...
@@ -1243,7 +1243,7 @@ static int mpegts_read_header(AVFormatContext *s,
1243 1243
         nb_pcrs = 0;
1244 1244
         nb_packets = 0;
1245 1245
         for(;;) {
1246
-            ret = read_packet(&s->pb, packet, ts->raw_packet_size);
1246
+            ret = read_packet(s->pb, packet, ts->raw_packet_size);
1247 1247
             if (ret < 0)
1248 1248
                 return -1;
1249 1249
             pid = AV_RB16(packet + 1) & 0x1fff;
... ...
@@ -1291,8 +1291,8 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
1291 1291
 
1292 1292
     if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
1293 1293
         return AVERROR(ENOMEM);
1294
-    pkt->pos= url_ftell(&s->pb);
1295
-    ret = read_packet(&s->pb, pkt->data, ts->raw_packet_size);
1294
+    pkt->pos= url_ftell(s->pb);
1295
+    ret = read_packet(s->pb, pkt->data, ts->raw_packet_size);
1296 1296
     if (ret < 0) {
1297 1297
         av_free_packet(pkt);
1298 1298
         return ret;
... ...
@@ -1301,10 +1301,10 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
1301 1301
         /* compute exact PCR for each packet */
1302 1302
         if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
1303 1303
             /* we read the next PCR (XXX: optimize it by using a bigger buffer */
1304
-            pos = url_ftell(&s->pb);
1304
+            pos = url_ftell(s->pb);
1305 1305
             for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
1306
-                url_fseek(&s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
1307
-                get_buffer(&s->pb, pcr_buf, 12);
1306
+                url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
1307
+                get_buffer(s->pb, pcr_buf, 12);
1308 1308
                 if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
1309 1309
                     /* XXX: not precise enough */
1310 1310
                     ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
... ...
@@ -1312,7 +1312,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
1312 1312
                     break;
1313 1313
                 }
1314 1314
             }
1315
-            url_fseek(&s->pb, pos, SEEK_SET);
1315
+            url_fseek(s->pb, pos, SEEK_SET);
1316 1316
             /* no next PCR found: we use previous increment */
1317 1317
             ts->cur_pcr = pcr_h * 300 + pcr_l;
1318 1318
         }
... ...
@@ -1354,8 +1354,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
1354 1354
     pos = ((*ppos  + ts->raw_packet_size - 1) / ts->raw_packet_size) * ts->raw_packet_size;
1355 1355
     if (find_next) {
1356 1356
         for(;;) {
1357
-            url_fseek(&s->pb, pos, SEEK_SET);
1358
-            if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1357
+            url_fseek(s->pb, pos, SEEK_SET);
1358
+            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1359 1359
                 return AV_NOPTS_VALUE;
1360 1360
             if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
1361 1361
                 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
... ...
@@ -1368,8 +1368,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
1368 1368
             pos -= ts->raw_packet_size;
1369 1369
             if (pos < 0)
1370 1370
                 return AV_NOPTS_VALUE;
1371
-            url_fseek(&s->pb, pos, SEEK_SET);
1372
-            if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1371
+            url_fseek(s->pb, pos, SEEK_SET);
1372
+            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1373 1373
                 return AV_NOPTS_VALUE;
1374 1374
             if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
1375 1375
                 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
... ...
@@ -1390,17 +1390,17 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
1390 1390
     if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
1391 1391
         return -1;
1392 1392
 
1393
-    pos= url_ftell(&s->pb);
1393
+    pos= url_ftell(s->pb);
1394 1394
 
1395 1395
     for(;;) {
1396
-        url_fseek(&s->pb, pos, SEEK_SET);
1397
-        if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1396
+        url_fseek(s->pb, pos, SEEK_SET);
1397
+        if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1398 1398
             return -1;
1399 1399
 //        pid = AV_RB16(buf + 1) & 0x1fff;
1400 1400
         if(buf[1] & 0x40) break;
1401 1401
         pos += ts->raw_packet_size;
1402 1402
     }
1403
-    url_fseek(&s->pb, pos, SEEK_SET);
1403
+    url_fseek(s->pb, pos, SEEK_SET);
1404 1404
 
1405 1405
     return 0;
1406 1406
 }
... ...
@@ -353,7 +353,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
353 353
 static void section_write_packet(MpegTSSection *s, const uint8_t *packet)
354 354
 {
355 355
     AVFormatContext *ctx = s->opaque;
356
-    put_buffer(&ctx->pb, packet, TS_PACKET_SIZE);
356
+    put_buffer(ctx->pb, packet, TS_PACKET_SIZE);
357 357
 }
358 358
 
359 359
 static int mpegts_write_header(AVFormatContext *s)
... ...
@@ -431,7 +431,7 @@ static int mpegts_write_header(AVFormatContext *s)
431 431
     for(i = 0; i < ts->nb_services; i++) {
432 432
         mpegts_write_pmt(s, ts->services[i]);
433 433
     }
434
-    put_flush_packet(&s->pb);
434
+    put_flush_packet(s->pb);
435 435
 
436 436
     return 0;
437 437
 
... ...
@@ -608,9 +608,9 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
608 608
         memcpy(buf + TS_PACKET_SIZE - len, payload, len);
609 609
         payload += len;
610 610
         payload_size -= len;
611
-        put_buffer(&s->pb, buf, TS_PACKET_SIZE);
611
+        put_buffer(s->pb, buf, TS_PACKET_SIZE);
612 612
     }
613
-    put_flush_packet(&s->pb);
613
+    put_flush_packet(s->pb);
614 614
 }
615 615
 
616 616
 static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
... ...
@@ -668,7 +668,7 @@ static int mpegts_write_end(AVFormatContext *s)
668 668
                              ts_st->payload_pts, ts_st->payload_dts);
669 669
         }
670 670
     }
671
-    put_flush_packet(&s->pb);
671
+    put_flush_packet(s->pb);
672 672
 
673 673
     for(i = 0; i < ts->nb_services; i++) {
674 674
         service = ts->services[i];
... ...
@@ -29,8 +29,8 @@ static int mpjpeg_write_header(AVFormatContext *s)
29 29
     uint8_t buf1[256];
30 30
 
31 31
     snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
32
-    put_buffer(&s->pb, buf1, strlen(buf1));
33
-    put_flush_packet(&s->pb);
32
+    put_buffer(s->pb, buf1, strlen(buf1));
33
+    put_flush_packet(s->pb);
34 34
     return 0;
35 35
 }
36 36
 
... ...
@@ -39,12 +39,12 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
39 39
     uint8_t buf1[256];
40 40
 
41 41
     snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
42
-    put_buffer(&s->pb, buf1, strlen(buf1));
43
-    put_buffer(&s->pb, pkt->data, pkt->size);
42
+    put_buffer(s->pb, buf1, strlen(buf1));
43
+    put_buffer(s->pb, pkt->data, pkt->size);
44 44
 
45 45
     snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
46
-    put_buffer(&s->pb, buf1, strlen(buf1));
47
-    put_flush_packet(&s->pb);
46
+    put_buffer(s->pb, buf1, strlen(buf1));
47
+    put_flush_packet(s->pb);
48 48
     return 0;
49 49
 }
50 50
 
... ...
@@ -65,7 +65,7 @@ static int mtv_probe(AVProbeData *p)
65 65
 static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
66 66
 {
67 67
     MTVDemuxContext    *mtv = s->priv_data;
68
-    ByteIOContext      *pb  = &s->pb;
68
+    ByteIOContext      *pb  = s->pb;
69 69
     AVStream           *st;
70 70
 
71 71
 
... ...
@@ -131,7 +131,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
131 131
 static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
132 132
 {
133 133
     MTVDemuxContext *mtv = s->priv_data;
134
-    ByteIOContext *pb = &s->pb;
134
+    ByteIOContext *pb = s->pb;
135 135
     int ret;
136 136
 #ifndef WORDS_BIGENDIAN
137 137
     int i;
... ...
@@ -269,7 +269,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
269 269
 {
270 270
     static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
271 271
     MXFContext *mxf = s->priv_data;
272
-    ByteIOContext *pb = &s->pb;
272
+    ByteIOContext *pb = s->pb;
273 273
     offset_t end = url_ftell(pb) + klv->length;
274 274
     uint64_t size;
275 275
     uint64_t orig_size;
... ...
@@ -326,8 +326,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
326 326
 {
327 327
     KLVPacket klv;
328 328
 
329
-    while (!url_feof(&s->pb)) {
330
-        if (klv_read_packet(&klv, &s->pb) < 0)
329
+    while (!url_feof(s->pb)) {
330
+        if (klv_read_packet(&klv, s->pb) < 0)
331 331
             return -1;
332 332
 #ifdef DEBUG
333 333
         PRINT_KEY(s, "read packet", klv.key);
... ...
@@ -344,22 +344,22 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
344 344
             int index = mxf_get_stream_index(s, &klv);
345 345
             if (index < 0) {
346 346
                 av_log(s, AV_LOG_ERROR, "error getting stream index\n");
347
-                url_fskip(&s->pb, klv.length);
347
+                url_fskip(s->pb, klv.length);
348 348
                 return -1;
349 349
             }
350 350
             /* check for 8 channels AES3 element */
351 351
             if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
352
-                if (mxf_get_d10_aes3_packet(&s->pb, s->streams[index], pkt, klv.length) < 0) {
352
+                if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
353 353
                     av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
354 354
                     return -1;
355 355
                 }
356 356
             } else
357
-                av_get_packet(&s->pb, pkt, klv.length);
357
+                av_get_packet(s->pb, pkt, klv.length);
358 358
             pkt->stream_index = index;
359 359
             pkt->pos = klv.offset;
360 360
             return 0;
361 361
         } else
362
-            url_fskip(&s->pb, klv.length);
362
+            url_fskip(s->pb, klv.length);
363 363
     }
364 364
     return AVERROR(EIO);
365 365
 }
... ...
@@ -897,7 +897,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
897 897
 
898 898
 static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, int (*read_child)(), int ctx_size, enum MXFMetadataSetType type)
899 899
 {
900
-    ByteIOContext *pb = &mxf->fc->pb;
900
+    ByteIOContext *pb = mxf->fc->pb;
901 901
     MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
902 902
     uint64_t klv_end= url_ftell(pb) + klv->length;
903 903
 
... ...
@@ -926,16 +926,16 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
926 926
     MXFContext *mxf = s->priv_data;
927 927
     KLVPacket klv;
928 928
 
929
-    if (!mxf_read_sync(&s->pb, mxf_header_partition_pack_key, 14)) {
929
+    if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) {
930 930
         av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
931 931
         return -1;
932 932
     }
933
-    url_fseek(&s->pb, -14, SEEK_CUR);
933
+    url_fseek(s->pb, -14, SEEK_CUR);
934 934
     mxf->fc = s;
935
-    while (!url_feof(&s->pb)) {
935
+    while (!url_feof(s->pb)) {
936 936
         const MXFMetadataReadTableEntry *metadata;
937 937
 
938
-        if (klv_read_packet(&klv, &s->pb) < 0)
938
+        if (klv_read_packet(&klv, s->pb) < 0)
939 939
             return -1;
940 940
 #ifdef DEBUG
941 941
         PRINT_KEY(s, "read header", klv.key);
... ...
@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
943 943
         if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
944 944
             IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
945 945
             /* FIXME avoid seek */
946
-            url_fseek(&s->pb, klv.offset, SEEK_SET);
946
+            url_fseek(s->pb, klv.offset, SEEK_SET);
947 947
             break;
948 948
         }
949 949
 
... ...
@@ -957,7 +957,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
957 957
             }
958 958
         }
959 959
         if (!metadata->read)
960
-            url_fskip(&s->pb, klv.length);
960
+            url_fskip(s->pb, klv.length);
961 961
     }
962 962
     return mxf_parse_structural_metadata(mxf);
963 963
 }
... ...
@@ -1018,7 +1018,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
1018 1018
     if (sample_time < 0)
1019 1019
         sample_time = 0;
1020 1020
     seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
1021
-    url_fseek(&s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
1021
+    url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
1022 1022
     av_update_cur_dts(s, st, sample_time);
1023 1023
     return 0;
1024 1024
 }
... ...
@@ -228,7 +228,7 @@ static void print_tag(const char *str, unsigned int tag, int size)
228 228
 static int nsv_resync(AVFormatContext *s)
229 229
 {
230 230
     NSVContext *nsv = s->priv_data;
231
-    ByteIOContext *pb = &s->pb;
231
+    ByteIOContext *pb = s->pb;
232 232
     uint32_t v = 0;
233 233
     int i;
234 234
 
... ...
@@ -275,7 +275,7 @@ static int nsv_resync(AVFormatContext *s)
275 275
 static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
276 276
 {
277 277
     NSVContext *nsv = s->priv_data;
278
-    ByteIOContext *pb = &s->pb;
278
+    ByteIOContext *pb = s->pb;
279 279
     unsigned int file_size, size;
280 280
     int64_t duration;
281 281
     int strings_size;
... ...
@@ -394,7 +394,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
394 394
 static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
395 395
 {
396 396
     NSVContext *nsv = s->priv_data;
397
-    ByteIOContext *pb = &s->pb;
397
+    ByteIOContext *pb = s->pb;
398 398
     uint32_t vtag, atag;
399 399
     uint16_t vwidth, vheight;
400 400
     AVRational framerate;
... ...
@@ -533,7 +533,7 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
533 533
 static int nsv_read_chunk(AVFormatContext *s, int fill_header)
534 534
 {
535 535
     NSVContext *nsv = s->priv_data;
536
-    ByteIOContext *pb = &s->pb;
536
+    ByteIOContext *pb = s->pb;
537 537
     AVStream *st[2] = {NULL, NULL};
538 538
     NSVStream *nst;
539 539
     AVPacket *pkt;
... ...
@@ -181,7 +181,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){
181 181
 
182 182
 static int decode_main_header(NUTContext *nut){
183 183
     AVFormatContext *s= nut->avf;
184
-    ByteIOContext *bc = &s->pb;
184
+    ByteIOContext *bc = s->pb;
185 185
     uint64_t tmp, end;
186 186
     unsigned int stream_count;
187 187
     int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res;
... ...
@@ -268,7 +268,7 @@ static int decode_main_header(NUTContext *nut){
268 268
 
269 269
 static int decode_stream_header(NUTContext *nut){
270 270
     AVFormatContext *s= nut->avf;
271
-    ByteIOContext *bc = &s->pb;
271
+    ByteIOContext *bc = s->pb;
272 272
     StreamContext *stc;
273 273
     int class, stream_id;
274 274
     uint64_t tmp, end;
... ...
@@ -354,7 +354,7 @@ static int decode_stream_header(NUTContext *nut){
354 354
 
355 355
 static int decode_info_header(NUTContext *nut){
356 356
     AVFormatContext *s= nut->avf;
357
-    ByteIOContext *bc = &s->pb;
357
+    ByteIOContext *bc = s->pb;
358 358
     uint64_t tmp;
359 359
     unsigned int stream_id_plus1, chapter_start, chapter_len, count;
360 360
     int chapter_id, i;
... ...
@@ -412,7 +412,7 @@ static int decode_info_header(NUTContext *nut){
412 412
 
413 413
 static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
414 414
     AVFormatContext *s= nut->avf;
415
-    ByteIOContext *bc = &s->pb;
415
+    ByteIOContext *bc = s->pb;
416 416
     int64_t end, tmp;
417 417
 
418 418
     nut->last_syncpoint_pos= url_ftell(bc)-8;
... ...
@@ -440,7 +440,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
440 440
 
441 441
 static int find_and_decode_index(NUTContext *nut){
442 442
     AVFormatContext *s= nut->avf;
443
-    ByteIOContext *bc = &s->pb;
443
+    ByteIOContext *bc = s->pb;
444 444
     uint64_t tmp, end;
445 445
     int i, j, syncpoint_count;
446 446
     int64_t filesize= url_fsize(bc);
... ...
@@ -531,7 +531,7 @@ static int find_and_decode_index(NUTContext *nut){
531 531
 static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
532 532
 {
533 533
     NUTContext *nut = s->priv_data;
534
-    ByteIOContext *bc = &s->pb;
534
+    ByteIOContext *bc = s->pb;
535 535
     int64_t pos;
536 536
     int inited_stream_count;
537 537
 
... ...
@@ -592,7 +592,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
592 592
 
593 593
 static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, int frame_code){
594 594
     AVFormatContext *s= nut->avf;
595
-    ByteIOContext *bc = &s->pb;
595
+    ByteIOContext *bc = s->pb;
596 596
     StreamContext *stc;
597 597
     int size, flags, size_mul, pts_delta, i, reserved_count;
598 598
     uint64_t tmp;
... ...
@@ -648,7 +648,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, in
648 648
 
649 649
 static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
650 650
     AVFormatContext *s= nut->avf;
651
-    ByteIOContext *bc = &s->pb;
651
+    ByteIOContext *bc = s->pb;
652 652
     int size, stream_id, discard;
653 653
     int64_t pts, last_IP_pts;
654 654
     StreamContext *stc;
... ...
@@ -684,7 +684,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
684 684
 static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
685 685
 {
686 686
     NUTContext *nut = s->priv_data;
687
-    ByteIOContext *bc = &s->pb;
687
+    ByteIOContext *bc = s->pb;
688 688
     int i, frame_code=0, ret, skip;
689 689
     int64_t ts, back_ptr;
690 690
 
... ...
@@ -740,7 +740,7 @@ av_log(s, AV_LOG_DEBUG, "sync\n");
740 740
 
741 741
 static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){
742 742
     NUTContext *nut = s->priv_data;
743
-    ByteIOContext *bc = &s->pb;
743
+    ByteIOContext *bc = s->pb;
744 744
     int64_t pos, pts, back_ptr;
745 745
 av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);
746 746
 
... ...
@@ -803,8 +803,8 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
803 803
         pos2= sp->back_ptr  - 15;
804 804
     }
805 805
     av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
806
-    pos= find_startcode(&s->pb, SYNCPOINT_STARTCODE, pos2);
807
-    url_fseek(&s->pb, pos, SEEK_SET);
806
+    pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
807
+    url_fseek(s->pb, pos, SEEK_SET);
808 808
     av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
809 809
     if(pos2 > pos || pos2 + 15 < pos){
810 810
         av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
... ...
@@ -324,19 +324,20 @@ static int add_info(ByteIOContext *bc, char *type, char *value){
324 324
     return 1;
325 325
 }
326 326
 
327
-static void write_globalinfo(NUTContext *nut, ByteIOContext *bc){
327
+static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
328 328
     AVFormatContext *s= nut->avf;
329
-    ByteIOContext dyn_bc;
329
+    ByteIOContext *dyn_bc;
330 330
     uint8_t *dyn_buf=NULL;
331 331
     int count=0, dyn_size;
332
+    int ret = url_open_dyn_buf(&dyn_bc);
333
+    if(ret < 0)
334
+        return ret;
332 335
 
333
-    url_open_dyn_buf(&dyn_bc);
334
-
335
-    if(s->title    [0]) count+= add_info(&dyn_bc, "Title"    , s->title);
336
-    if(s->author   [0]) count+= add_info(&dyn_bc, "Author"   , s->author);
337
-    if(s->copyright[0]) count+= add_info(&dyn_bc, "Copyright", s->copyright);
336
+    if(s->title    [0]) count+= add_info(dyn_bc, "Title"    , s->title);
337
+    if(s->author   [0]) count+= add_info(dyn_bc, "Author"   , s->author);
338
+    if(s->copyright[0]) count+= add_info(dyn_bc, "Copyright", s->copyright);
338 339
     if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
339
-                        count+= add_info(&dyn_bc, "Encoder"  , LIBAVFORMAT_IDENT);
340
+                        count+= add_info(dyn_bc, "Encoder"  , LIBAVFORMAT_IDENT);
340 341
 
341 342
     put_v(bc, 0); //stream_if_plus1
342 343
     put_v(bc, 0); //chapter_id
... ...
@@ -345,38 +346,46 @@ static void write_globalinfo(NUTContext *nut, ByteIOContext *bc){
345 345
 
346 346
     put_v(bc, count);
347 347
 
348
-    dyn_size= url_close_dyn_buf(&dyn_bc, &dyn_buf);
348
+    dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
349 349
     put_buffer(bc, dyn_buf, dyn_size);
350 350
     av_free(dyn_buf);
351
+    return 0;
351 352
 }
352 353
 
353
-static void write_headers(NUTContext *nut, ByteIOContext *bc){
354
-    ByteIOContext dyn_bc;
355
-    int i;
354
+static int write_headers(NUTContext *nut, ByteIOContext *bc){
355
+    ByteIOContext *dyn_bc;
356
+    int i, ret;
356 357
 
357
-    url_open_dyn_buf(&dyn_bc);
358
-    write_mainheader(nut, &dyn_bc);
359
-    put_packet(nut, bc, &dyn_bc, 1, MAIN_STARTCODE);
358
+    ret = url_open_dyn_buf(&dyn_bc);
359
+    if(ret < 0)
360
+        return ret;
361
+    write_mainheader(nut, dyn_bc);
362
+    put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
360 363
 
361 364
     for (i=0; i < nut->avf->nb_streams; i++){
362 365
         AVCodecContext *codec = nut->avf->streams[i]->codec;
363 366
 
364
-        url_open_dyn_buf(&dyn_bc);
365
-        write_streamheader(nut, &dyn_bc, codec, i);
366
-        put_packet(nut, bc, &dyn_bc, 1, STREAM_STARTCODE);
367
+        ret = url_open_dyn_buf(&dyn_bc);
368
+        if(ret < 0)
369
+            return ret;
370
+        write_streamheader(nut, dyn_bc, codec, i);
371
+        put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
367 372
     }
368 373
 
369
-    url_open_dyn_buf(&dyn_bc);
370
-    write_globalinfo(nut, &dyn_bc);
371
-    put_packet(nut, bc, &dyn_bc, 1, INFO_STARTCODE);
374
+    ret = url_open_dyn_buf(&dyn_bc);
375
+    if(ret < 0)
376
+        return ret;
377
+    write_globalinfo(nut, dyn_bc);
378
+    put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
372 379
 
373 380
     nut->last_syncpoint_pos= INT_MIN;
374 381
     nut->header_count++;
382
+    return 0;
375 383
 }
376 384
 
377 385
 static int write_header(AVFormatContext *s){
378 386
     NUTContext *nut = s->priv_data;
379
-    ByteIOContext *bc = &s->pb;
387
+    ByteIOContext *bc = s->pb;
380 388
     int i, j;
381 389
 
382 390
     nut->avf= s;
... ...
@@ -441,12 +450,13 @@ static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc,
441 441
 static int write_packet(AVFormatContext *s, AVPacket *pkt){
442 442
     NUTContext *nut = s->priv_data;
443 443
     StreamContext *nus= &nut->stream[pkt->stream_index];
444
-    ByteIOContext *bc = &s->pb, dyn_bc;
444
+    ByteIOContext *bc = s->pb, *dyn_bc;
445 445
     FrameCode *fc;
446 446
     int64_t coded_pts;
447 447
     int best_length, frame_code, flags, needed_flags, i;
448 448
     int key_frame = !!(pkt->flags & PKT_FLAG_KEY);
449 449
     int store_sp=0;
450
+    int ret;
450 451
 
451 452
     if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
452 453
         write_headers(nut, bc);
... ...
@@ -472,10 +482,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
472 472
         sp= av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pos_cmp, NULL);
473 473
 
474 474
         nut->last_syncpoint_pos= url_ftell(bc);
475
-        url_open_dyn_buf(&dyn_bc);
476
-        put_t(nut, nus, &dyn_bc, pkt->dts);
477
-        put_v(&dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
478
-        put_packet(nut, bc, &dyn_bc, 1, SYNCPOINT_STARTCODE);
475
+        ret = url_open_dyn_buf(&dyn_bc);
476
+        if(ret < 0)
477
+            return ret;
478
+        put_t(nut, nus, dyn_bc, pkt->dts);
479
+        put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
480
+        put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
479 481
 
480 482
         ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0/*unused*/, pkt->dts);
481 483
     }
... ...
@@ -566,7 +578,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
566 566
 
567 567
 static int write_trailer(AVFormatContext *s){
568 568
     NUTContext *nut= s->priv_data;
569
-    ByteIOContext *bc= &s->pb;
569
+    ByteIOContext *bc= s->pb;
570 570
 
571 571
     while(nut->header_count<3)
572 572
         write_headers(nut, bc);
... ...
@@ -120,7 +120,7 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
120 120
 
121 121
 static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
122 122
     NUVContext *ctx = s->priv_data;
123
-    ByteIOContext *pb = &s->pb;
123
+    ByteIOContext *pb = s->pb;
124 124
     char id_string[12], version_string[5];
125 125
     double aspect, fps;
126 126
     int is_mythtv, width, height, v_packs, a_packs;
... ...
@@ -183,7 +183,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
183 183
 
184 184
 static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
185 185
     NUVContext *ctx = s->priv_data;
186
-    ByteIOContext *pb = &s->pb;
186
+    ByteIOContext *pb = s->pb;
187 187
     uint8_t hdr[HDRSIZE];
188 188
     frametype_t frametype;
189 189
     int ret, size;
... ...
@@ -56,7 +56,7 @@ ogg_save (AVFormatContext * s)
56 56
     ogg_state_t *ost =
57 57
         av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
58 58
     int i;
59
-    ost->pos = url_ftell (&s->pb);;
59
+    ost->pos = url_ftell (s->pb);
60 60
     ost->curidx = ogg->curidx;
61 61
     ost->next = ogg->state;
62 62
     ost->nstreams = ogg->nstreams;
... ...
@@ -78,7 +78,7 @@ static int
78 78
 ogg_restore (AVFormatContext * s, int discard)
79 79
 {
80 80
     ogg_t *ogg = s->priv_data;
81
-    ByteIOContext *bc = &s->pb;
81
+    ByteIOContext *bc = s->pb;
82 82
     ogg_state_t *ost = ogg->state;
83 83
     int i;
84 84
 
... ...
@@ -196,7 +196,7 @@ ogg_new_buf(ogg_t *ogg, int idx)
196 196
 static int
197 197
 ogg_read_page (AVFormatContext * s, int *str)
198 198
 {
199
-    ByteIOContext *bc = &s->pb;
199
+    ByteIOContext *bc = s->pb;
200 200
     ogg_t *ogg = s->priv_data;
201 201
     ogg_stream_t *os;
202 202
     int i = 0;
... ...
@@ -438,20 +438,20 @@ ogg_get_length (AVFormatContext * s)
438 438
     int idx = -1, i;
439 439
     offset_t size, end;
440 440
 
441
-    if(s->pb.is_streamed)
441
+    if(s->pb->is_streamed)
442 442
         return 0;
443 443
 
444 444
 // already set
445 445
     if (s->duration != AV_NOPTS_VALUE)
446 446
         return 0;
447 447
 
448
-    size = url_fsize(&s->pb);
448
+    size = url_fsize(s->pb);
449 449
     if(size < 0)
450 450
         return 0;
451 451
     end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: size;
452 452
 
453 453
     ogg_save (s);
454
-    url_fseek (&s->pb, end, SEEK_SET);
454
+    url_fseek (s->pb, end, SEEK_SET);
455 455
 
456 456
     while (!ogg_read_page (s, &i)){
457 457
         if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
... ...
@@ -552,7 +552,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
552 552
                     int64_t pos_limit)
553 553
 {
554 554
     ogg_t *ogg = s->priv_data;
555
-    ByteIOContext *bc = &s->pb;
555
+    ByteIOContext *bc = s->pb;
556 556
     int64_t pts = AV_NOPTS_VALUE;
557 557
     int i;
558 558
     url_fseek(bc, *pos_arg, SEEK_SET);
... ...
@@ -37,11 +37,11 @@ typedef struct {
37 37
 
38 38
 static void ogg_update_checksum(AVFormatContext *s, offset_t crc_offset)
39 39
 {
40
-    offset_t pos = url_ftell(&s->pb);
41
-    uint32_t checksum = get_checksum(&s->pb);
42
-    url_fseek(&s->pb, crc_offset, SEEK_SET);
43
-    put_be32(&s->pb, checksum);
44
-    url_fseek(&s->pb, pos, SEEK_SET);
40
+    offset_t pos = url_ftell(s->pb);
41
+    uint32_t checksum = get_checksum(s->pb);
42
+    url_fseek(s->pb, crc_offset, SEEK_SET);
43
+    put_be32(s->pb, checksum);
44
+    url_fseek(s->pb, pos, SEEK_SET);
45 45
 }
46 46
 
47 47
 static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
... ...
@@ -54,24 +54,24 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
54 54
     size = FFMIN(size, 255*255);
55 55
     page_segments = FFMIN((size/255)+!!size, 255);
56 56
 
57
-    init_checksum(&s->pb, ff_crc04C11DB7_update, 0);
58
-    put_tag(&s->pb, "OggS");
59
-    put_byte(&s->pb, 0);
60
-    put_byte(&s->pb, flags);
61
-    put_le64(&s->pb, granule);
62
-    put_le32(&s->pb, stream_index);
63
-    put_le32(&s->pb, oggstream->page_counter++);
64
-    crc_offset = url_ftell(&s->pb);
65
-    put_le32(&s->pb, 0); // crc
66
-    put_byte(&s->pb, page_segments);
57
+    init_checksum(s->pb, ff_crc04C11DB7_update, 0);
58
+    put_tag(s->pb, "OggS");
59
+    put_byte(s->pb, 0);
60
+    put_byte(s->pb, flags);
61
+    put_le64(s->pb, granule);
62
+    put_le32(s->pb, stream_index);
63
+    put_le32(s->pb, oggstream->page_counter++);
64
+    crc_offset = url_ftell(s->pb);
65
+    put_le32(s->pb, 0); // crc
66
+    put_byte(s->pb, page_segments);
67 67
     for (i = 0; i < page_segments-1; i++)
68
-        put_byte(&s->pb, 255);
68
+        put_byte(s->pb, 255);
69 69
     if (size) {
70
-        put_byte(&s->pb, size - (page_segments-1)*255);
71
-        put_buffer(&s->pb, data, size);
70
+        put_byte(s->pb, size - (page_segments-1)*255);
71
+        put_buffer(s->pb, data, size);
72 72
     }
73 73
     ogg_update_checksum(s, crc_offset);
74
-    put_flush_packet(&s->pb);
74
+    put_flush_packet(s->pb);
75 75
     return size;
76 76
 }
77 77
 
... ...
@@ -125,7 +125,7 @@ static void dump(unsigned char *buf,size_t len)
125 125
 static int str_read_header(AVFormatContext *s,
126 126
                            AVFormatParameters *ap)
127 127
 {
128
-    ByteIOContext *pb = &s->pb;
128
+    ByteIOContext *pb = s->pb;
129 129
     StrDemuxContext *str = s->priv_data;
130 130
     AVStream *st;
131 131
     unsigned char sector[RAW_CD_SECTOR_SIZE];
... ...
@@ -249,7 +249,7 @@ if (str->audio_channel != -1)
249 249
 static int str_read_packet(AVFormatContext *s,
250 250
                            AVPacket *ret_pkt)
251 251
 {
252
-    ByteIOContext *pb = &s->pb;
252
+    ByteIOContext *pb = s->pb;
253 253
     StrDemuxContext *str = s->priv_data;
254 254
     unsigned char sector[RAW_CD_SECTOR_SIZE];
255 255
     int channel;
... ...
@@ -33,8 +33,8 @@ static int flac_write_header(struct AVFormatContext *s)
33 33
     uint8_t *streaminfo = s->streams[0]->codec->extradata;
34 34
     int len = s->streams[0]->codec->extradata_size;
35 35
     if(streaminfo != NULL && len > 0) {
36
-        put_buffer(&s->pb, header, 8);
37
-        put_buffer(&s->pb, streaminfo, len);
36
+        put_buffer(s->pb, header, 8);
37
+        put_buffer(s->pb, streaminfo, len);
38 38
     }
39 39
     return 0;
40 40
 }
... ...
@@ -46,16 +46,16 @@ static int roq_write_header(struct AVFormatContext *s)
46 46
         0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
47 47
     };
48 48
 
49
-    put_buffer(&s->pb, header, 8);
50
-    put_flush_packet(&s->pb);
49
+    put_buffer(s->pb, header, 8);
50
+    put_flush_packet(s->pb);
51 51
 
52 52
     return 0;
53 53
 }
54 54
 
55 55
 static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
56 56
 {
57
-    put_buffer(&s->pb, pkt->data, pkt->size);
58
-    put_flush_packet(&s->pb);
57
+    put_buffer(s->pb, pkt->data, pkt->size);
58
+    put_flush_packet(s->pb);
59 59
     return 0;
60 60
 }
61 61
 #endif //CONFIG_MUXERS
... ...
@@ -107,7 +107,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
107 107
 
108 108
     size= RAW_PACKET_SIZE;
109 109
 
110
-    ret= av_get_packet(&s->pb, pkt, size);
110
+    ret= av_get_packet(s->pb, pkt, size);
111 111
 
112 112
     pkt->stream_index = 0;
113 113
     if (ret <= 0) {
... ...
@@ -128,9 +128,9 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
128 128
     if (av_new_packet(pkt, size) < 0)
129 129
         return AVERROR(EIO);
130 130
 
131
-    pkt->pos= url_ftell(&s->pb);
131
+    pkt->pos= url_ftell(s->pb);
132 132
     pkt->stream_index = 0;
133
-    ret = get_partial_buffer(&s->pb, pkt->data, size);
133
+    ret = get_partial_buffer(s->pb, pkt->data, size);
134 134
     if (ret <= 0) {
135 135
         av_free_packet(pkt);
136 136
         return AVERROR(EIO);
... ...
@@ -144,19 +144,19 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
144 144
 {
145 145
     int ret, size, w, h, unk1, unk2;
146 146
 
147
-    if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
147
+    if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
148 148
         return AVERROR(EIO); // FIXME
149 149
 
150
-    size = get_le32(&s->pb);
150
+    size = get_le32(s->pb);
151 151
 
152
-    w = get_le16(&s->pb);
153
-    h = get_le16(&s->pb);
152
+    w = get_le16(s->pb);
153
+    h = get_le16(s->pb);
154 154
 
155
-    url_fskip(&s->pb, 8); // zero + size (padded?)
156
-    url_fskip(&s->pb, 2);
157
-    unk1 = get_le16(&s->pb);
158
-    unk2 = get_le16(&s->pb);
159
-    url_fskip(&s->pb, 22); // ascii timestamp
155
+    url_fskip(s->pb, 8); // zero + size (padded?)
156
+    url_fskip(s->pb, 2);
157
+    unk1 = get_le16(s->pb);
158
+    unk2 = get_le16(s->pb);
159
+    url_fskip(s->pb, 22); // ascii timestamp
160 160
 
161 161
     av_log(NULL, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
162 162
         size, w, h, unk1, unk2);
... ...
@@ -164,9 +164,9 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
164 164
     if (av_new_packet(pkt, size) < 0)
165 165
         return AVERROR(EIO);
166 166
 
167
-    pkt->pos = url_ftell(&s->pb);
167
+    pkt->pos = url_ftell(s->pb);
168 168
     pkt->stream_index = 0;
169
-    ret = get_buffer(&s->pb, pkt->data, size);
169
+    ret = get_buffer(s->pb, pkt->data, size);
170 170
     if (ret <= 0) {
171 171
         av_free_packet(pkt);
172 172
         return AVERROR(EIO);
... ...
@@ -206,7 +206,7 @@ int pcm_read_seek(AVFormatContext *s,
206 206
 
207 207
     /* recompute exact position */
208 208
     st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
209
-    url_fseek(&s->pb, pos + s->data_offset, SEEK_SET);
209
+    url_fseek(s->pb, pos + s->data_offset, SEEK_SET);
210 210
     return 0;
211 211
 }
212 212
 
... ...
@@ -843,7 +843,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
843 843
     if (packet_size < 0)
844 844
         return -1;
845 845
 
846
-    ret= av_get_packet(&s->pb, pkt, packet_size);
846
+    ret= av_get_packet(s->pb, pkt, packet_size);
847 847
 
848 848
     pkt->stream_index = 0;
849 849
     if (ret != packet_size) {
... ...
@@ -50,7 +50,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
50 50
                                       int read_all)
51 51
 {
52 52
     RMContext *rm = s->priv_data;
53
-    ByteIOContext *pb = &s->pb;
53
+    ByteIOContext *pb = s->pb;
54 54
     char buf[256];
55 55
     uint32_t version;
56 56
     int i;
... ...
@@ -191,7 +191,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
191 191
 static int
192 192
 ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVStream *st)
193 193
 {
194
-    ByteIOContext *pb = &s->pb;
194
+    ByteIOContext *pb = s->pb;
195 195
     unsigned int v;
196 196
     int codec_data_size, size;
197 197
     int64_t codec_pos;
... ...
@@ -272,7 +272,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
272 272
 {
273 273
     RMContext *rm = s->priv_data;
274 274
     AVStream *st;
275
-    ByteIOContext *pb = &s->pb;
275
+    ByteIOContext *pb = s->pb;
276 276
     unsigned int tag;
277 277
     int tag_size, i;
278 278
     unsigned int start_time, duration;
... ...
@@ -395,7 +395,7 @@ static int get_num(ByteIOContext *pb, int *len)
395 395
 
396 396
 static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
397 397
     RMContext *rm = s->priv_data;
398
-    ByteIOContext *pb = &s->pb;
398
+    ByteIOContext *pb = s->pb;
399 399
     int len, num, res, i;
400 400
     AVStream *st;
401 401
     uint32_t state=0xFFFFFFFF;
... ...
@@ -451,7 +451,7 @@ skip:
451 451
 
452 452
 static int rm_assemble_video_frame(AVFormatContext *s, RMContext *rm, AVPacket *pkt, int len)
453 453
 {
454
-    ByteIOContext *pb = &s->pb;
454
+    ByteIOContext *pb = s->pb;
455 455
     int hdr, seq, pic_num, len2, pos;
456 456
     int type;
457 457
 
... ...
@@ -550,7 +550,7 @@ static int
550 550
 ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
551 551
                     int *seq, int *flags, int64_t *timestamp)
552 552
 {
553
-    ByteIOContext *pb = &s->pb;
553
+    ByteIOContext *pb = s->pb;
554 554
     RMContext *rm = s->priv_data;
555 555
 
556 556
     if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
... ...
@@ -647,7 +647,7 @@ ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
647 647
 static void
648 648
 ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt)
649 649
 {
650
-    ByteIOContext *pb = &s->pb;
650
+    ByteIOContext *pb = s->pb;
651 651
     RMContext *rm = s->priv_data;
652 652
 
653 653
     assert (rm->audio_pkt_cnt > 0);
... ...
@@ -668,7 +668,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt)
668 668
 static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
669 669
 {
670 670
     RMContext *rm = s->priv_data;
671
-    ByteIOContext *pb = &s->pb;
671
+    ByteIOContext *pb = s->pb;
672 672
     AVStream *st;
673 673
     int i, len;
674 674
     int64_t timestamp, pos;
... ...
@@ -759,7 +759,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
759 759
     if(rm->old_format)
760 760
         return AV_NOPTS_VALUE;
761 761
 
762
-    url_fseek(&s->pb, pos, SEEK_SET);
762
+    url_fseek(s->pb, pos, SEEK_SET);
763 763
     rm->remaining_len=0;
764 764
     for(;;){
765 765
         int seq=1;
... ...
@@ -771,9 +771,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
771 771
 
772 772
         st = s->streams[stream_index2];
773 773
         if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
774
-            h= get_byte(&s->pb); len--;
774
+            h= get_byte(s->pb); len--;
775 775
             if(!(h & 0x40)){
776
-                seq = get_byte(&s->pb); len--;
776
+                seq = get_byte(s->pb); len--;
777 777
             }
778 778
         }
779 779
 
... ...
@@ -784,7 +784,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
784 784
                 break;
785 785
         }
786 786
 
787
-        url_fskip(&s->pb, len);
787
+        url_fskip(s->pb, len);
788 788
     }
789 789
     *ppos = pos;
790 790
     return dts;
... ...
@@ -45,7 +45,7 @@ static void rv10_write_header(AVFormatContext *ctx,
45 45
                               int data_size, int index_pos)
46 46
 {
47 47
     RMContext *rm = ctx->priv_data;
48
-    ByteIOContext *s = &ctx->pb;
48
+    ByteIOContext *s = ctx->pb;
49 49
     StreamInfo *stream;
50 50
     unsigned char *data_offset_ptr, *start_ptr;
51 51
     const char *desc, *mimetype;
... ...
@@ -253,7 +253,7 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
253 253
                                 int length, int key_frame)
254 254
 {
255 255
     int timestamp;
256
-    ByteIOContext *s = &ctx->pb;
256
+    ByteIOContext *s = ctx->pb;
257 257
 
258 258
     stream->nb_packets++;
259 259
     stream->packet_total_size += length;
... ...
@@ -308,7 +308,7 @@ static int rm_write_header(AVFormatContext *s)
308 308
     }
309 309
 
310 310
     rv10_write_header(s, 0, 0);
311
-    put_flush_packet(&s->pb);
311
+    put_flush_packet(s->pb);
312 312
     return 0;
313 313
 }
314 314
 
... ...
@@ -316,7 +316,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
316 316
 {
317 317
     uint8_t *buf1;
318 318
     RMContext *rm = s->priv_data;
319
-    ByteIOContext *pb = &s->pb;
319
+    ByteIOContext *pb = s->pb;
320 320
     StreamInfo *stream = rm->audio_stream;
321 321
     int i;
322 322
 
... ...
@@ -340,7 +340,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
340 340
 static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags)
341 341
 {
342 342
     RMContext *rm = s->priv_data;
343
-    ByteIOContext *pb = &s->pb;
343
+    ByteIOContext *pb = s->pb;
344 344
     StreamInfo *stream = rm->video_stream;
345 345
     int key_frame = !!(flags & PKT_FLAG_KEY);
346 346
 
... ...
@@ -390,9 +390,9 @@ static int rm_write_trailer(AVFormatContext *s)
390 390
 {
391 391
     RMContext *rm = s->priv_data;
392 392
     int data_size, index_pos, i;
393
-    ByteIOContext *pb = &s->pb;
393
+    ByteIOContext *pb = s->pb;
394 394
 
395
-    if (!url_is_streamed(&s->pb)) {
395
+    if (!url_is_streamed(s->pb)) {
396 396
         /* end of file: finish to write header */
397 397
         index_pos = url_fseek(pb, 0, SEEK_CUR);
398 398
         data_size = index_pos - rm->data_pos;
... ...
@@ -360,7 +360,7 @@ static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32
360 360
 
361 361
 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
362 362
 {
363
-    ByteIOContext pb;
363
+    ByteIOContext *pb;
364 364
     uint8_t *buf;
365 365
     int len;
366 366
     int rtcp_bytes;
... ...
@@ -391,11 +391,11 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
391 391
         return -1;
392 392
 
393 393
     // Receiver Report
394
-    put_byte(&pb, (RTP_VERSION << 6) + 1); /* 1 report block */
395
-    put_byte(&pb, 201);
396
-    put_be16(&pb, 7); /* length in words - 1 */
397
-    put_be32(&pb, s->ssrc); // our own SSRC
398
-    put_be32(&pb, s->ssrc); // XXX: should be the server's here!
394
+    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
395
+    put_byte(pb, 201);
396
+    put_be16(pb, 7); /* length in words - 1 */
397
+    put_be32(pb, s->ssrc); // our own SSRC
398
+    put_be32(pb, s->ssrc); // XXX: should be the server's here!
399 399
     // some placeholders we should really fill...
400 400
     // RFC 1889/p64
401 401
     extended_max= stats->cycles + stats->max_seq;
... ...
@@ -412,38 +412,38 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
412 412
 
413 413
     fraction= (fraction<<24) | lost;
414 414
 
415
-    put_be32(&pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
416
-    put_be32(&pb, extended_max); /* max sequence received */
417
-    put_be32(&pb, stats->jitter>>4); /* jitter */
415
+    put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
416
+    put_be32(pb, extended_max); /* max sequence received */
417
+    put_be32(pb, stats->jitter>>4); /* jitter */
418 418
 
419 419
     if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
420 420
     {
421
-        put_be32(&pb, 0); /* last SR timestamp */
422
-        put_be32(&pb, 0); /* delay since last SR */
421
+        put_be32(pb, 0); /* last SR timestamp */
422
+        put_be32(pb, 0); /* delay since last SR */
423 423
     } else {
424 424
         uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
425 425
         uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
426 426
 
427
-        put_be32(&pb, middle_32_bits); /* last SR timestamp */
428
-        put_be32(&pb, delay_since_last); /* delay since last SR */
427
+        put_be32(pb, middle_32_bits); /* last SR timestamp */
428
+        put_be32(pb, delay_since_last); /* delay since last SR */
429 429
     }
430 430
 
431 431
     // CNAME
432
-    put_byte(&pb, (RTP_VERSION << 6) + 1); /* 1 report block */
433
-    put_byte(&pb, 202);
432
+    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
433
+    put_byte(pb, 202);
434 434
     len = strlen(s->hostname);
435
-    put_be16(&pb, (6 + len + 3) / 4); /* length in words - 1 */
436
-    put_be32(&pb, s->ssrc);
437
-    put_byte(&pb, 0x01);
438
-    put_byte(&pb, len);
439
-    put_buffer(&pb, s->hostname, len);
435
+    put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */
436
+    put_be32(pb, s->ssrc);
437
+    put_byte(pb, 0x01);
438
+    put_byte(pb, len);
439
+    put_buffer(pb, s->hostname, len);
440 440
     // padding
441 441
     for (len = (6 + len) % 4; len % 4; len++) {
442
-        put_byte(&pb, 0);
442
+        put_byte(pb, 0);
443 443
     }
444 444
 
445
-    put_flush_packet(&pb);
446
-    len = url_close_dyn_buf(&pb, &buf);
445
+    put_flush_packet(pb);
446
+    len = url_close_dyn_buf(pb, &buf);
447 447
     if ((len > 0) && buf) {
448 448
         int result;
449 449
 #if defined(DEBUG)
... ...
@@ -775,7 +775,7 @@ static int rtp_write_header(AVFormatContext *s1)
775 775
     s->first_packet = 1;
776 776
     s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
777 777
 
778
-    max_packet_size = url_fget_max_packet_size(&s1->pb);
778
+    max_packet_size = url_fget_max_packet_size(s1->pb);
779 779
     if (max_packet_size <= 12)
780 780
         return AVERROR(EIO);
781 781
     s->max_payload_size = max_packet_size - 12;
... ...
@@ -838,16 +838,16 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
838 838
     s->last_rtcp_ntp_time = ntp_time;
839 839
     rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, AV_TIME_BASE_Q,
840 840
                           s1->streams[0]->time_base) + s->base_timestamp;
841
-    put_byte(&s1->pb, (RTP_VERSION << 6));
842
-    put_byte(&s1->pb, 200);
843
-    put_be16(&s1->pb, 6); /* length in words - 1 */
844
-    put_be32(&s1->pb, s->ssrc);
845
-    put_be32(&s1->pb, ntp_time / 1000000);
846
-    put_be32(&s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
847
-    put_be32(&s1->pb, rtp_ts);
848
-    put_be32(&s1->pb, s->packet_count);
849
-    put_be32(&s1->pb, s->octet_count);
850
-    put_flush_packet(&s1->pb);
841
+    put_byte(s1->pb, (RTP_VERSION << 6));
842
+    put_byte(s1->pb, 200);
843
+    put_be16(s1->pb, 6); /* length in words - 1 */
844
+    put_be32(s1->pb, s->ssrc);
845
+    put_be32(s1->pb, ntp_time / 1000000);
846
+    put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
847
+    put_be32(s1->pb, rtp_ts);
848
+    put_be32(s1->pb, s->packet_count);
849
+    put_be32(s1->pb, s->octet_count);
850
+    put_flush_packet(s1->pb);
851 851
 }
852 852
 
853 853
 /* send an rtp packet. sequence number is incremented, but the caller
... ...
@@ -861,14 +861,14 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
861 861
 #endif
862 862
 
863 863
     /* build the RTP header */
864
-    put_byte(&s1->pb, (RTP_VERSION << 6));
865
-    put_byte(&s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
866
-    put_be16(&s1->pb, s->seq);
867
-    put_be32(&s1->pb, s->timestamp);
868
-    put_be32(&s1->pb, s->ssrc);
869
-
870
-    put_buffer(&s1->pb, buf1, len);
871
-    put_flush_packet(&s1->pb);
864
+    put_byte(s1->pb, (RTP_VERSION << 6));
865
+    put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
866
+    put_be16(s1->pb, s->seq);
867
+    put_be32(s1->pb, s->timestamp);
868
+    put_be32(s1->pb, s->ssrc);
869
+
870
+    put_buffer(s1->pb, buf1, len);
871
+    put_flush_packet(s1->pb);
872 872
 
873 873
     s->seq++;
874 874
     s->octet_count += len;
... ...
@@ -1351,7 +1351,7 @@ static int sdp_read_header(AVFormatContext *s,
1351 1351
     /* read the whole sdp file */
1352 1352
     /* XXX: better loading */
1353 1353
     content = av_malloc(SDP_MAX_SIZE);
1354
-    size = get_buffer(&s->pb, content, SDP_MAX_SIZE - 1);
1354
+    size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1355 1355
     if (size <= 0) {
1356 1356
         av_free(content);
1357 1357
         return AVERROR_INVALIDDATA;
... ...
@@ -76,7 +76,7 @@ static int film_read_header(AVFormatContext *s,
76 76
                             AVFormatParameters *ap)
77 77
 {
78 78
     FilmDemuxContext *film = s->priv_data;
79
-    ByteIOContext *pb = &s->pb;
79
+    ByteIOContext *pb = s->pb;
80 80
     AVStream *st;
81 81
     unsigned char scratch[256];
82 82
     int i;
... ...
@@ -204,7 +204,7 @@ static int film_read_packet(AVFormatContext *s,
204 204
                             AVPacket *pkt)
205 205
 {
206 206
     FilmDemuxContext *film = s->priv_data;
207
-    ByteIOContext *pb = &s->pb;
207
+    ByteIOContext *pb = s->pb;
208 208
     film_sample_t *sample;
209 209
     int ret = 0;
210 210
     int i;
... ...
@@ -72,7 +72,7 @@ static int vmd_read_header(AVFormatContext *s,
72 72
                            AVFormatParameters *ap)
73 73
 {
74 74
     VmdDemuxContext *vmd = s->priv_data;
75
-    ByteIOContext *pb = &s->pb;
75
+    ByteIOContext *pb = s->pb;
76 76
     AVStream *st, *vst;
77 77
     unsigned int toc_offset;
78 78
     unsigned char *raw_frame_table;
... ...
@@ -245,7 +245,7 @@ static int vmd_read_packet(AVFormatContext *s,
245 245
                            AVPacket *pkt)
246 246
 {
247 247
     VmdDemuxContext *vmd = s->priv_data;
248
-    ByteIOContext *pb = &s->pb;
248
+    ByteIOContext *pb = s->pb;
249 249
     int ret = 0;
250 250
     vmd_frame_t *frame;
251 251
 
... ...
@@ -153,7 +153,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb
153 153
 
154 154
 static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
155 155
 {
156
-    ByteIOContext *pb = &s->pb;
156
+    ByteIOContext *pb = s->pb;
157 157
     SIFFContext *c = s->priv_data;
158 158
     uint32_t tag;
159 159
 
... ...
@@ -189,12 +189,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
189 189
         if (c->cur_frame >= c->frames)
190 190
             return AVERROR(EIO);
191 191
         if (c->curstrm == -1){
192
-            c->pktsize = get_le32(&s->pb) - 4;
193
-            c->flags = get_le16(&s->pb);
192
+            c->pktsize = get_le32(s->pb) - 4;
193
+            c->flags = get_le16(s->pb);
194 194
             c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
195 195
             if (c->gmcsize)
196
-                get_buffer(&s->pb, c->gmc, c->gmcsize);
197
-            c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(&s->pb): 0;
196
+                get_buffer(s->pb, c->gmc, c->gmcsize);
197
+            c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
198 198
             c->curstrm = !!(c->flags & VB_HAS_AUDIO);
199 199
         }
200 200
 
... ...
@@ -205,11 +205,11 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
205 205
             AV_WL16(pkt->data, c->flags);
206 206
             if (c->gmcsize)
207 207
                 memcpy(pkt->data + 2, c->gmc, c->gmcsize);
208
-            get_buffer(&s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
208
+            get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
209 209
             pkt->stream_index = 0;
210 210
             c->curstrm = -1;
211 211
         }else{
212
-            if (av_get_packet(&s->pb, pkt, c->sndsize - 4) < 0)
212
+            if (av_get_packet(s->pb, pkt, c->sndsize - 4) < 0)
213 213
                 return AVERROR(EIO);
214 214
             pkt->stream_index = 1;
215 215
             c->curstrm = 0;
... ...
@@ -219,7 +219,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
219 219
         if (c->curstrm == -1)
220 220
             c->cur_frame++;
221 221
     }else{
222
-        size = av_get_packet(&s->pb, pkt, c->block_align);
222
+        size = av_get_packet(s->pb, pkt, c->block_align);
223 223
         if(size <= 0)
224 224
             return AVERROR(EIO);
225 225
     }
... ...
@@ -98,7 +98,7 @@ static int smacker_probe(AVProbeData *p)
98 98
 
99 99
 static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
100 100
 {
101
-    ByteIOContext *pb = &s->pb;
101
+    ByteIOContext *pb = s->pb;
102 102
     SmackerContext *smk = s->priv_data;
103 103
     AVStream *st, *ast[7];
104 104
     int i, ret;
... ...
@@ -226,35 +226,35 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
226 226
     int palchange = 0;
227 227
     int pos;
228 228
 
229
-    if (url_feof(&s->pb) || smk->cur_frame >= smk->frames)
229
+    if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
230 230
         return AVERROR(EIO);
231 231
 
232 232
     /* if we demuxed all streams, pass another frame */
233 233
     if(smk->curstream < 0) {
234
-        url_fseek(&s->pb, smk->nextpos, 0);
234
+        url_fseek(s->pb, smk->nextpos, 0);
235 235
         frame_size = smk->frm_size[smk->cur_frame] & (~3);
236 236
         flags = smk->frm_flags[smk->cur_frame];
237 237
         /* handle palette change event */
238
-        pos = url_ftell(&s->pb);
238
+        pos = url_ftell(s->pb);
239 239
         if(flags & SMACKER_PAL){
240 240
             int size, sz, t, off, j, pos;
241 241
             uint8_t *pal = smk->pal;
242 242
             uint8_t oldpal[768];
243 243
 
244 244
             memcpy(oldpal, pal, 768);
245
-            size = get_byte(&s->pb);
245
+            size = get_byte(s->pb);
246 246
             size = size * 4 - 1;
247 247
             frame_size -= size;
248 248
             frame_size--;
249 249
             sz = 0;
250
-            pos = url_ftell(&s->pb) + size;
250
+            pos = url_ftell(s->pb) + size;
251 251
             while(sz < 256){
252
-                t = get_byte(&s->pb);
252
+                t = get_byte(s->pb);
253 253
                 if(t & 0x80){ /* skip palette entries */
254 254
                     sz += (t & 0x7F) + 1;
255 255
                     pal += ((t & 0x7F) + 1) * 3;
256 256
                 } else if(t & 0x40){ /* copy with offset */
257
-                    off = get_byte(&s->pb) * 3;
257
+                    off = get_byte(s->pb) * 3;
258 258
                     j = (t & 0x3F) + 1;
259 259
                     while(j-- && sz < 256) {
260 260
                         *pal++ = oldpal[off + 0];
... ...
@@ -265,12 +265,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
265 265
                     }
266 266
                 } else { /* new entries */
267 267
                     *pal++ = smk_pal[t];
268
-                    *pal++ = smk_pal[get_byte(&s->pb) & 0x3F];
269
-                    *pal++ = smk_pal[get_byte(&s->pb) & 0x3F];
268
+                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
269
+                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
270 270
                     sz++;
271 271
                 }
272 272
             }
273
-            url_fseek(&s->pb, pos, 0);
273
+            url_fseek(s->pb, pos, 0);
274 274
             palchange |= 1;
275 275
         }
276 276
         flags >>= 1;
... ...
@@ -279,13 +279,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
279 279
         for(i = 0; i < 7; i++) {
280 280
             if(flags & 1) {
281 281
                 int size;
282
-                size = get_le32(&s->pb) - 4;
282
+                size = get_le32(s->pb) - 4;
283 283
                 frame_size -= size;
284 284
                 frame_size -= 4;
285 285
                 smk->curstream++;
286 286
                 smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
287 287
                 smk->buf_sizes[smk->curstream] = size;
288
-                ret = get_buffer(&s->pb, smk->bufs[smk->curstream], size);
288
+                ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
289 289
                 if(ret != size)
290 290
                     return AVERROR(EIO);
291 291
                 smk->stream_id[smk->curstream] = smk->indexes[i];
... ...
@@ -298,13 +298,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
298 298
             palchange |= 2;
299 299
         pkt->data[0] = palchange;
300 300
         memcpy(pkt->data + 1, smk->pal, 768);
301
-        ret = get_buffer(&s->pb, pkt->data + 769, frame_size);
301
+        ret = get_buffer(s->pb, pkt->data + 769, frame_size);
302 302
         if(ret != frame_size)
303 303
             return AVERROR(EIO);
304 304
         pkt->stream_index = smk->videoindex;
305 305
         pkt->size = ret + 769;
306 306
         smk->cur_frame++;
307
-        smk->nextpos = url_ftell(&s->pb);
307
+        smk->nextpos = url_ftell(s->pb);
308 308
     } else {
309 309
         if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
310 310
             return AVERROR(ENOMEM);
... ...
@@ -88,7 +88,7 @@ static int sol_read_header(AVFormatContext *s,
88 88
 {
89 89
     int size;
90 90
     unsigned int magic,tag;
91
-    ByteIOContext *pb = &s->pb;
91
+    ByteIOContext *pb = s->pb;
92 92
     unsigned int id, codec, channels, rate, type;
93 93
     AVStream *st;
94 94
 
... ...
@@ -130,9 +130,9 @@ static int sol_read_packet(AVFormatContext *s,
130 130
 {
131 131
     int ret;
132 132
 
133
-    if (url_feof(&s->pb))
133
+    if (url_feof(s->pb))
134 134
         return AVERROR(EIO);
135
-    ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
135
+    ret= av_get_packet(s->pb, pkt, MAX_SIZE);
136 136
     pkt->stream_index = 0;
137 137
 
138 138
     /* note: we need to modify the packet size here to handle the last
... ...
@@ -96,7 +96,7 @@ static const AVCodecTag swf_audio_codec_tags[] = {
96 96
 static void put_swf_tag(AVFormatContext *s, int tag)
97 97
 {
98 98
     SWFContext *swf = s->priv_data;
99
-    ByteIOContext *pb = &s->pb;
99
+    ByteIOContext *pb = s->pb;
100 100
 
101 101
     swf->tag_pos = url_ftell(pb);
102 102
     swf->tag = tag;
... ...
@@ -112,7 +112,7 @@ static void put_swf_tag(AVFormatContext *s, int tag)
112 112
 static void put_swf_end_tag(AVFormatContext *s)
113 113
 {
114 114
     SWFContext *swf = s->priv_data;
115
-    ByteIOContext *pb = &s->pb;
115
+    ByteIOContext *pb = s->pb;
116 116
     offset_t pos;
117 117
     int tag_len, tag;
118 118
 
... ...
@@ -244,7 +244,7 @@ static void put_swf_matrix(ByteIOContext *pb,
244 244
 static int swf_write_header(AVFormatContext *s)
245 245
 {
246 246
     SWFContext *swf = s->priv_data;
247
-    ByteIOContext *pb = &s->pb;
247
+    ByteIOContext *pb = s->pb;
248 248
     AVCodecContext *enc, *audio_enc, *video_enc;
249 249
     PutBitContext p;
250 250
     uint8_t buf1[256];
... ...
@@ -392,16 +392,16 @@ static int swf_write_header(AVFormatContext *s)
392 392
         v |= 0x02; /* 16 bit playback */
393 393
         if (audio_enc->channels == 2)
394 394
             v |= 0x01; /* stereo playback */
395
-        put_byte(&s->pb, v);
395
+        put_byte(s->pb, v);
396 396
         v |= 0x20; /* mp3 compressed */
397
-        put_byte(&s->pb, v);
398
-        put_le16(&s->pb, swf->samples_per_frame);  /* avg samples per frame */
399
-        put_le16(&s->pb, 0);
397
+        put_byte(s->pb, v);
398
+        put_le16(s->pb, swf->samples_per_frame);  /* avg samples per frame */
399
+        put_le16(s->pb, 0);
400 400
 
401 401
         put_swf_end_tag(s);
402 402
     }
403 403
 
404
-    put_flush_packet(&s->pb);
404
+    put_flush_packet(s->pb);
405 405
     return 0;
406 406
 }
407 407
 
... ...
@@ -409,7 +409,7 @@ static int swf_write_video(AVFormatContext *s,
409 409
                            AVCodecContext *enc, const uint8_t *buf, int size)
410 410
 {
411 411
     SWFContext *swf = s->priv_data;
412
-    ByteIOContext *pb = &s->pb;
412
+    ByteIOContext *pb = s->pb;
413 413
 
414 414
     /* Flash Player limit */
415 415
     if (swf->swf_frame_number == 16000) {
... ...
@@ -516,7 +516,7 @@ static int swf_write_video(AVFormatContext *s,
516 516
     put_swf_tag(s, TAG_SHOWFRAME);
517 517
     put_swf_end_tag(s);
518 518
 
519
-    put_flush_packet(&s->pb);
519
+    put_flush_packet(s->pb);
520 520
 
521 521
     return 0;
522 522
 }
... ...
@@ -560,7 +560,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt)
560 560
 static int swf_write_trailer(AVFormatContext *s)
561 561
 {
562 562
     SWFContext *swf = s->priv_data;
563
-    ByteIOContext *pb = &s->pb;
563
+    ByteIOContext *pb = s->pb;
564 564
     AVCodecContext *enc, *video_enc;
565 565
     int file_size, i;
566 566
 
... ...
@@ -574,10 +574,10 @@ static int swf_write_trailer(AVFormatContext *s)
574 574
     put_swf_tag(s, TAG_END);
575 575
     put_swf_end_tag(s);
576 576
 
577
-    put_flush_packet(&s->pb);
577
+    put_flush_packet(s->pb);
578 578
 
579 579
     /* patch file size and number of frames if not streamed */
580
-    if (!url_is_streamed(&s->pb) && video_enc) {
580
+    if (!url_is_streamed(s->pb) && video_enc) {
581 581
         file_size = url_ftell(pb);
582 582
         url_fseek(pb, 4, SEEK_SET);
583 583
         put_le32(pb, file_size);
... ...
@@ -628,7 +628,7 @@ static int swf_probe(AVProbeData *p)
628 628
 static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
629 629
 {
630 630
     SWFContext *swf = s->priv_data;
631
-    ByteIOContext *pb = &s->pb;
631
+    ByteIOContext *pb = s->pb;
632 632
     int nbits, len, tag;
633 633
 
634 634
     tag = get_be32(pb) & 0xffffff00;
... ...
@@ -655,7 +655,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
655 655
 static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
656 656
 {
657 657
     SWFContext *swf = s->priv_data;
658
-    ByteIOContext *pb = &s->pb;
658
+    ByteIOContext *pb = s->pb;
659 659
     AVStream *vst = NULL, *ast = NULL, *st = 0;
660 660
     int tag, len, i, frame, v;
661 661
 
... ...
@@ -57,7 +57,7 @@ static int thp_read_header(AVFormatContext *s,
57 57
 {
58 58
     ThpDemuxContext *thp = s->priv_data;
59 59
     AVStream *st;
60
-    ByteIOContext *pb = &s->pb;
60
+    ByteIOContext *pb = s->pb;
61 61
     int i;
62 62
 
63 63
     /* Read the file header.  */
... ...
@@ -140,7 +140,7 @@ static int thp_read_packet(AVFormatContext *s,
140 140
                             AVPacket *pkt)
141 141
 {
142 142
     ThpDemuxContext *thp = s->priv_data;
143
-    ByteIOContext *pb = &s->pb;
143
+    ByteIOContext *pb = s->pb;
144 144
     int size;
145 145
     int ret;
146 146
 
... ...
@@ -184,7 +184,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
184 184
 {
185 185
     int i, rc;
186 186
     SeqDemuxContext *seq = s->priv_data;
187
-    ByteIOContext *pb = &s->pb;
187
+    ByteIOContext *pb = s->pb;
188 188
     AVStream *st;
189 189
 
190 190
     /* init internal buffers */
... ...
@@ -241,7 +241,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
241 241
 {
242 242
     int rc;
243 243
     SeqDemuxContext *seq = s->priv_data;
244
-    ByteIOContext *pb = &s->pb;
244
+    ByteIOContext *pb = s->pb;
245 245
 
246 246
     if (!seq->audio_buffer_full) {
247 247
         rc = seq_parse_frame_data(seq, pb);
... ...
@@ -40,25 +40,25 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
40 40
     int i, channels, bps, samplerate, datalen, framelen;
41 41
     uint64_t framepos;
42 42
 
43
-    if (get_le32(&s->pb) != ff_get_fourcc("TTA1"))
43
+    if (get_le32(s->pb) != ff_get_fourcc("TTA1"))
44 44
         return -1; // not tta file
45 45
 
46
-    url_fskip(&s->pb, 2); // FIXME: flags
47
-    channels = get_le16(&s->pb);
48
-    bps = get_le16(&s->pb);
49
-    samplerate = get_le32(&s->pb);
46
+    url_fskip(s->pb, 2); // FIXME: flags
47
+    channels = get_le16(s->pb);
48
+    bps = get_le16(s->pb);
49
+    samplerate = get_le32(s->pb);
50 50
     if(samplerate <= 0 || samplerate > 1000000){
51 51
         av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
52 52
         return -1;
53 53
     }
54 54
 
55
-    datalen = get_le32(&s->pb);
55
+    datalen = get_le32(s->pb);
56 56
     if(datalen < 0){
57 57
         av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
58 58
         return -1;
59 59
     }
60 60
 
61
-    url_fskip(&s->pb, 4); // header crc
61
+    url_fskip(s->pb, 4); // header crc
62 62
 
63 63
     framelen = samplerate*256/245;
64 64
     c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
... ...
@@ -77,14 +77,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
77 77
     st->start_time = 0;
78 78
     st->duration = datalen;
79 79
 
80
-    framepos = url_ftell(&s->pb) + 4*c->totalframes + 4;
80
+    framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
81 81
 
82 82
     for (i = 0; i < c->totalframes; i++) {
83
-        uint32_t size = get_le32(&s->pb);
83
+        uint32_t size = get_le32(s->pb);
84 84
         av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
85 85
         framepos += size;
86 86
     }
87
-    url_fskip(&s->pb, 4); // seektable crc
87
+    url_fskip(s->pb, 4); // seektable crc
88 88
 
89 89
     st->codec->codec_type = CODEC_TYPE_AUDIO;
90 90
     st->codec->codec_id = CODEC_ID_TTA;
... ...
@@ -92,15 +92,15 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
92 92
     st->codec->sample_rate = samplerate;
93 93
     st->codec->bits_per_sample = bps;
94 94
 
95
-    st->codec->extradata_size = url_ftell(&s->pb);
95
+    st->codec->extradata_size = url_ftell(s->pb);
96 96
     if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
97 97
         //this check is redundant as get_buffer should fail
98 98
         av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
99 99
         return -1;
100 100
     }
101 101
     st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
102
-    url_fseek(&s->pb, 0, SEEK_SET);
103
-    get_buffer(&s->pb, st->codec->extradata, st->codec->extradata_size);
102
+    url_fseek(s->pb, 0, SEEK_SET);
103
+    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
104 104
 
105 105
     return 0;
106 106
 }
... ...
@@ -117,7 +117,7 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
117 117
 
118 118
     size = st->index_entries[c->currentframe].size;
119 119
 
120
-    ret = av_get_packet(&s->pb, pkt, size);
120
+    ret = av_get_packet(s->pb, pkt, size);
121 121
     pkt->dts = st->index_entries[c->currentframe++].timestamp;
122 122
     return ret;
123 123
 }
... ...
@@ -131,7 +131,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
131 131
         return -1;
132 132
 
133 133
     c->currentframe = index;
134
-    url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
134
+    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
135 135
 
136 136
     return 0;
137 137
 }
... ...
@@ -51,7 +51,7 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
51 51
 }
52 52
 
53 53
 static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
54
-    ByteIOContext *pb = &s->pb;
54
+    ByteIOContext *pb = s->pb;
55 55
     unsigned int id, chunk_size, marker;
56 56
     int ret;
57 57
 
... ...
@@ -60,7 +60,7 @@ next_chunk:
60 60
     chunk_size = get_le32(pb);
61 61
     marker     = get_le32(pb);
62 62
 
63
-    if (url_feof(&s->pb))
63
+    if (url_feof(s->pb))
64 64
         return AVERROR(EIO);
65 65
     if (marker != TXD_MARKER && marker != TXD_MARKER2) {
66 66
         av_log(NULL, AV_LOG_ERROR, "marker does not match\n");
... ...
@@ -72,7 +72,7 @@ next_chunk:
72 72
             if (chunk_size > 100)
73 73
                 break;
74 74
         case TXD_EXTRA:
75
-            url_fskip(&s->pb, chunk_size);
75
+            url_fskip(s->pb, chunk_size);
76 76
         case TXD_FILE:
77 77
         case TXD_TEXTURE:
78 78
             goto next_chunk;
... ...
@@ -81,7 +81,7 @@ next_chunk:
81 81
             return AVERROR(EIO);
82 82
     }
83 83
 
84
-    ret = av_get_packet(&s->pb, pkt, chunk_size);
84
+    ret = av_get_packet(s->pb, pkt, chunk_size);
85 85
     pkt->stream_index = 0;
86 86
 
87 87
     return ret <= 0 ? AVERROR(EIO) : ret;
... ...
@@ -361,8 +361,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
361 361
         goto fail;
362 362
     }
363 363
     ic->iformat = fmt;
364
-    if (pb)
365
-        ic->pb = *pb;
364
+    ic->pb = pb;
366 365
     ic->duration = AV_NOPTS_VALUE;
367 366
     ic->start_time = AV_NOPTS_VALUE;
368 367
     av_strlcpy(ic->filename, filename, sizeof(ic->filename));
... ...
@@ -383,7 +382,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
383 383
         goto fail;
384 384
 
385 385
     if (pb && !ic->data_offset)
386
-        ic->data_offset = url_ftell(&ic->pb);
386
+        ic->data_offset = url_ftell(ic->pb);
387 387
 
388 388
     *ic_ptr = ic;
389 389
     return 0;
... ...
@@ -407,7 +406,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
407 407
 {
408 408
     int err, must_open_file, file_opened, probe_size;
409 409
     AVProbeData probe_data, *pd = &probe_data;
410
-    ByteIOContext pb1, *pb = &pb1;
410
+    ByteIOContext *pb;
411 411
 
412 412
     file_opened = 0;
413 413
     pd->filename = "";
... ...
@@ -431,7 +430,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
431 431
 
432 432
     if (!fmt || must_open_file) {
433 433
         /* if no file needed do not try to open one */
434
-        if ((err=url_fopen(pb, filename, URL_RDONLY)) < 0) {
434
+        if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
435 435
             goto fail;
436 436
         }
437 437
         file_opened = 1;
... ...
@@ -447,7 +446,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
447 447
             memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
448 448
             if (url_fseek(pb, 0, SEEK_SET) < 0) {
449 449
                 url_fclose(pb);
450
-                if (url_fopen(pb, filename, URL_RDONLY) < 0) {
450
+                if (url_fopen(&pb, filename, URL_RDONLY) < 0) {
451 451
                     file_opened = 0;
452 452
                     err = AVERROR(EIO);
453 453
                     goto fail;
... ...
@@ -1130,7 +1129,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
1130 1130
         return -1;
1131 1131
 
1132 1132
     /* do the seek */
1133
-    url_fseek(&s->pb, pos, SEEK_SET);
1133
+    url_fseek(s->pb, pos, SEEK_SET);
1134 1134
 
1135 1135
     av_update_cur_dts(s, st, ts);
1136 1136
 
... ...
@@ -1155,7 +1154,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
1155 1155
 
1156 1156
     if(ts_max == AV_NOPTS_VALUE){
1157 1157
         int step= 1024;
1158
-        filesize = url_fsize(&s->pb);
1158
+        filesize = url_fsize(s->pb);
1159 1159
         pos_max = filesize - 1;
1160 1160
         do{
1161 1161
             pos_max -= step;
... ...
@@ -1261,12 +1260,12 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
1261 1261
 #endif
1262 1262
 
1263 1263
     pos_min = s->data_offset;
1264
-    pos_max = url_fsize(&s->pb) - 1;
1264
+    pos_max = url_fsize(s->pb) - 1;
1265 1265
 
1266 1266
     if     (pos < pos_min) pos= pos_min;
1267 1267
     else if(pos > pos_max) pos= pos_max;
1268 1268
 
1269
-    url_fseek(&s->pb, pos, SEEK_SET);
1269
+    url_fseek(s->pb, pos, SEEK_SET);
1270 1270
 
1271 1271
 #if 0
1272 1272
     av_update_cur_dts(s, st, ts);
... ...
@@ -1291,10 +1290,10 @@ static int av_seek_frame_generic(AVFormatContext *s,
1291 1291
 
1292 1292
         if(st->index_entries && st->nb_index_entries){
1293 1293
             ie= &st->index_entries[st->nb_index_entries-1];
1294
-            url_fseek(&s->pb, ie->pos, SEEK_SET);
1294
+            url_fseek(s->pb, ie->pos, SEEK_SET);
1295 1295
             av_update_cur_dts(s, st, ie->timestamp);
1296 1296
         }else
1297
-            url_fseek(&s->pb, 0, SEEK_SET);
1297
+            url_fseek(s->pb, 0, SEEK_SET);
1298 1298
 
1299 1299
         for(i=0;; i++) {
1300 1300
             int ret = av_read_frame(s, &pkt);
... ...
@@ -1317,7 +1316,7 @@ static int av_seek_frame_generic(AVFormatContext *s,
1317 1317
             return 0;
1318 1318
     }
1319 1319
     ie = &st->index_entries[index];
1320
-    url_fseek(&s->pb, ie->pos, SEEK_SET);
1320
+    url_fseek(s->pb, ie->pos, SEEK_SET);
1321 1321
 
1322 1322
     av_update_cur_dts(s, st, ie->timestamp);
1323 1323
 
... ...
@@ -1509,7 +1508,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
1509 1509
 
1510 1510
     /* we read the first packets to get the first PTS (not fully
1511 1511
        accurate, but it is enough now) */
1512
-    url_fseek(&ic->pb, 0, SEEK_SET);
1512
+    url_fseek(ic->pb, 0, SEEK_SET);
1513 1513
     read_size = 0;
1514 1514
     for(;;) {
1515 1515
         if (read_size >= DURATION_MAX_READ_SIZE)
... ...
@@ -1542,7 +1541,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
1542 1542
     if (offset < 0)
1543 1543
         offset = 0;
1544 1544
 
1545
-    url_fseek(&ic->pb, offset, SEEK_SET);
1545
+    url_fseek(ic->pb, offset, SEEK_SET);
1546 1546
     read_size = 0;
1547 1547
     for(;;) {
1548 1548
         if (read_size >= DURATION_MAX_READ_SIZE)
... ...
@@ -1568,7 +1567,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
1568 1568
 
1569 1569
     fill_all_stream_timings(ic);
1570 1570
 
1571
-    url_fseek(&ic->pb, old_offset, SEEK_SET);
1571
+    url_fseek(ic->pb, old_offset, SEEK_SET);
1572 1572
     for(i=0; i<ic->nb_streams; i++){
1573 1573
         st= ic->streams[i];
1574 1574
         st->cur_dts= st->first_dts;
... ...
@@ -1584,7 +1583,7 @@ static void av_estimate_timings(AVFormatContext *ic, offset_t old_offset)
1584 1584
     if (ic->iformat->flags & AVFMT_NOFILE) {
1585 1585
         file_size = 0;
1586 1586
     } else {
1587
-        file_size = url_fsize(&ic->pb);
1587
+        file_size = url_fsize(ic->pb);
1588 1588
         if (file_size < 0)
1589 1589
             file_size = 0;
1590 1590
     }
... ...
@@ -1592,7 +1591,7 @@ static void av_estimate_timings(AVFormatContext *ic, offset_t old_offset)
1592 1592
 
1593 1593
     if ((!strcmp(ic->iformat->name, "mpeg") ||
1594 1594
          !strcmp(ic->iformat->name, "mpegts")) &&
1595
-        file_size && !ic->pb.is_streamed) {
1595
+        file_size && !ic->pb->is_streamed) {
1596 1596
         /* get accurate estimate from the PTSes */
1597 1597
         av_estimate_timings_from_pts(ic, old_offset);
1598 1598
     } else if (av_has_duration(ic)) {
... ...
@@ -1757,7 +1756,7 @@ int av_find_stream_info(AVFormatContext *ic)
1757 1757
     int64_t last_dts[MAX_STREAMS];
1758 1758
     int duration_count[MAX_STREAMS]={0};
1759 1759
     double (*duration_error)[MAX_STD_TIMEBASES];
1760
-    offset_t old_offset = url_ftell(&ic->pb);
1760
+    offset_t old_offset = url_ftell(ic->pb);
1761 1761
     int64_t codec_info_duration[MAX_STREAMS]={0};
1762 1762
     int codec_info_nb_frames[MAX_STREAMS]={0};
1763 1763
     AVProbeData probe_data[MAX_STREAMS];
... ...
@@ -1989,7 +1988,7 @@ int av_find_stream_info(AVFormatContext *ic)
1989 1989
             }
1990 1990
             st->cur_dts= st->first_dts;
1991 1991
         }
1992
-        url_fseek(&ic->pb, ic->data_offset, SEEK_SET);
1992
+        url_fseek(ic->pb, ic->data_offset, SEEK_SET);
1993 1993
     }
1994 1994
 
1995 1995
 #if 0
... ...
@@ -2075,7 +2074,7 @@ void av_close_input_file(AVFormatContext *s)
2075 2075
         must_open_file = 0;
2076 2076
     }
2077 2077
     if (must_open_file) {
2078
-        url_fclose(&s->pb);
2078
+        url_fclose(s->pb);
2079 2079
     }
2080 2080
     av_freep(&s->priv_data);
2081 2081
     av_free(s);
... ...
@@ -2343,7 +2342,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
2343 2343
 
2344 2344
     ret= s->oformat->write_packet(s, pkt);
2345 2345
     if(!ret)
2346
-        ret= url_ferror(&s->pb);
2346
+        ret= url_ferror(s->pb);
2347 2347
     return ret;
2348 2348
 }
2349 2349
 
... ...
@@ -2444,8 +2443,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
2444 2444
 
2445 2445
         if(ret<0)
2446 2446
             return ret;
2447
-        if(url_ferror(&s->pb))
2448
-            return url_ferror(&s->pb);
2447
+        if(url_ferror(s->pb))
2448
+            return url_ferror(s->pb);
2449 2449
     }
2450 2450
 }
2451 2451
 
... ...
@@ -2468,7 +2467,7 @@ int av_write_trailer(AVFormatContext *s)
2468 2468
 
2469 2469
         if(ret<0)
2470 2470
             goto fail;
2471
-        if(url_ferror(&s->pb))
2471
+        if(url_ferror(s->pb))
2472 2472
             goto fail;
2473 2473
     }
2474 2474
 
... ...
@@ -2476,7 +2475,7 @@ int av_write_trailer(AVFormatContext *s)
2476 2476
         ret = s->oformat->write_trailer(s);
2477 2477
 fail:
2478 2478
     if(ret == 0)
2479
-       ret=url_ferror(&s->pb);
2479
+       ret=url_ferror(s->pb);
2480 2480
     for(i=0;i<s->nb_streams;i++)
2481 2481
         av_freep(&s->streams[i]->priv_data);
2482 2482
     av_freep(&s->priv_data);
... ...
@@ -39,7 +39,7 @@ static int voc_probe(AVProbeData *p)
39 39
 static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
40 40
 {
41 41
     voc_dec_context_t *voc = s->priv_data;
42
-    ByteIOContext *pb = &s->pb;
42
+    ByteIOContext *pb = s->pb;
43 43
     int header_size;
44 44
     AVStream *st;
45 45
 
... ...
@@ -64,7 +64,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
64 64
 {
65 65
     voc_dec_context_t *voc = s->priv_data;
66 66
     AVCodecContext *dec = st->codec;
67
-    ByteIOContext *pb = &s->pb;
67
+    ByteIOContext *pb = s->pb;
68 68
     voc_type_t type;
69 69
     int size;
70 70
     int sample_rate = 0;
... ...
@@ -28,7 +28,7 @@ typedef struct voc_enc_context {
28 28
 
29 29
 static int voc_write_header(AVFormatContext *s)
30 30
 {
31
-    ByteIOContext *pb = &s->pb;
31
+    ByteIOContext *pb = s->pb;
32 32
     const int header_size = 26;
33 33
     const int version = 0x0114;
34 34
 
... ...
@@ -48,7 +48,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
48 48
 {
49 49
     voc_enc_context_t *voc = s->priv_data;
50 50
     AVCodecContext *enc = s->streams[0]->codec;
51
-    ByteIOContext *pb = &s->pb;
51
+    ByteIOContext *pb = s->pb;
52 52
 
53 53
     if (!voc->param_written) {
54 54
         if (enc->codec_tag > 0xFF) {
... ...
@@ -84,7 +84,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
84 84
 
85 85
 static int voc_write_trailer(AVFormatContext *s)
86 86
 {
87
-    put_byte(&s->pb, 0);
87
+    put_byte(s->pb, 0);
88 88
     return 0;
89 89
 }
90 90
 
... ...
@@ -34,7 +34,7 @@ typedef struct {
34 34
 static int wav_write_header(AVFormatContext *s)
35 35
 {
36 36
     WAVContext *wav = s->priv_data;
37
-    ByteIOContext *pb = &s->pb;
37
+    ByteIOContext *pb = s->pb;
38 38
     offset_t fmt, fact;
39 39
 
40 40
     put_tag(pb, "RIFF");
... ...
@@ -50,7 +50,7 @@ static int wav_write_header(AVFormatContext *s)
50 50
     end_tag(pb, fmt);
51 51
 
52 52
     if(s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
53
-       && !url_is_streamed(&s->pb)) {
53
+       && !url_is_streamed(s->pb)) {
54 54
         fact = start_tag(pb, "fact");
55 55
         put_le32(pb, 0);
56 56
         end_tag(pb, fact);
... ...
@@ -70,7 +70,7 @@ static int wav_write_header(AVFormatContext *s)
70 70
 
71 71
 static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
72 72
 {
73
-    ByteIOContext *pb = &s->pb;
73
+    ByteIOContext *pb = s->pb;
74 74
     WAVContext *wav = s->priv_data;
75 75
     put_buffer(pb, pkt->data, pkt->size);
76 76
     if(pkt->pts != AV_NOPTS_VALUE) {
... ...
@@ -84,11 +84,11 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
84 84
 
85 85
 static int wav_write_trailer(AVFormatContext *s)
86 86
 {
87
-    ByteIOContext *pb = &s->pb;
87
+    ByteIOContext *pb = s->pb;
88 88
     WAVContext *wav = s->priv_data;
89 89
     offset_t file_size;
90 90
 
91
-    if (!url_is_streamed(&s->pb)) {
91
+    if (!url_is_streamed(s->pb)) {
92 92
         end_tag(pb, wav->data);
93 93
 
94 94
         /* update file size */
... ...
@@ -156,7 +156,7 @@ static int wav_read_header(AVFormatContext *s,
156 156
 {
157 157
     int size;
158 158
     unsigned int tag;
159
-    ByteIOContext *pb = &s->pb;
159
+    ByteIOContext *pb = s->pb;
160 160
     AVStream *st;
161 161
     WAVContext *wav = s->priv_data;
162 162
 
... ...
@@ -199,17 +199,17 @@ static int wav_read_packet(AVFormatContext *s,
199 199
     AVStream *st;
200 200
     WAVContext *wav = s->priv_data;
201 201
 
202
-    if (url_feof(&s->pb))
202
+    if (url_feof(s->pb))
203 203
         return AVERROR(EIO);
204 204
     st = s->streams[0];
205 205
 
206
-    left= wav->data_end - url_ftell(&s->pb);
206
+    left= wav->data_end - url_ftell(s->pb);
207 207
     if(left <= 0){
208
-        left = find_tag(&(s->pb), MKTAG('d', 'a', 't', 'a'));
208
+        left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
209 209
         if (left < 0) {
210 210
             return AVERROR(EIO);
211 211
         }
212
-        wav->data_end= url_ftell(&s->pb) + left;
212
+        wav->data_end= url_ftell(s->pb) + left;
213 213
     }
214 214
 
215 215
     size = MAX_SIZE;
... ...
@@ -219,7 +219,7 @@ static int wav_read_packet(AVFormatContext *s,
219 219
         size = (size / st->codec->block_align) * st->codec->block_align;
220 220
     }
221 221
     size= FFMIN(size, left);
222
-    ret= av_get_packet(&s->pb, pkt, size);
222
+    ret= av_get_packet(s->pb, pkt, size);
223 223
     if (ret <= 0)
224 224
         return AVERROR(EIO);
225 225
     pkt->stream_index = 0;
... ...
@@ -126,7 +126,7 @@ static int wc3_read_header(AVFormatContext *s,
126 126
                            AVFormatParameters *ap)
127 127
 {
128 128
     Wc3DemuxContext *wc3 = s->priv_data;
129
-    ByteIOContext *pb = &s->pb;
129
+    ByteIOContext *pb = s->pb;
130 130
     unsigned int fourcc_tag;
131 131
     unsigned int size;
132 132
     AVStream *st;
... ...
@@ -272,7 +272,7 @@ static int wc3_read_packet(AVFormatContext *s,
272 272
                            AVPacket *pkt)
273 273
 {
274 274
     Wc3DemuxContext *wc3 = s->priv_data;
275
-    ByteIOContext *pb = &s->pb;
275
+    ByteIOContext *pb = s->pb;
276 276
     unsigned int fourcc_tag;
277 277
     unsigned int size;
278 278
     int packet_read = 0;
... ...
@@ -118,7 +118,7 @@ static int wsaud_read_header(AVFormatContext *s,
118 118
                              AVFormatParameters *ap)
119 119
 {
120 120
     WsAudDemuxContext *wsaud = s->priv_data;
121
-    ByteIOContext *pb = &s->pb;
121
+    ByteIOContext *pb = s->pb;
122 122
     AVStream *st;
123 123
     unsigned char header[AUD_HEADER_SIZE];
124 124
 
... ...
@@ -160,7 +160,7 @@ static int wsaud_read_packet(AVFormatContext *s,
160 160
                              AVPacket *pkt)
161 161
 {
162 162
     WsAudDemuxContext *wsaud = s->priv_data;
163
-    ByteIOContext *pb = &s->pb;
163
+    ByteIOContext *pb = s->pb;
164 164
     unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
165 165
     unsigned int chunk_size;
166 166
     int ret = 0;
... ...
@@ -213,7 +213,7 @@ static int wsvqa_read_header(AVFormatContext *s,
213 213
                              AVFormatParameters *ap)
214 214
 {
215 215
     WsVqaDemuxContext *wsvqa = s->priv_data;
216
-    ByteIOContext *pb = &s->pb;
216
+    ByteIOContext *pb = s->pb;
217 217
     AVStream *st;
218 218
     unsigned char *header;
219 219
     unsigned char scratch[VQA_PREAMBLE_SIZE];
... ...
@@ -315,7 +315,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
315 315
                              AVPacket *pkt)
316 316
 {
317 317
     WsVqaDemuxContext *wsvqa = s->priv_data;
318
-    ByteIOContext *pb = &s->pb;
318
+    ByteIOContext *pb = s->pb;
319 319
     int ret = -1;
320 320
     unsigned char preamble[VQA_PREAMBLE_SIZE];
321 321
     unsigned int chunk_type;
... ...
@@ -135,7 +135,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb)
135 135
 static int wv_read_header(AVFormatContext *s,
136 136
                           AVFormatParameters *ap)
137 137
 {
138
-    ByteIOContext *pb = &s->pb;
138
+    ByteIOContext *pb = s->pb;
139 139
     WVContext *wc = s->priv_data;
140 140
     AVStream *st;
141 141
 
... ...
@@ -164,17 +164,17 @@ static int wv_read_packet(AVFormatContext *s,
164 164
     WVContext *wc = s->priv_data;
165 165
     int ret;
166 166
 
167
-    if (url_feof(&s->pb))
167
+    if (url_feof(s->pb))
168 168
         return AVERROR(EIO);
169 169
     if(wc->block_parsed){
170
-        if(wv_read_block_header(s, &s->pb) < 0)
170
+        if(wv_read_block_header(s, s->pb) < 0)
171 171
             return -1;
172 172
     }
173 173
 
174 174
     if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0)
175 175
         return AVERROR(ENOMEM);
176 176
     memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE);
177
-    ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
177
+    ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
178 178
     if(ret != wc->blksize){
179 179
         av_free_packet(pkt);
180 180
         return AVERROR(EIO);
... ...
@@ -204,18 +204,18 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
204 204
     /* if found, seek there */
205 205
     if (index >= 0){
206 206
         wc->block_parsed = 1;
207
-        url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
207
+        url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
208 208
         return 0;
209 209
     }
210 210
     /* if timestamp is out of bounds, return error */
211 211
     if(timestamp < 0 || timestamp >= s->duration)
212 212
         return -1;
213 213
 
214
-    pos = url_ftell(&s->pb);
214
+    pos = url_ftell(s->pb);
215 215
     do{
216 216
         ret = av_read_frame(s, pkt);
217 217
         if (ret < 0){
218
-            url_fseek(&s->pb, pos, SEEK_SET);
218
+            url_fseek(s->pb, pos, SEEK_SET);
219 219
             return -1;
220 220
         }
221 221
         pts = pkt->pts;
... ...
@@ -87,7 +87,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
87 87
 static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
88 88
 {
89 89
     AVStream *st = s->streams[pkt->stream_index];
90
-    ByteIOContext *pb = &s->pb;
90
+    ByteIOContext *pb = s->pb;
91 91
     AVPicture *picture;
92 92
     int* first_pkt = s->priv_data;
93 93
     int width, height, h_chroma_shift, v_chroma_shift;
... ...
@@ -190,7 +190,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
190 190
     char header[MAX_YUV4_HEADER+10];  // Include headroom for the longest option
191 191
     char *tokstart,*tokend,*header_end;
192 192
     int i;
193
-    ByteIOContext *pb = &s->pb;
193
+    ByteIOContext *pb = s->pb;
194 194
     int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0;
195 195
     enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE;
196 196
     AVStream *st;
... ...
@@ -344,7 +344,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
344 344
     struct frame_attributes *s1 = s->priv_data;
345 345
 
346 346
     for (i=0; i<MAX_FRAME_HEADER; i++) {
347
-        header[i] = get_byte(&s->pb);
347
+        header[i] = get_byte(s->pb);
348 348
         if (header[i] == '\n') {
349 349
             header[i+1] = 0;
350 350
             break;
... ...
@@ -360,7 +360,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
360 360
     if (packet_size < 0)
361 361
         return -1;
362 362
 
363
-    if (av_get_packet(&s->pb, pkt, packet_size) != packet_size)
363
+    if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
364 364
         return AVERROR(EIO);
365 365
 
366 366
     if (s->streams[0]->codec->coded_frame) {
... ...
@@ -538,7 +538,7 @@ int main(int argc, char **argv)
538 538
 
539 539
     if (!(fmt->flags & AVFMT_NOFILE)) {
540 540
         /* close the output file */
541
-        url_fclose(&oc->pb);
541
+        url_fclose(oc->pb);
542 542
     }
543 543
 
544 544
     /* free the stream */