snapshot.h 2.54 KB
Newer Older
1 2 3 4 5 6 7 8
/*****************************************************************************
 * snapshot.h : vout internal snapshot
 *****************************************************************************
 * Copyright (C) 2009 Laurent Aimar
 * $Id$
 *
 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
9 10 11
 * This program 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
12 13 14 15
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
16 17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
18
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
19 20 21
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 23
 *****************************************************************************/

24 25
#ifndef LIBVLC_VOUT_INTERNAL_SNAPSHOT_H
#define LIBVLC_VOUT_INTERNAL_SNAPSHOT_H
26 27 28 29 30 31 32

#include <vlc_picture.h>

typedef struct {
    vlc_mutex_t lock;
    vlc_cond_t  wait;

Thomas Guillem's avatar
Thomas Guillem committed
33 34 35
    bool        is_available;
    int         request_count;
    picture_t   *picture;
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

} vout_snapshot_t;

/* */
void vout_snapshot_Init(vout_snapshot_t *);
void vout_snapshot_Clean(vout_snapshot_t *);

void vout_snapshot_End(vout_snapshot_t *);

/* */
picture_t *vout_snapshot_Get(vout_snapshot_t *, mtime_t timeout);

/**
 * It tells if they are pending snapshot request
 */
bool vout_snapshot_IsRequested(vout_snapshot_t *);

/**
 * It set the picture used to create the snapshots.
 *
56
 * The given picture is cloned.
57 58 59
 * If p_fmt is non NULL it will override the format of the p_picture (mainly
 * used because of aspect/crop problems).
 */
60
void vout_snapshot_Set(vout_snapshot_t *, const video_format_t *, picture_t *);
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

/**
 * This function will return the directory used for snapshots
 */
char *vout_snapshot_GetDirectory(void);

typedef struct {
    bool is_sequential;
    int  sequence;
    char *path;
    char *format;
    char *prefix_fmt;
} vout_snapshot_save_cfg_t;

/**
 * This function will write an image to the disk an return the file name created.
 */
int vout_snapshot_SaveImage(char **name, int *sequential,
                            const block_t *image,
80
                            vout_thread_t *p_vout,
81 82 83
                            const vout_snapshot_save_cfg_t *cfg);

#endif