]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/asfenc.c
avcodec: move mpeg4 profiles to profiles.h
[ffmpeg] / libavformat / asfenc.c
index 3cfe75a5d5e0b9fafa08123f2ea904052007dbf9..73afb13200b1a36e8e90dffbeb79ba4eaf22e15f 100644 (file)
@@ -22,7 +22,6 @@
 #include "libavutil/avassert.h"
 #include "libavutil/dict.h"
 #include "libavutil/mathematics.h"
-#include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
 #include "avlanguage.h"
@@ -358,12 +357,12 @@ static int asf_write_markers(AVFormatContext *s)
         int64_t pres_time = av_rescale_q(c->start, c->time_base, scale);
         uint64_t offset;
         int32_t send_time = get_send_time(asf, pres_time, &offset);
-        int len = 0;
+        int len = 0, ret;
         uint8_t *buf;
         AVIOContext *dyn_buf;
         if (t) {
-            if (avio_open_dyn_buf(&dyn_buf) < 0)
-                return AVERROR(ENOMEM);
+            if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+                return ret;
             avio_put_str16le(dyn_buf, t->value);
             len = avio_close_dyn_buf(dyn_buf, &buf);
         }
@@ -580,12 +579,12 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
 
     /* title and other info */
     if (has_title) {
-        int len;
+        int len, ret;
         uint8_t *buf;
         AVIOContext *dyn_buf;
 
-        if (avio_open_dyn_buf(&dyn_buf) < 0)
-            return AVERROR(ENOMEM);
+        if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+            return ret;
 
         hpos = put_header(pb, &ff_asf_comment_header);
 
@@ -715,10 +714,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
         if (desc) {
             AVIOContext *dyn_buf;
             uint8_t *buf;
-            int len;
+            int len, ret;
 
-            if (avio_open_dyn_buf(&dyn_buf) < 0)
-                return AVERROR(ENOMEM);
+            if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+                return ret;
 
             avio_put_str16le(dyn_buf, desc);
             len = avio_close_dyn_buf(dyn_buf, &buf);
@@ -802,8 +801,6 @@ static int asf_write_header(AVFormatContext *s)
         return -1;
     }
 
-    avio_flush(s->pb);
-
     asf->packet_nb_payloads     = 0;
     asf->packet_timestamp_start = -1;
     asf->packet_timestamp_end   = -1;
@@ -895,7 +892,8 @@ static void flush_packet(AVFormatContext *s)
 
     avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size);
 
-    avio_flush(s->pb);
+    avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT);
+
     asf->nb_packets++;
     asf->packet_nb_payloads     = 0;
     asf->packet_timestamp_start = -1;
@@ -1133,7 +1131,6 @@ static int asf_write_trailer(AVFormatContext *s)
             return ret;
         asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->next_start_sec);
     }
-    avio_flush(s->pb);
 
     if (asf->is_streamed || !(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) {
         put_chunk(s, 0x4524, 0, 0); /* end of stream */