Browse code

avio: avio_ prefix for url_open_dyn_buf

Anton Khirnov authored on 2011/03/17 16:13:34
Showing 17 changed files
... ...
@@ -869,7 +869,7 @@ static void close_connection(HTTPContext *c)
869 869
     if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) {
870 870
         if (ctx->oformat) {
871 871
             /* prepare header */
872
-            if (url_open_dyn_buf(&ctx->pb) >= 0) {
872
+            if (avio_open_dyn_buf(&ctx->pb) >= 0) {
873 873
                 av_write_trailer(ctx);
874 874
                 av_freep(&c->pb_buffer);
875 875
                 url_close_dyn_buf(ctx->pb, &c->pb_buffer);
... ...
@@ -1873,7 +1873,7 @@ static void compute_status(HTTPContext *c)
1873 1873
     int i, len;
1874 1874
     AVIOContext *pb;
1875 1875
 
1876
-    if (url_open_dyn_buf(&pb) < 0) {
1876
+    if (avio_open_dyn_buf(&pb) < 0) {
1877 1877
         /* XXX: return an error ? */
1878 1878
         c->buffer_ptr = c->buffer;
1879 1879
         c->buffer_end = c->buffer;
... ...
@@ -2256,7 +2256,7 @@ static int http_prepare_data(HTTPContext *c)
2256 2256
         c->got_key_frame = 0;
2257 2257
 
2258 2258
         /* prepare header and save header data in a stream */
2259
-        if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
2259
+        if (avio_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
2260 2260
             /* XXX: potential leak */
2261 2261
             return -1;
2262 2262
         }
... ...
@@ -2391,7 +2391,7 @@ static int http_prepare_data(HTTPContext *c)
2391 2391
                             max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
2392 2392
                         ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
2393 2393
                     } else {
2394
-                        ret = url_open_dyn_buf(&ctx->pb);
2394
+                        ret = avio_open_dyn_buf(&ctx->pb);
2395 2395
                     }
2396 2396
                     if (ret < 0) {
2397 2397
                         /* XXX: potential leak */
... ...
@@ -2432,7 +2432,7 @@ static int http_prepare_data(HTTPContext *c)
2432 2432
             return -1;
2433 2433
         ctx = &c->fmt_ctx;
2434 2434
         /* prepare header */
2435
-        if (url_open_dyn_buf(&ctx->pb) < 0) {
2435
+        if (avio_open_dyn_buf(&ctx->pb) < 0) {
2436 2436
             /* XXX: potential leak */
2437 2437
             return -1;
2438 2438
         }
... ...
@@ -2503,7 +2503,7 @@ static int http_send_data(HTTPContext *c)
2503 2503
                     /* if already sending something, then wait. */
2504 2504
                     if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
2505 2505
                         break;
2506
-                    if (url_open_dyn_buf(&pb) < 0)
2506
+                    if (avio_open_dyn_buf(&pb) < 0)
2507 2507
                         goto fail1;
2508 2508
                     interleaved_index = c->packet_stream_index * 2;
2509 2509
                     /* RTCP packets are sent at odd indexes */
... ...
@@ -2850,7 +2850,7 @@ static int rtsp_parse_request(HTTPContext *c)
2850 2850
     av_strlcpy(c->url, url, sizeof(c->url));
2851 2851
     av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
2852 2852
 
2853
-    if (url_open_dyn_buf(&c->pb) < 0) {
2853
+    if (avio_open_dyn_buf(&c->pb) < 0) {
2854 2854
         /* XXX: cannot do more */
2855 2855
         c->pb = NULL; /* safety */
2856 2856
         return -1;
... ...
@@ -234,7 +234,7 @@ static void put_str16(AVIOContext *s, const char *tag)
234 234
     int len;
235 235
     uint8_t *pb;
236 236
     AVIOContext *dyn_buf;
237
-    if (url_open_dyn_buf(&dyn_buf) < 0)
237
+    if (avio_open_dyn_buf(&dyn_buf) < 0)
238 238
         return;
239 239
 
240 240
     avio_put_str16le(dyn_buf, tag);
... ...
@@ -366,7 +366,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
366 366
         uint8_t *buf;
367 367
         AVIOContext *dyn_buf;
368 368
 
369
-        if (url_open_dyn_buf(&dyn_buf) < 0)
369
+        if (avio_open_dyn_buf(&dyn_buf) < 0)
370 370
             return AVERROR(ENOMEM);
371 371
 
372 372
         hpos = put_header(pb, &ff_asf_comment_header);
... ...
@@ -497,7 +497,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
497 497
         else
498 498
             desc = p ? p->name : enc->codec_name;
499 499
 
500
-        if ( url_open_dyn_buf(&dyn_buf) < 0)
500
+        if ( avio_open_dyn_buf(&dyn_buf) < 0)
501 501
             return AVERROR(ENOMEM);
502 502
 
503 503
         avio_put_str16le(dyn_buf, desc);
... ...
@@ -89,7 +89,7 @@ int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
89 89
 int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
90 90
 {
91 91
     AVIOContext *pb;
92
-    int ret = url_open_dyn_buf(&pb);
92
+    int ret = avio_open_dyn_buf(&pb);
93 93
     if(ret < 0)
94 94
         return ret;
95 95
 
... ...
@@ -447,6 +447,7 @@ attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __att
447 447
 attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
448 448
 #endif
449 449
 attribute_deprecated void put_flush_packet(AVIOContext *s);
450
+attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
450 451
 /**
451 452
  * @}
452 453
  */
... ...
@@ -680,7 +681,7 @@ attribute_deprecated int url_close_buf(AVIOContext *s);
680 680
  * @param s new IO context
681 681
  * @return zero if no error.
682 682
  */
683
-int url_open_dyn_buf(AVIOContext **s);
683
+int avio_open_dyn_buf(AVIOContext **s);
684 684
 
685 685
 /**
686 686
  * Open a write only packetized memory stream with a maximum packet
... ...
@@ -696,7 +697,7 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
696 696
 /**
697 697
  * Return the written size and a pointer to the buffer. The buffer
698 698
  * must be freed with av_free(). If the buffer is opened with
699
- * url_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
699
+ * avio_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
700 700
  * added; if opened with url_open_dyn_packet_buf, no padding is added.
701 701
  *
702 702
  * @param s IO context
... ...
@@ -419,6 +419,10 @@ unsigned long get_checksum(AVIOContext *s)
419 419
 {
420 420
     return ffio_get_checksum(s);
421 421
 }
422
+int url_open_dyn_buf(AVIOContext **s)
423
+{
424
+    return avio_open_dyn_buf(s);
425
+}
422 426
 #endif
423 427
 
424 428
 int avio_put_str(AVIOContext *s, const char *str)
... ...
@@ -1023,7 +1027,7 @@ int64_t ffio_read_seek(AVIOContext *s, int stream_index,
1023 1023
     return ret;
1024 1024
 }
1025 1025
 
1026
-/* url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response
1026
+/* avio_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response
1027 1027
  * back to the server even if CONFIG_MUXERS is false. */
1028 1028
 #if CONFIG_MUXERS || CONFIG_NETWORK
1029 1029
 /* buffer handling */
... ...
@@ -1147,7 +1151,7 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
1147 1147
     return ret;
1148 1148
 }
1149 1149
 
1150
-int url_open_dyn_buf(AVIOContext **s)
1150
+int avio_open_dyn_buf(AVIOContext **s)
1151 1151
 {
1152 1152
     return url_open_dyn_buf_internal(s, 0);
1153 1153
 }
... ...
@@ -455,7 +455,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
455 455
     uint8_t *codecpriv;
456 456
     int ret, codecpriv_size;
457 457
 
458
-    ret = url_open_dyn_buf(&dyn_cp);
458
+    ret = avio_open_dyn_buf(&dyn_cp);
459 459
     if(ret < 0)
460 460
         return ret;
461 461
 
... ...
@@ -1026,7 +1026,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
1026 1026
 
1027 1027
     if (!s->pb->seekable) {
1028 1028
         if (!mkv->dyn_bc)
1029
-            url_open_dyn_buf(&mkv->dyn_bc);
1029
+            avio_open_dyn_buf(&mkv->dyn_bc);
1030 1030
         pb = mkv->dyn_bc;
1031 1031
     }
1032 1032
 
... ...
@@ -1660,7 +1660,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
1660 1660
             return 0;
1661 1661
         }
1662 1662
 
1663
-    ret = url_open_dyn_buf(&pb_buf);
1663
+    ret = avio_open_dyn_buf(&pb_buf);
1664 1664
     if(ret < 0)
1665 1665
         return ret;
1666 1666
 
... ...
@@ -417,7 +417,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
417 417
         goto done;
418 418
 
419 419
     /* Open a buffer for writing the hint */
420
-    if ((ret = url_open_dyn_buf(&hintbuf)) < 0)
420
+    if ((ret = avio_open_dyn_buf(&hintbuf)) < 0)
421 421
         goto done;
422 422
     av_init_packet(&hint_pkt);
423 423
     count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
... ...
@@ -96,7 +96,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
96 96
     uint8_t *pb;
97 97
     int (*put)(AVIOContext*, const char*);
98 98
     AVIOContext *dyn_buf;
99
-    if (url_open_dyn_buf(&dyn_buf) < 0)
99
+    if (avio_open_dyn_buf(&dyn_buf) < 0)
100 100
         return AVERROR(ENOMEM);
101 101
 
102 102
     /* check if the strings are ASCII-only and use UTF16 only if
... ...
@@ -436,7 +436,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
436 436
     AVIOContext *dyn_bc;
437 437
     uint8_t *dyn_buf=NULL;
438 438
     int count=0, dyn_size;
439
-    int ret = url_open_dyn_buf(&dyn_bc);
439
+    int ret = avio_open_dyn_buf(&dyn_bc);
440 440
     if(ret < 0)
441 441
         return ret;
442 442
 
... ...
@@ -462,7 +462,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
462 462
     AVIOContext *dyn_bc;
463 463
     uint8_t *dyn_buf=NULL;
464 464
     int count=0, dyn_size, i;
465
-    int ret = url_open_dyn_buf(&dyn_bc);
465
+    int ret = avio_open_dyn_buf(&dyn_bc);
466 466
     if(ret < 0)
467 467
         return ret;
468 468
 
... ...
@@ -495,7 +495,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
495 495
     AVChapter *ch    = nut->avf->chapters[id];
496 496
     int ret, dyn_size, count = 0;
497 497
 
498
-    ret = url_open_dyn_buf(&dyn_bc);
498
+    ret = avio_open_dyn_buf(&dyn_bc);
499 499
     if (ret < 0)
500 500
         return ret;
501 501
 
... ...
@@ -522,14 +522,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
522 522
 
523 523
     ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL);
524 524
 
525
-    ret = url_open_dyn_buf(&dyn_bc);
525
+    ret = avio_open_dyn_buf(&dyn_bc);
526 526
     if(ret < 0)
527 527
         return ret;
528 528
     write_mainheader(nut, dyn_bc);
529 529
     put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
530 530
 
531 531
     for (i=0; i < nut->avf->nb_streams; i++){
532
-        ret = url_open_dyn_buf(&dyn_bc);
532
+        ret = avio_open_dyn_buf(&dyn_bc);
533 533
         if(ret < 0)
534 534
             return ret;
535 535
         if ((ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i)) < 0)
... ...
@@ -537,14 +537,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
537 537
         put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
538 538
     }
539 539
 
540
-    ret = url_open_dyn_buf(&dyn_bc);
540
+    ret = avio_open_dyn_buf(&dyn_bc);
541 541
     if(ret < 0)
542 542
         return ret;
543 543
     write_globalinfo(nut, dyn_bc);
544 544
     put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
545 545
 
546 546
     for (i = 0; i < nut->avf->nb_streams; i++) {
547
-        ret = url_open_dyn_buf(&dyn_bc);
547
+        ret = avio_open_dyn_buf(&dyn_bc);
548 548
         if(ret < 0)
549 549
             return ret;
550 550
         ret = write_streaminfo(nut, dyn_bc, i);
... ...
@@ -560,7 +560,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
560 560
     }
561 561
 
562 562
     for (i = 0; i < nut->avf->nb_chapters; i++) {
563
-        ret = url_open_dyn_buf(&dyn_bc);
563
+        ret = avio_open_dyn_buf(&dyn_bc);
564 564
         if (ret < 0)
565 565
             return ret;
566 566
         ret = write_chapter(nut, dyn_bc, i);
... ...
@@ -728,7 +728,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
728 728
                          NULL);
729 729
 
730 730
         nut->last_syncpoint_pos= avio_tell(bc);
731
-        ret = url_open_dyn_buf(&dyn_bc);
731
+        ret = avio_open_dyn_buf(&dyn_bc);
732 732
         if(ret < 0)
733 733
             return ret;
734 734
         put_tt(nut, nus->time_base, dyn_bc, pkt->dts);
... ...
@@ -82,7 +82,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
82 82
     int ret, size;
83 83
     uint8_t *buf;
84 84
 
85
-    ret = url_open_dyn_buf(&pb);
85
+    ret = avio_open_dyn_buf(&pb);
86 86
     if (ret < 0)
87 87
         return ret;
88 88
     ffio_init_checksum(pb, ff_crc04C11DB7_update, 0);
... ...
@@ -264,7 +264,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
264 264
         return -1;
265 265
     s->last_octet_count = s->octet_count;
266 266
 
267
-    if (url_open_dyn_buf(&pb) < 0)
267
+    if (avio_open_dyn_buf(&pb) < 0)
268 268
         return -1;
269 269
 
270 270
     // Receiver Report
... ...
@@ -339,7 +339,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
339 339
     int len;
340 340
 
341 341
     /* Send a small RTP packet */
342
-    if (url_open_dyn_buf(&pb) < 0)
342
+    if (avio_open_dyn_buf(&pb) < 0)
343 343
         return;
344 344
 
345 345
     avio_w8(pb, (RTP_VERSION << 6));
... ...
@@ -355,7 +355,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
355 355
     av_free(buf);
356 356
 
357 357
     /* Send a minimal RTCP RR */
358
-    if (url_open_dyn_buf(&pb) < 0)
358
+    if (avio_open_dyn_buf(&pb) < 0)
359 359
         return;
360 360
 
361 361
     avio_w8(pb, (RTP_VERSION << 6));
... ...
@@ -208,7 +208,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
208 208
                     av_free(p);
209 209
                 }
210 210
                 if (!len_off && !asf->pktbuf &&
211
-                    (res = url_open_dyn_buf(&asf->pktbuf)) < 0)
211
+                    (res = avio_open_dyn_buf(&asf->pktbuf)) < 0)
212 212
                     return res;
213 213
                 if (!asf->pktbuf)
214 214
                     return AVERROR(EIO);
... ...
@@ -65,7 +65,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
65 65
             av_freep(&data->buf);
66 66
 
67 67
             data->timestamp = *timestamp;
68
-            if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0)
68
+            if ((ret = avio_open_dyn_buf(&data->dyn_buf)) < 0)
69 69
                 return ret;
70 70
         }
71 71
         avio_write(data->dyn_buf, buf, len);
... ...
@@ -86,7 +86,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
86 86
             url_close_dyn_buf(sv->pktbuf, &tmp);
87 87
             av_free(tmp);
88 88
         }
89
-        if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0)
89
+        if ((res = avio_open_dyn_buf(&sv->pktbuf)) < 0)
90 90
             return res;
91 91
         sv->timestamp   = *timestamp;
92 92
     }
... ...
@@ -85,7 +85,7 @@ static int vp8_handle_packet(AVFormatContext *ctx,
85 85
             // that for the next av_get_packet call
86 86
             ret = end_packet ? 1 : 0;
87 87
         }
88
-        if ((res = url_open_dyn_buf(&vp8->data)) < 0)
88
+        if ((res = avio_open_dyn_buf(&vp8->data)) < 0)
89 89
             return res;
90 90
         vp8->is_keyframe = *buf & 1;
91 91
         vp8->timestamp   = ts;
... ...
@@ -176,7 +176,7 @@ static int xiph_handle_packet(AVFormatContext * ctx,
176 176
         // end packet has been lost somewhere, so drop buffered data
177 177
         free_fragment_if_needed(data);
178 178
 
179
-        if((res = url_open_dyn_buf(&data->fragment)) < 0)
179
+        if((res = avio_open_dyn_buf(&data->fragment)) < 0)
180 180
             return res;
181 181
 
182 182
         avio_write(data->fragment, buf, pkt_len);