ijksdl_vout.h 2.7 KB
Newer Older
Z
Zhang Rui 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*****************************************************************************
 * ijksdl_vout.h
 *****************************************************************************
 *
 * copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
 *
 * This file is part of ijkPlayer.
 *
 * ijkPlayer is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * ijkPlayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with ijkPlayer; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef IJKSDL__IJKSDL_VOUT_H
#define IJKSDL__IJKSDL_VOUT_H

#include "ijksdl_stdinc.h"
#include "ijksdl_mutex.h"
29
#include "ijksdl_video.h"
Z
Zhang Rui 已提交
30

31 32 33 34 35
/* bpp=12, 8 bit Y plane followed by 8 bit 2x2 subsampled V and U planes.*/
#define SDL_FOURCC_PIX__YV12        0x32315659

typedef struct SDL_VoutOverlay_Opaque SDL_VoutOverlay_Opaque;
typedef struct SDL_VoutOverlay SDL_VoutOverlay;
Z
Zhang Rui 已提交
36
typedef struct SDL_VoutOverlay {
37 38 39 40 41 42
    int w; /**< Read-only */
    int h; /**< Read-only */
    Uint32 format; /**< Read-only */
    int planes; /**< Read-only */
    Uint16 *pitches; /**< Read-only */
    Uint8 **pixels; /**< Read-write */
Z
Zhang Rui 已提交
43

44 45
    void *opaque;
    void (*free_l)(SDL_VoutOverlay *overlay);
46 47
    int (*lock)(SDL_VoutOverlay *overlay);
    int (*unlock)(SDL_VoutOverlay *overlay);
Z
Zhang Rui 已提交
48 49
} SDL_VoutOverlay;

50
typedef struct SDL_VoutSurface_Opaque SDL_VoutSurface_Opaque;
Z
Zhang Rui 已提交
51 52 53 54
typedef struct SDL_VoutSurface SDL_VoutSurface;
typedef struct SDL_VoutSurface {
    int w;
    int h;
55
    Uint32 format; /* fourcc number */
Z
Zhang Rui 已提交
56

57
    SDL_VoutSurface_Opaque *opaque;
Z
Zhang Rui 已提交
58 59
} SDL_VoutSurface;

Z
Zhang Rui 已提交
60
typedef struct SDL_Vout_Opaque SDL_Vout_Opaque;
Z
Zhang Rui 已提交
61 62 63 64
typedef struct SDL_Vout SDL_Vout;
typedef struct SDL_Vout {
    SDL_mutex *mutex;

65 66 67
    SDL_Vout_Opaque *opaque;
    void (*free_l)(SDL_Vout *vout);
    SDL_VoutSurface *(*set_video_mode)(SDL_Vout *vout, int w, int h, int bpp, Uint32 flags);
68
    int (*display_overlay)(SDL_Vout *vout, SDL_VoutOverlay *overlay);
Z
Zhang Rui 已提交
69 70
} SDL_Vout;

71 72
void SDL_VoutFree(SDL_Vout *vout);
SDL_VoutSurface *SDL_VoutSetVideoMode(SDL_Vout *vout, int w, int h, int bpp, Uint32 flags);
73
int SDL_VoutDisplayYUVOverlay(SDL_Vout *vout, SDL_VoutOverlay *overlay);
74

75 76 77
int SDL_VoutLockYUVOverlay(SDL_VoutOverlay *overlay);
int SDL_VoutUnlockYUVOverlay(SDL_VoutOverlay *overlay);
void SDL_VoutFreeYUVOverlay(SDL_VoutOverlay *overlay);
Z
Zhang Rui 已提交
78 79

#endif