]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ituh263dec.c
mov_chan: Pass a separate AVIOContext for reading
[ffmpeg] / libavcodec / ituh263dec.c
index f52ac7abfc40d1a231d09f1361690c5f68dd3a3e..cb26be21df2fbd8591781d58d9443fad53280ba2 100644 (file)
@@ -230,14 +230,14 @@ const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8
 int ff_h263_resync(MpegEncContext *s){
     int left, pos, ret;
 
-    if(s->codec_id==CODEC_ID_MPEG4){
+    if(s->codec_id==AV_CODEC_ID_MPEG4){
         skip_bits1(&s->gb);
         align_get_bits(&s->gb);
     }
 
     if(show_bits(&s->gb, 16)==0){
         pos= get_bits_count(&s->gb);
-        if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
+        if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
             ret= ff_mpeg4_decode_video_packet_header(s);
         else
             ret= h263_decode_gob_header(s);
@@ -254,7 +254,7 @@ int ff_h263_resync(MpegEncContext *s){
             GetBitContext bak= s->gb;
 
             pos= get_bits_count(&s->gb);
-            if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
+            if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
                 ret= ff_mpeg4_decode_video_packet_header(s);
             else
                 ret= h263_decode_gob_header(s);
@@ -458,7 +458,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
         }
     } else if (s->mb_intra) {
         /* DC coef */
-        if(s->codec_id == CODEC_ID_RV10){
+        if(s->codec_id == AV_CODEC_ID_RV10){
 #if CONFIG_RV10_DECODER
           if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) {
             int component, diff;
@@ -517,7 +517,7 @@ retry:
                 run = get_bits(&s->gb, 6);
                 level = (int8_t)get_bits(&s->gb, 8);
                 if(level == -128){
-                    if (s->codec_id == CODEC_ID_RV10) {
+                    if (s->codec_id == AV_CODEC_ID_RV10) {
                         /* XXX: should patch encoder too */
                         level = get_sbits(&s->gb, 12);
                     }else{
@@ -1083,6 +1083,22 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
         skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
     }
 
+    if (s->pict_type!=AV_PICTURE_TYPE_B) {
+        s->time            = s->picture_number;
+        s->pp_time         = s->time - s->last_non_b_time;
+        s->last_non_b_time = s->time;
+    }else{
+        s->time    = s->picture_number;
+        s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
+        if (s->pp_time <=s->pb_time ||
+            s->pp_time <= s->pp_time - s->pb_time ||
+            s->pp_time <= 0){
+            s->pp_time = 2;
+            s->pb_time = 1;
+        }
+        ff_mpeg4_init_direct_mv(s);
+    }
+
     /* PEI */
     while (get_bits1(&s->gb) != 0) {
         skip_bits(&s->gb, 8);