]> git.sesse.net Git - vlc/commitdiff
Removed picture_heap_t::i_aspect/width/height/chroma.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 18 Apr 2010 13:42:41 +0000 (15:42 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 18 Apr 2010 14:27:50 +0000 (16:27 +0200)
include/vlc_vout.h
src/video_output/video_output.c
src/video_output/video_widgets.c
src/video_output/vout_intf.c
src/video_output/vout_pictures.c
src/video_output/vout_wrapper.c

index 005467d85cfbc01b7645a913f7f6b63ade01c617..c0249548451faec9c0664fedf6ccb0e5bf08e288 100644 (file)
@@ -43,16 +43,6 @@ struct picture_heap_t
 {
     int i_pictures;                                   /**< current heap size */
 
-    /* \name Picture static properties
-     * Those properties are fixed at initialization and should NOT be modified
-     * @{
-     */
-    unsigned int i_width;                                 /**< picture width */
-    unsigned int i_height;                               /**< picture height */
-    vlc_fourcc_t i_chroma;                               /**< picture chroma */
-    unsigned int i_aspect;                                 /**< aspect ratio */
-    /**@}*/
-
     /* Real pictures */
     picture_t*      pp_picture[VOUT_MAX_PICTURES];             /**< pictures */
     int             i_last_used_pic;              /**< last used pic in heap */
index 391ac2d1493bad1440c0b79f8555c60596e625a0..e69efed9832725d273c0ec5effbfc459253b7613 100644 (file)
@@ -241,12 +241,6 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
 
                 p_vout->fmt_render.i_sar_num = i_sar_num;
                 p_vout->fmt_render.i_sar_den = i_sar_den;
-
-                p_vout->render.i_aspect = (int64_t)i_sar_num *
-                                                   p_vout->fmt_render.i_width *
-                                                   VOUT_ASPECT_FACTOR /
-                                                   i_sar_den /
-                                                   p_vout->fmt_render.i_height;
                 p_vout->i_changes |= VOUT_ASPECT_CHANGE;
             }
             vlc_mutex_unlock( &p_vout->change_lock );
@@ -289,26 +283,19 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     int              i_index;                               /* loop variable */
     vlc_value_t      text;
 
-    unsigned int i_width = p_fmt->i_width;
-    unsigned int i_height = p_fmt->i_height;
-    vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
 
     config_chain_t *p_cfg;
     char *psz_parser;
     char *psz_name;
 
-    if( i_width <= 0 || i_height <= 0 )
+    if( p_fmt->i_width <= 0 || p_fmt->i_height <= 0 )
         return NULL;
+    const vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
 
     vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
                  p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 );
     if( p_fmt->i_sar_num <= 0 || p_fmt->i_sar_den <= 0 )
         return NULL;
-    unsigned int i_aspect = (int64_t)p_fmt->i_sar_num *
-                                     i_width *
-                                     VOUT_ASPECT_FACTOR /
-                                     p_fmt->i_sar_den /
-                                     i_height;
 
     /* Allocate descriptor */
     static const char typename[] = "video output";
@@ -340,22 +327,15 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     p_vout->fmt_render        = *p_fmt;   /* FIXME palette */
     p_vout->fmt_in            = *p_fmt;   /* FIXME palette */
 
+    p_vout->fmt_render.i_chroma = 
+    p_vout->fmt_in.i_chroma     = i_chroma;
     video_format_FixRgb( &p_vout->fmt_render );
     video_format_FixRgb( &p_vout->fmt_in );
 
-    p_vout->render.i_width    = i_width;
-    p_vout->render.i_height   = i_height;
-    p_vout->render.i_chroma   = i_chroma;
-    p_vout->render.i_aspect   = i_aspect;
-
     p_vout->render.i_last_used_pic = -1;
 
     /* Zero the output heap */
     I_OUTPUTPICTURES = 0;
-    p_vout->output.i_width    = 0;
-    p_vout->output.i_height   = 0;
-    p_vout->output.i_chroma   = 0;
-    p_vout->output.i_aspect   = 0;
 
     /* Initialize misc stuff */
     p_vout->i_changes    = 0;
@@ -778,22 +758,12 @@ static int InitThread( vout_thread_t *p_vout )
 
     msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
 
-    if( !p_vout->fmt_out.i_width || !p_vout->fmt_out.i_height )
-    {
-        p_vout->fmt_out.i_width = p_vout->fmt_out.i_visible_width =
-            p_vout->output.i_width;
-        p_vout->fmt_out.i_height = p_vout->fmt_out.i_visible_height =
-            p_vout->output.i_height;
-        p_vout->fmt_out.i_x_offset =  p_vout->fmt_out.i_y_offset = 0;
-
-        p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
-    }
+    assert( p_vout->fmt_out.i_width > 0 && p_vout->fmt_out.i_height > 0 );
     if( !p_vout->fmt_out.i_sar_num || !p_vout->fmt_out.i_sar_num )
     {
-        p_vout->fmt_out.i_sar_num = p_vout->output.i_aspect *
-            p_vout->fmt_out.i_height;
-        p_vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR *
-            p_vout->fmt_out.i_width;
+        /* FIXME is it possible to end up here ? */
+        p_vout->fmt_out.i_sar_num = 1;
+        p_vout->fmt_out.i_sar_den = 1;
     }
 
     vlc_ureduce( &p_vout->fmt_out.i_sar_num, &p_vout->fmt_out.i_sar_den,
@@ -833,9 +803,9 @@ static int InitThread( vout_thread_t *p_vout )
              p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den,
              p_vout->fmt_out.i_rmask, p_vout->fmt_out.i_gmask, p_vout->fmt_out.i_bmask );
 
-    assert( p_vout->output.i_width == p_vout->render.i_width &&
-            p_vout->output.i_height == p_vout->render.i_height &&
-            p_vout->output.i_chroma == p_vout->render.i_chroma );
+    assert( p_vout->fmt_out.i_width == p_vout->fmt_render.i_width &&
+            p_vout->fmt_out.i_height == p_vout->fmt_render.i_height &&
+            p_vout->fmt_out.i_chroma == p_vout->fmt_render.i_chroma );
     /* Check whether we managed to create direct buffers similar to
      * the render buffers, ie same size and chroma */
 
index 49ceff3bbb309629c5eb0f0b417d05a73317d63e..cbc2c30903855f4e4d40b09ea795bfc7707462b7 100644 (file)
@@ -46,11 +46,13 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
 
     if( p_vout && ( var_InheritBool( p_caller, "osd" ) && ( i_position >= 0 ) ) )
     {
-        osd_Slider( p_caller, vout_GetSpu( p_vout ), p_vout->render.i_width,
-            p_vout->render.i_height, p_vout->fmt_in.i_x_offset,
-            p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height
-                                    - p_vout->fmt_in.i_y_offset,
-            i_channel, i_position, i_type );
+        osd_Slider( p_caller, vout_GetSpu( p_vout ),
+                    p_vout->fmt_render.i_width,
+                    p_vout->fmt_render.i_height,
+                    p_vout->fmt_in.i_x_offset,
+                    p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height
+                                            - p_vout->fmt_in.i_y_offset,
+                    i_channel, i_position, i_type );
     }
     vlc_object_release( p_vout );
 }
@@ -70,8 +72,8 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
     {
         osd_Icon( p_caller,
                   vout_GetSpu( p_vout ),
-                  p_vout->render.i_width,
-                  p_vout->render.i_height,
+                  p_vout->fmt_render.i_width,
+                  p_vout->fmt_render.i_height,
                   p_vout->fmt_in.i_width - p_vout->fmt_in.i_visible_width
                                          - p_vout->fmt_in.i_x_offset,
                   p_vout->fmt_in.i_y_offset,
index d09b961855762a9416a6809667d1dc4f42c9daa5..f9e94bbb143b4488adc4d85346b7167ef5f1adc2 100644 (file)
@@ -817,10 +817,6 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
     /* Restore defaults */
     p_vout->fmt_in.i_sar_num = p_vout->fmt_render.i_sar_num;
     p_vout->fmt_in.i_sar_den = p_vout->fmt_render.i_sar_den;
-    p_vout->render.i_aspect = (int64_t)p_vout->fmt_render.i_sar_num *
-                                       p_vout->fmt_render.i_width *
-                                       VOUT_ASPECT_FACTOR /
-                                       p_vout->fmt_render.i_sar_den / p_vout->fmt_render.i_height;
 
     if( !psz_parser ) goto aspect_end;
 
@@ -835,18 +831,12 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
     vlc_ureduce( &i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 0 );
     p_vout->fmt_in.i_sar_num = i_sar_num;
     p_vout->fmt_in.i_sar_den = i_sar_den;
-    p_vout->render.i_aspect = i_aspect_num * VOUT_ASPECT_FACTOR / i_aspect_den;
 
  aspect_end:
     if( p_vout->p->i_par_num && p_vout->p->i_par_den )
     {
         p_vout->fmt_in.i_sar_num *= p_vout->p->i_par_den;
         p_vout->fmt_in.i_sar_den *= p_vout->p->i_par_num;
-        p_vout->render.i_aspect = (int64_t)p_vout->fmt_in.i_sar_num *
-                                           p_vout->fmt_in.i_width *
-                                           VOUT_ASPECT_FACTOR /
-                                           p_vout->fmt_in.i_sar_den /
-                                           p_vout->fmt_in.i_height;
     }
 
     p_vout->i_changes |= VOUT_ASPECT_CHANGE;
index be593f88bdf0ce89e32922a231383e27ddd8e27d..c3b8415a785fa23bdcf3f665b2381316c1016e37 100644 (file)
@@ -167,10 +167,9 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
     if( p_freepic != NULL )
     {
         vout_AllocatePicture( VLC_OBJECT(p_vout),
-                              p_freepic, p_vout->render.i_chroma,
-                              p_vout->render.i_width, p_vout->render.i_height,
-                              p_vout->render.i_aspect * p_vout->render.i_height,
-                              VOUT_ASPECT_FACTOR      * p_vout->render.i_width);
+                              p_freepic, p_vout->fmt_render.i_chroma,
+                              p_vout->fmt_render.i_width, p_vout->fmt_render.i_height,
+                              p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den ); /* The right AR is in fmt_in and not fmt_render */
 
         if( p_freepic->i_planes )
         {
index 7a97877c71b6dc85e28f272f90452325bca3d6ff..4e5d579388d386c5fac8a827aff17189dc92cf5a 100644 (file)
@@ -146,19 +146,13 @@ int vout_InitWrapper(vout_thread_t *vout)
     /* */
     video_format_t source = vd->source;
 
-    vout->output.i_chroma = source.i_chroma;
-    vout->output.i_width  = source.i_width;
-    vout->output.i_height = source.i_height;
-    vout->output.i_aspect = (int64_t)source.i_sar_num * source.i_width * VOUT_ASPECT_FACTOR / source.i_sar_den / source.i_height;
-
-    /* also set fmt_out (completly broken API) */
-    vout->fmt_out.i_chroma         = vout->output.i_chroma;
+    vout->fmt_out.i_chroma         = source.i_chroma;
     vout->fmt_out.i_width          =
-    vout->fmt_out.i_visible_width  = vout->output.i_width;
+    vout->fmt_out.i_visible_width  = source.i_width;
     vout->fmt_out.i_height         =
-    vout->fmt_out.i_visible_height = vout->output.i_height;
-    vout->fmt_out.i_sar_num        = vout->output.i_aspect * vout->output.i_height;
-    vout->fmt_out.i_sar_den        = VOUT_ASPECT_FACTOR    * vout->output.i_width;
+    vout->fmt_out.i_visible_height = source.i_height;
+    vout->fmt_out.i_sar_num        = source.i_sar_num;
+    vout->fmt_out.i_sar_den        = source.i_sar_den;
     vout->fmt_out.i_x_offset       = 0;
     vout->fmt_out.i_y_offset       = 0;
     vout->fmt_out.i_rmask          = source.i_rmask;
@@ -277,8 +271,6 @@ int vout_ManageWrapper(vout_thread_t *vout)
             vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
         }
         if (vout->i_changes & VOUT_ASPECT_CHANGE) {
-            vout->output.i_aspect   = (int64_t)vout->fmt_in.i_sar_num * vout->fmt_in.i_width * VOUT_ASPECT_FACTOR /
-                                      vout->fmt_in.i_sar_den / vout->fmt_in.i_height;
             vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num;
             vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den;