]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/spdifenc.c
avutil: remove deprecated AVClass.child_class_next
[ffmpeg] / libavformat / spdifenc.c
index dcfab87cc43d959a784a4b14f636093e91be06b4..c3ba3a1a19e38051bdfdd4348de1f5067fd1df3b 100644 (file)
@@ -122,14 +122,16 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt)
     IEC61937Context *ctx = s->priv_data;
     static const uint8_t eac3_repeat[4] = {6, 3, 2, 1};
     int repeat = 1;
+    uint8_t *tmp;
 
     int bsid = pkt->data[5] >> 3;
     if (bsid > 10 && (pkt->data[4] & 0xc0) != 0xc0) /* fscod */
         repeat = eac3_repeat[(pkt->data[4] & 0x30) >> 4]; /* numblkscod */
 
-    ctx->hd_buf[0] = av_fast_realloc(ctx->hd_buf[0], &ctx->hd_buf_size, ctx->hd_buf_filled + pkt->size);
-    if (!ctx->hd_buf[0])
+    tmp = av_fast_realloc(ctx->hd_buf[0], &ctx->hd_buf_size, ctx->hd_buf_filled + pkt->size);
+    if (!tmp)
         return AVERROR(ENOMEM);
+    ctx->hd_buf[0] = tmp;
 
     memcpy(&ctx->hd_buf[0][ctx->hd_buf_filled], pkt->data, pkt->size);
 
@@ -435,9 +437,9 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket *pkt)
     if (AV_RB24(pkt->data + 4) == 0xf8726f) {
         /* major sync unit, fetch sample rate */
         if (pkt->data[7] == 0xba)
-            ratebits = pkt->data[8] >> 8;
+            ratebits = pkt->data[8] >> 4;
         else if (pkt->data[7] == 0xbb)
-            ratebits = pkt->data[9] >> 8;
+            ratebits = pkt->data[9] >> 4;
         else
             return AVERROR_INVALIDDATA;