ijksdl_vout.h 3.0 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
/*****************************************************************************
 * 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"
Z
Zhang Rui 已提交
28
#include "ijksdl_class.h"
Z
Zhang Rui 已提交
29
#include "ijksdl_mutex.h"
30
#include "ijksdl_video.h"
Z
Zhang Rui 已提交
31
#include "ffmpeg/ijksdl_inc_ffmpeg.h"
Z
Zhang Rui 已提交
32

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

43 44
    int is_private;

Z
Zhang Rui 已提交
45 46 47
    int sar_num;
    int sar_den;

Z
Zhang Rui 已提交
48 49
    SDL_Class               *opaque_class;
    SDL_VoutOverlay_Opaque  *opaque;
50 51 52 53 54 55 56

    void    (*free_l)(SDL_VoutOverlay *overlay);
    int     (*lock)(SDL_VoutOverlay *overlay);
    int     (*unlock)(SDL_VoutOverlay *overlay);
    void    (*unref)(SDL_VoutOverlay *overlay);

    int     (*func_fill_frame)(SDL_VoutOverlay *overlay, const AVFrame *frame);
Z
Zhang Rui 已提交
57
};
Z
Zhang Rui 已提交
58

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

Z
Zhang Rui 已提交
64
    SDL_Class       *opaque_class;
65
    SDL_Vout_Opaque *opaque;
66
    SDL_VoutOverlay *(*create_overlay)(int width, int height, int frame_format, SDL_Vout *vout);
67
    void (*free_l)(SDL_Vout *vout);
68
    int (*display_overlay)(SDL_Vout *vout, SDL_VoutOverlay *overlay);
69 70

    Uint32 overlay_format;
Z
Zhang Rui 已提交
71
};
Z
Zhang Rui 已提交
72

73
void SDL_VoutFree(SDL_Vout *vout);
Z
Zhang Rui 已提交
74
void SDL_VoutFreeP(SDL_Vout **pvout);
75 76
int  SDL_VoutDisplayYUVOverlay(SDL_Vout *vout, SDL_VoutOverlay *overlay);
int  SDL_VoutSetOverlayFormat(SDL_Vout *vout, Uint32 overlay_format);
77

78
SDL_VoutOverlay *SDL_Vout_CreateOverlay(int width, int height, int frame_format, SDL_Vout *vout);
79 80 81 82 83
int     SDL_VoutLockYUVOverlay(SDL_VoutOverlay *overlay);
int     SDL_VoutUnlockYUVOverlay(SDL_VoutOverlay *overlay);
void    SDL_VoutFreeYUVOverlay(SDL_VoutOverlay *overlay);
void    SDL_VoutUnrefYUVOverlay(SDL_VoutOverlay *overlay);
int     SDL_VoutFillFrameYUVOverlay(SDL_VoutOverlay *overlay, const AVFrame *frame);
Z
Zhang Rui 已提交
84 85

#endif