]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rmdec.c
Remove reimplementation of av_log2
[ffmpeg] / libavformat / rmdec.c
index f7f69fea000b606c6cc6c33f20ce450d9d5f6b5b..100d512adb02c19efe6471454448e0f52a75aea5 100644 (file)
@@ -20,7 +20,7 @@
  */
 #include "avformat.h"
 #include "rm.h"
-
+#include "avstring.h"
 
 static void get_str(ByteIOContext *pb, char *buf, int buf_size)
 {
@@ -175,8 +175,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
             }
         } else {
             st->codec->codec_id = CODEC_ID_NONE;
-            pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name),
-                    buf);
+            av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));
         }
         if (read_all) {
             get_byte(pb);
@@ -442,7 +441,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
     RMContext *rm = s->priv_data;
     ByteIOContext *pb = &s->pb;
     AVStream *st;
-    int i, len, tmp, j;
+    int i, len, j;
     int64_t timestamp, pos;
     uint8_t *ptr;
     int flags;
@@ -609,10 +608,8 @@ resync:
     /* for AC3, needs to swap bytes */
     if (st->codec->codec_id == CODEC_ID_AC3) {
         ptr = pkt->data;
-        for(j=0;j<len;j+=2) {
-            tmp = ptr[0];
-            ptr[0] = ptr[1];
-            ptr[1] = tmp;
+        for(j=0;j<pkt->size;j+=2) {
+            FFSWAP(int, ptr[0], ptr[1]);
             ptr += 2;
         }
     }