]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mpc.c
cljr: set the properties of the coded_frame, not input frame.
[ffmpeg] / libavformat / mpc.c
index a8f526a6272c54efc8a6c04fd9e9b9bde2fbc064..86e6f8e5b8c5e0a6e3226c71579c6cc445a01de1 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "libavcodec/get_bits.h"
 #include "avformat.h"
+#include "internal.h"
 #include "apetag.h"
 #include "id3v1.h"
 #include "libavutil/dict.h"
@@ -51,7 +52,7 @@ static int mpc_probe(AVProbeData *p)
     return 0;
 }
 
-static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mpc_read_header(AVFormatContext *s)
 {
     MPCContext *c = s->priv_data;
     AVStream *st;
@@ -96,7 +97,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
     st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
     avio_read(s->pb, st->codec->extradata, 16);
     st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
-    av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
+    avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
     /* scan for seekpoints */
     st->start_time = 0;
     st->duration = c->fcount;
@@ -117,7 +118,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     MPCContext *c = s->priv_data;
     int ret, size, size2, curbits, cur = c->curframe;
-    int64_t tmp, pos;
+    unsigned tmp;
+    int64_t pos;
 
     if (c->curframe >= c->fcount && c->fcount)
         return -1;
@@ -134,8 +136,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
     if(curbits <= 12){
         size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
     }else{
-        tmp = (tmp << 32) | avio_rl32(s->pb);
-        size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
+        size2 = (tmp << (curbits - 12) | avio_rl32(s->pb) >> (44 - curbits)) & 0xFFFFF;
     }
     curbits += 20;
     avio_seek(s->pb, pos, SEEK_SET);