[vlc-devel] commit: Fixed spu_RenderSubpictures prototype. (Laurent Aimar )

git version control git at videolan.org
Wed Sep 17 19:11:29 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 16 23:50:07 2008 +0200| [ef801bc9edd2b821983be8269b75a308782f2841] | committer: Laurent Aimar 

Fixed spu_RenderSubpictures prototype.

It now requires source format instead of scaling parameters.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef801bc9edd2b821983be8269b75a308782f2841
---

 include/vlc_osd.h                   |    9 +++++++-
 modules/stream_out/transcode.c      |   10 +-------
 src/video_output/vout_pictures.c    |   38 ++++++++++++----------------------
 src/video_output/vout_subpictures.c |   15 +++++--------
 4 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/include/vlc_osd.h b/include/vlc_osd.h
index 9b92b52..d704272 100644
--- a/include/vlc_osd.h
+++ b/include/vlc_osd.h
@@ -122,7 +122,14 @@ VLC_EXPORT( subpicture_region_t *,__spu_CreateRegion, ( vlc_object_t *, video_fo
 #define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
 VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
 VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date, bool b_paused, bool b_subtitle_only ) );
-VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *,  video_format_t *, picture_t *, subpicture_t *, int, int ) );
+
+/**
+ * This function renders a list of subpicture_t on the provided picture.
+ *
+ * \param p_fmt_dst is the format of the destination picture.
+ * \param p_fmt_src is the format of the original(source) video.
+ */
+VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *,  picture_t *, video_format_t *p_fmt_dst, subpicture_t *p_list, const video_format_t *p_fmt_src ) );
 
 /** @}*/
 
diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c
index 2e67558..0450f9e 100644
--- a/modules/stream_out/transcode.c
+++ b/modules/stream_out/transcode.c
@@ -1988,14 +1988,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
         /* Overlay subpicture */
         if( p_subpic )
         {
-            int i_scale_width, i_scale_height;
             video_format_t fmt;
 
-            i_scale_width = id->p_encoder->fmt_in.video.i_width * 1000 /
-                id->p_decoder->fmt_out.video.i_width;
-            i_scale_height = id->p_encoder->fmt_in.video.i_height * 1000 /
-                id->p_decoder->fmt_out.video.i_height;
-
             if( p_pic->i_refcount && !filter_chain_GetLength( id->p_f_chain ) )
             {
                 /* We can't modify the picture, we need to duplicate it */
@@ -2017,8 +2011,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
             fmt.i_sar_num = fmt.i_aspect * fmt.i_height / fmt.i_width;
             fmt.i_sar_den = VOUT_ASPECT_FACTOR;
 
-            spu_RenderSubpictures( p_sys->p_spu, &fmt, p_pic, p_subpic,
-                                   i_scale_width, i_scale_height );
+            spu_RenderSubpictures( p_sys->p_spu, p_pic, &fmt,
+                                   p_subpic, &id->p_decoder->fmt_out.video );
         }
 
         /* Run user specified filter chain */
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index bdb2a17..223d85a 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -320,21 +320,11 @@ static void vout_UnlockPicture( vout_thread_t *p_vout, picture_t *p_picture )
  * before rendering, does the subpicture magic, and tells the video output
  * thread which direct buffer needs to be displayed.
  */
-picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
-                                                       subpicture_t *p_subpic )
+picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
+                               subpicture_t *p_subpic )
 {
-    int i_scale_width, i_scale_height;
-
     if( p_pic == NULL )
-    {
-        /* XXX: subtitles */
         return NULL;
-    }
-
-    i_scale_width = p_vout->fmt_out.i_visible_width * 1000 /
-        p_vout->fmt_in.i_visible_width;
-    i_scale_height = p_vout->fmt_out.i_visible_height * 1000 /
-        p_vout->fmt_in.i_visible_height;
 
     if( p_pic->i_type == DIRECT_PICTURE )
     {
@@ -350,9 +340,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
 
             vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
 
-            spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
-                                   PP_OUTPUTPICTURE[0], p_subpic,
-                                   i_scale_width, i_scale_height );
+            spu_RenderSubpictures( p_vout->p_spu,
+                                   PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
+                                   p_subpic, &p_vout->fmt_in );
 
             vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
 
@@ -377,9 +367,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
             return NULL;
 
         vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
-        spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
-                               PP_OUTPUTPICTURE[0],
-                               p_subpic, i_scale_width, i_scale_height );
+        spu_RenderSubpictures( p_vout->p_spu,
+                               PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
+                               p_subpic, &p_vout->fmt_in );
 
         vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
 
@@ -415,9 +405,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
         p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
 
         /* Render subpictures on the first direct buffer */
-        spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
-                               p_tmp_pic, p_subpic,
-                               i_scale_width, i_scale_height );
+        spu_RenderSubpictures( p_vout->p_spu,
+                               p_tmp_pic, &p_vout->fmt_out,
+                               p_subpic, &p_vout->fmt_in );
 
         if( vout_LockPicture( p_vout, &p_vout->p_picture[0] ) )
             return NULL;
@@ -434,9 +424,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
         p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
 
         /* Render subpictures on the first direct buffer */
-        spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
-                               &p_vout->p_picture[0],
-                               p_subpic, i_scale_width, i_scale_height );
+        spu_RenderSubpictures( p_vout->p_spu,
+                               &p_vout->p_picture[0], &p_vout->fmt_out,
+                               p_subpic, &p_vout->fmt_in );
     }
 
     vout_UnlockPicture( p_vout, &p_vout->p_picture[0] );
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index bcf1f62..5cff7df 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -949,17 +949,16 @@ exit:
         p_region->fmt = fmt_original;
 }
 
-void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt_a,
-                            picture_t *p_pic_dst,
+void spu_RenderSubpictures( spu_t *p_spu,
+                            picture_t *p_pic_dst, video_format_t *p_fmt_dst,
                             subpicture_t *p_subpic_list,
-                            int i_scale_width_orig, int i_scale_height_orig )
+                            const video_format_t *p_fmt_src )
 {
-    video_format_t fmt = *p_fmt_a, *p_fmt = &fmt;
+    video_format_t *p_fmt = p_fmt_dst;
     const mtime_t i_current_date = mdate();
     int i_source_video_width;
     int i_source_video_height;
     subpicture_t *p_subpic;
-    spu_scale_t scale_size_org;
 
     /* Get lock */
     vlc_mutex_lock( &p_spu->subpicture_lock );
@@ -971,10 +970,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt_a,
         return;
     }
 
-    scale_size_org = spu_scale_create( i_scale_width_orig, i_scale_height_orig );
-
-    i_source_video_width  = p_fmt->i_width  * SCALE_UNIT / scale_size_org.w;
-    i_source_video_height = p_fmt->i_height * SCALE_UNIT / scale_size_org.h;
+    i_source_video_width  = p_fmt_src->i_width;
+    i_source_video_height = p_fmt_src->i_height;
 
     /* */
     for( p_subpic = p_subpic_list;




More information about the vlc-devel mailing list