]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/avienc.c
avio: deprecate url_fgets
[ffmpeg] / libavformat / avienc.c
index 24acc9297ca4a7ad1bbe610b793c4d5c5e5eda66..8d9980cf460af0821ae5c03c3b28536158e8c124 100644 (file)
@@ -124,13 +124,13 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
     int64_t file_size;
     AVCodecContext* stream;
 
-    file_size = url_ftell(pb);
+    file_size = avio_tell(pb);
     for(n = 0; n < s->nb_streams; n++) {
         AVIStream *avist= s->streams[n]->priv_data;
 
         assert(avist->frames_hdr_strm);
         stream = s->streams[n]->codec;
-        url_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
+        avio_seek(pb, avist->frames_hdr_strm, SEEK_SET);
         ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
         if(au_ssize == 0) {
             avio_wl32(pb, avist->packet_count);
@@ -142,10 +142,10 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
     }
     if(riff_id == 1) {
         assert(avi->frames_hdr_all);
-        url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
+        avio_seek(pb, avi->frames_hdr_all, SEEK_SET);
         avio_wl32(pb, nb_frames);
     }
-    url_fseek(pb, file_size, SEEK_SET);
+    avio_seek(pb, file_size, SEEK_SET);
 
     return 0;
 }
@@ -201,7 +201,7 @@ static int avi_write_header(AVFormatContext *s)
         avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
     else
         avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
-    avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
+    avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */
     avio_wl32(pb, nb_frames); /* nb frames, filled later */
     avio_wl32(pb, 0); /* initial frame */
     avio_wl32(pb, s->nb_streams); /* nb streams */
@@ -258,7 +258,7 @@ static int avi_write_header(AVFormatContext *s)
         av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
 
         avio_wl32(pb, 0); /* start */
-        avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
+        avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */
         if (url_is_streamed(pb))
             avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
         else
@@ -318,7 +318,7 @@ static int avi_write_header(AVFormatContext *s)
             avio_w8(pb, 0);          /* bIndexSubType (0 == frame index) */
             avio_w8(pb, 0);          /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
             avio_wl32(pb, 0);        /* nEntriesInUse (will fill out later on) */
-            ffio_wfourcc(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
+            ffio_wfourcc(pb, avi_stream2fourcc(tag, i, stream->codec_type));
                                     /* dwChunkId */
             avio_wl64(pb, 0);        /* dwReserved[3]
             avio_wl32(pb, 0);           Must be 0.    */
@@ -415,12 +415,12 @@ static int avi_write_ix(AVFormatContext *s)
         AVIStream *avist= s->streams[i]->priv_data;
          int64_t ix, pos;
 
-         avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
+         avi_stream2fourcc(tag, i, s->streams[i]->codec->codec_type);
          ix_tag[3] = '0' + i;
 
          /* Writing AVI OpenDML leaf index chunk */
-         ix = url_ftell(pb);
-         ffio_wfourcc(pb, &ix_tag[0]);     /* ix?? */
+         ix = avio_tell(pb);
+         ffio_wfourcc(pb, ix_tag);     /* ix?? */
          avio_wl32(pb, avist->indexes.entry * 8 + 24);
                                       /* chunk size */
          avio_wl16(pb, 2);             /* wLongsPerEntry */
@@ -428,7 +428,7 @@ static int avi_write_ix(AVFormatContext *s)
          avio_w8(pb, 1);             /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
          avio_wl32(pb, avist->indexes.entry);
                                       /* nEntriesInUse */
-         ffio_wfourcc(pb, &tag[0]);    /* dwChunkId */
+         ffio_wfourcc(pb, tag);        /* dwChunkId */
          avio_wl64(pb, avi->movi_list);/* qwBaseOffset */
          avio_wl32(pb, 0);             /* dwReserved_3 (must be 0) */
 
@@ -439,19 +439,19 @@ static int avi_write_ix(AVFormatContext *s)
                           (ie->flags & 0x10 ? 0 : 0x80000000));
          }
          put_flush_packet(pb);
-         pos = url_ftell(pb);
+         pos = avio_tell(pb);
 
          /* Updating one entry in the AVI OpenDML master index */
-         url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
+         avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
          ffio_wfourcc(pb, "indx");            /* enabling this entry */
-         url_fskip(pb, 8);
+         avio_seek(pb, 8, SEEK_CUR);
          avio_wl32(pb, avi->riff_id);         /* nEntriesInUse */
-         url_fskip(pb, 16*avi->riff_id);
+         avio_seek(pb, 16*avi->riff_id, SEEK_CUR);
          avio_wl64(pb, ix);                   /* qwOffset */
          avio_wl32(pb, pos - ix);             /* dwSize */
          avio_wl32(pb, avist->indexes.entry); /* dwDuration */
 
-         url_fseek(pb, pos, SEEK_SET);
+         avio_seek(pb, pos, SEEK_SET);
     }
     return 0;
 }
@@ -491,9 +491,9 @@ static int avi_write_idx1(AVFormatContext *s)
             }
             if (!empty) {
                 avist= s->streams[stream_id]->priv_data;
-                avi_stream2fourcc(&tag[0], stream_id,
+                avi_stream2fourcc(tag, stream_id,
                                   s->streams[stream_id]->codec->codec_type);
-                ffio_wfourcc(pb, &tag[0]);
+                ffio_wfourcc(pb, tag);
                 avio_wl32(pb, ie->flags);
                 avio_wl32(pb, ie->pos);
                 avio_wl32(pb, ie->len);
@@ -533,7 +533,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 
     // Make sure to put an OpenDML chunk when the file size exceeds the limits
     if (!url_is_streamed(pb) &&
-        (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
+        (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
 
         avi_write_ix(s);
         ff_end_tag(pb, avi->movi_list);
@@ -545,7 +545,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
         avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi");
     }
 
-    avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
+    avi_stream2fourcc(tag, stream_index, enc->codec_type);
     if(pkt->flags&AV_PKT_FLAG_KEY)
         flags = 0x10;
     if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -567,7 +567,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
 
         idx->cluster[cl][id].flags = flags;
-        idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
+        idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list;
         idx->cluster[cl][id].len = size;
         idx->entry++;
     }
@@ -600,10 +600,10 @@ static int avi_write_trailer(AVFormatContext *s)
             ff_end_tag(pb, avi->movi_list);
             ff_end_tag(pb, avi->riff_start);
 
-            file_size = url_ftell(pb);
-            url_fseek(pb, avi->odml_list - 8, SEEK_SET);
+            file_size = avio_tell(pb);
+            avio_seek(pb, avi->odml_list - 8, SEEK_SET);
             ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
-            url_fskip(pb, 16);
+            avio_seek(pb, 16, SEEK_CUR);
 
             for (n=nb_frames=0;n<s->nb_streams;n++) {
                 AVCodecContext *stream = s->streams[n]->codec;
@@ -619,7 +619,7 @@ static int avi_write_trailer(AVFormatContext *s)
                 }
             }
             avio_wl32(pb, nb_frames);
-            url_fseek(pb, file_size, SEEK_SET);
+            avio_seek(pb, file_size, SEEK_SET);
 
             avi_write_counters(s, avi->riff_id);
         }