]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/aiffenc.c
flvdec: Add param change side data if the sample rate or channels have changed
[ffmpeg] / libavformat / aiffenc.c
index df43688d401953ec307cf400889c0d128d842161..2916d26fc61ef0740663cd23f0908b083ecae3dc 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/intfloat.h"
 #include "avformat.h"
 #include "internal.h"
 #include "aiff.h"
@@ -36,7 +36,7 @@ static int aiff_write_header(AVFormatContext *s)
     AIFFOutputContext *aiff = s->priv_data;
     AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
-    AVExtFloat sample_rate;
+    uint64_t sample_rate;
     int aifc = 0;
 
     /* First verify if format is ok */
@@ -82,8 +82,9 @@ static int aiff_write_header(AVFormatContext *s)
 
     avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */
 
-    sample_rate = av_dbl2ext((double)enc->sample_rate);
-    avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
+    sample_rate = av_double2int(enc->sample_rate);
+    avio_wb16(pb, (sample_rate >> 52) + (16383 - 1023));
+    avio_wb64(pb, UINT64_C(1) << 63 | sample_rate << 11);
 
     if (aifc) {
         avio_wl32(pb, enc->codec_tag);