]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/swfenc.c
Set channel layout for 4 and 5.1 channel cdata audio files
[ffmpeg] / libavformat / swfenc.c
index c698600bdd15086a954a9bbc20a912081a7b6a50..09c2d61f28a8ec222f69150bd765dabe78b180fb 100644 (file)
@@ -29,7 +29,7 @@ static void put_swf_tag(AVFormatContext *s, int tag)
     SWFContext *swf = s->priv_data;
     AVIOContext *pb = s->pb;
 
-    swf->tag_pos = url_ftell(pb);
+    swf->tag_pos = avio_tell(pb);
     swf->tag = tag;
     /* reserve some room for the tag */
     if (tag & TAG_LONG) {
@@ -47,10 +47,10 @@ static void put_swf_end_tag(AVFormatContext *s)
     int64_t pos;
     int tag_len, tag;
 
-    pos = url_ftell(pb);
+    pos = avio_tell(pb);
     tag_len = pos - swf->tag_pos - 2;
     tag = swf->tag;
-    url_fseek(pb, swf->tag_pos, SEEK_SET);
+    avio_seek(pb, swf->tag_pos, SEEK_SET);
     if (tag & TAG_LONG) {
         tag &= ~TAG_LONG;
         avio_wl16(pb, (tag << 6) | 0x3f);
@@ -59,7 +59,7 @@ static void put_swf_end_tag(AVFormatContext *s)
         assert(tag_len < 0x3f);
         avio_wl16(pb, (tag << 6) | tag_len);
     }
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 static inline void max_nbits(int *nbits_ptr, int val)
@@ -229,7 +229,7 @@ static int swf_write_header(AVFormatContext *s)
     else
         swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate;
 
-    put_tag(pb, "FWS");
+    avio_write(pb, "FWS", 3);
 
     if (!strcmp("avm2", s->oformat->name))
         version = 9;
@@ -246,7 +246,7 @@ static int swf_write_header(AVFormatContext *s)
 
     put_swf_rect(pb, 0, width * 20, 0, height * 20);
     avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
-    swf->duration_pos = url_ftell(pb);
+    swf->duration_pos = avio_tell(pb);
     avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
 
     /* avm2/swf v9 (also v8?) files require a file attribute tag */
@@ -326,7 +326,7 @@ static int swf_write_header(AVFormatContext *s)
         put_swf_end_tag(s);
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -346,7 +346,7 @@ static int swf_write_video(AVFormatContext *s,
             /* create a new video object */
             put_swf_tag(s, TAG_VIDEOSTREAM);
             avio_wl16(pb, VIDEO_ID);
-            swf->vframes_pos = url_ftell(pb);
+            swf->vframes_pos = avio_tell(pb);
             avio_wl16(pb, 15000); /* hard flash player limit */
             avio_wl16(pb, enc->width);
             avio_wl16(pb, enc->height);
@@ -361,7 +361,7 @@ static int swf_write_video(AVFormatContext *s,
             avio_wl16(pb, VIDEO_ID);
             put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0);
             avio_wl16(pb, swf->video_frame_number);
-            put_tag(pb, "video");
+            avio_write(pb, "video", 5);
             avio_w8(pb, 0x00);
             put_swf_end_tag(s);
         } else {
@@ -421,7 +421,7 @@ static int swf_write_video(AVFormatContext *s,
         put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
         avio_wl16(pb, swf->sound_samples);
         avio_wl16(pb, 0); // seek samples
-        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &avio_write);
+        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, (void*)avio_write);
         put_swf_end_tag(s);
 
         /* update FIFO */
@@ -432,7 +432,7 @@ static int swf_write_video(AVFormatContext *s,
     put_swf_tag(s, TAG_SHOWFRAME);
     put_swf_end_tag(s);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
@@ -489,18 +489,18 @@ static int swf_write_trailer(AVFormatContext *s)
     put_swf_tag(s, TAG_END);
     put_swf_end_tag(s);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     /* patch file size and number of frames if not streamed */
-    if (!url_is_streamed(s->pb) && video_enc) {
-        file_size = url_ftell(pb);
-        url_fseek(pb, 4, SEEK_SET);
+    if (s->pb->seekable && video_enc) {
+        file_size = avio_tell(pb);
+        avio_seek(pb, 4, SEEK_SET);
         avio_wl32(pb, file_size);
-        url_fseek(pb, swf->duration_pos, SEEK_SET);
+        avio_seek(pb, swf->duration_pos, SEEK_SET);
         avio_wl16(pb, swf->video_frame_number);
-        url_fseek(pb, swf->vframes_pos, SEEK_SET);
+        avio_seek(pb, swf->vframes_pos, SEEK_SET);
         avio_wl16(pb, swf->video_frame_number);
-        url_fseek(pb, file_size, SEEK_SET);
+        avio_seek(pb, file_size, SEEK_SET);
     }
     return 0;
 }