[FFmpeg-soc] [soc]: r1054 - libavfilter/ffmpeg.diff

koorogi subversion at mplayerhq.hu
Mon Aug 20 16:38:56 CEST 2007


Author: koorogi
Date: Mon Aug 20 16:38:56 2007
New Revision: 1054

Log:
Make ffplay use the filter system's aspect ratio


Modified:
   libavfilter/ffmpeg.diff

Modified: libavfilter/ffmpeg.diff
==============================================================================
--- libavfilter/ffmpeg.diff	(original)
+++ libavfilter/ffmpeg.diff	Mon Aug 20 16:38:56 2007
@@ -84,7 +84,35 @@ Index: ffplay.c
  
  /* current context */
  static int is_full_screen;
-@@ -858,9 +874,15 @@
+@@ -647,15 +663,22 @@
+ 
+     vp = &is->pictq[is->pictq_rindex];
+     if (vp->bmp) {
++#if ENABLE_AVFILTER
++        if (vp->picref->pixel_aspect.num == 0)
++            aspect_ratio = 0;
++        else
++            aspect_ratio = av_q2d(vp->picref->pixel_aspect);
++#else
+         /* XXX: use variable in the frame */
+         if (is->video_st->codec->sample_aspect_ratio.num == 0)
+             aspect_ratio = 0;
+         else
+-            aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio)
+-                * is->video_st->codec->width / is->video_st->codec->height;;
+-        if (aspect_ratio <= 0.0)
+-            aspect_ratio = (float)is->video_st->codec->width /
+-                (float)is->video_st->codec->height;
++            aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio);
++#endif
++        if(aspect_ratio <= 0.0)
++            aspect_ratio = (float)vp->width / (float)vp->height;
++        else
++            aspect_ratio *= (float)vp->width / (float)vp->height;
+         /* if an active format is indicated, then it overrides the
+            mpeg format */
+ #if 0
+@@ -858,9 +881,15 @@
      } else if(!is_full_screen && screen_width){
          w = screen_width;
          h = screen_height;
@@ -100,7 +128,7 @@ Index: ffplay.c
      } else {
          w = 640;
          h = 480;
-@@ -1166,6 +1188,20 @@
+@@ -1166,6 +1195,20 @@
      if (vp->bmp)
          SDL_FreeYUVOverlay(vp->bmp);
  
@@ -121,7 +149,7 @@ Index: ffplay.c
  #if 0
      /* XXX: use generic function */
      /* XXX: disable overlay if no hardware acceleration or if RGB format */
-@@ -1183,12 +1219,9 @@
+@@ -1183,12 +1226,9 @@
          break;
      }
  #endif
@@ -135,7 +163,7 @@ Index: ffplay.c
  
      SDL_LockMutex(is->pictq_mutex);
      vp->allocated = 1;
-@@ -1222,8 +1255,13 @@
+@@ -1222,8 +1262,13 @@
  
      /* alloc or resize hardware picture buffer */
      if (!vp->bmp ||
@@ -149,7 +177,7 @@ Index: ffplay.c
          SDL_Event event;
  
          vp->allocated = 0;
-@@ -1247,6 +1285,12 @@
+@@ -1247,6 +1292,12 @@
  
      /* if the frame is not skipped, then display it */
      if (vp->bmp) {
@@ -162,7 +190,7 @@ Index: ffplay.c
          /* get a pointer on the bitmap */
          SDL_LockYUVOverlay (vp->bmp);
  
-@@ -1259,16 +1303,16 @@
+@@ -1259,16 +1310,16 @@
          pict.linesize[1] = vp->bmp->pitches[2];
          pict.linesize[2] = vp->bmp->pitches[1];
          img_convert_ctx = sws_getCachedContext(img_convert_ctx,
@@ -183,7 +211,7 @@ Index: ffplay.c
          /* update the bitmap content */
          SDL_UnlockYUVOverlay(vp->bmp);
  
-@@ -1338,21 +1382,12 @@
+@@ -1338,21 +1389,12 @@
      avcodec_default_release_buffer(c, pic);
  }
  
@@ -208,7 +236,7 @@ Index: ffplay.c
          if(pkt->data == flush_pkt.data){
              avcodec_flush_buffers(is->video_st->codec);
              continue;
-@@ -1361,31 +1396,219 @@
+@@ -1361,31 +1403,220 @@
          /* NOTE: ipts is the PTS of the _first_ picture beginning in
             this packet, if any */
          global_video_pkt_pts= pkt->pts;
@@ -285,6 +313,7 @@ Index: ffplay.c
 +                    picref->pic->format, picref->w, picref->h);
 +
 +    picref->pts = pts;
++    picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
 +    avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
 +    avfilter_draw_slice(link, 0, picref->h);
 +    avfilter_end_frame(link);
@@ -440,7 +469,7 @@ Index: ffplay.c
      av_free(frame);
      return 0;
  }
-@@ -2136,6 +2359,12 @@
+@@ -2136,6 +2367,12 @@
      /* free all pictures */
      for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
          vp = &is->pictq[i];
@@ -453,7 +482,7 @@ Index: ffplay.c
          if (vp->bmp) {
              SDL_FreeYUVOverlay(vp->bmp);
              vp->bmp = NULL;
-@@ -2488,6 +2717,9 @@
+@@ -2488,6 +2725,9 @@
  #endif
      { "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
      { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },



More information about the FFmpeg-soc mailing list