[FFmpeg-devel] [PATCH] Move SDL display code to VideoDisplay hooks

Michael Niedermayer michaelni
Sat Oct 3 04:56:05 CEST 2009


On Sat, Sep 26, 2009 at 09:51:08AM +0200, Gwenole Beauchesne wrote:
> Hi,
>
> This moves SDL display code to new VideoDisplay hooks.This is not meant to 
> replace SDL with something else, i.e. the window will still be managed with 
> SDL. However, this makes it possible to add new HW accelerators based on 
> decode+display APIs. They will re-use the underlying SDL/X11 window.
>
> Regards,
> Gwenole.
>

>  ffplay.c |  214 +++++++++++++++++++++++++++++++++++++++++++--------------------
>  1 file changed, 149 insertions(+), 65 deletions(-)
> 55a3f965e02a0f4437f66a545bbed75d5525273a  ffplay.video_display.split.patch
> Index: ffplay.c
> ===================================================================
> --- ffplay.c	(r?vision 20024)
> +++ ffplay.c	(copie de travail)
> @@ -83,7 +83,7 @@ typedef struct PacketQueue {
>  
>  typedef struct VideoPicture {
>      double pts;                                  ///<presentation time stamp for this picture
> -    SDL_Overlay *bmp;
> +    void *surface;
>      int width, height; /* source height & width */
>      int allocated;

missing doxy


>  } VideoPicture;
> @@ -173,10 +173,22 @@ typedef struct VideoState {
>      //    QETimer *video_timer;
>      char filename[1024];
>      int width, height, xleft, ytop;
> +
> +    const struct VideoDisplay *video_display;
>  } VideoState;
>  
> +typedef struct VideoDisplay {

> +    int (*alloc_surface)(VideoState *is, VideoPicture *vp);

a function called alloc_X should return X


> +    void (*free_surface)(VideoState *is, VideoPicture *vp);
> +    void (*transfer)(VideoState *is, VideoPicture *vp, AVFrame *pic);
> +    void (*blend)(VideoState *is, VideoPicture *vp, SubPicture *sp);
> +    void (*display)(VideoState *is, VideoPicture *vp, SDL_Rect *rect);
> +    unsigned int surface_data_size;
> +} VideoDisplay;
> +
>  static void show_help(void);
>  static int audio_write_get_buf_size(VideoState *is);
> +static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh);
>  
>  /* options specified by the user */
>  static AVInputFormat *file_iformat;

missing doxy


> @@ -227,6 +239,132 @@ static AVPacket flush_pkt;
>  
>  static SDL_Surface *screen;
>  
> +/* SDL support (default) */
> +typedef struct VideoSurfaceSdl {
> +    SDL_Overlay *bmp;
> +} VideoSurfaceSdl;
> +
> +static int sdl_alloc_surface(VideoState *is, VideoPicture *vp)
> +{
> +    VideoSurfaceSdl *surface = vp->surface;
> +
> +    if (!surface)
> +        return -1;
> +
> +    surface->bmp = SDL_CreateYUVOverlay(vp->width,
> +                                        vp->height,
> +                                        SDL_YV12_OVERLAY,
> +                                        screen);
> +    if (!surface->bmp)
> +        return -1;
> +    return 0;
> +}
> +

-> vo_sdl.c

and API docs and all that are needed for the interface


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091003/5888eca3/attachment.pgp>



More information about the ffmpeg-devel mailing list