File: videothumbnailerc.h

package info (click to toggle)
ffmpegthumbnailer 2.2.2%2Bgit20220218%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 864 kB
  • sloc: cpp: 11,403; ansic: 76; sh: 37; makefile: 13
file content (87 lines) | stat: -rw-r--r-- 4,567 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//    Copyright (C) 2010 Dirk Vanden Boer <dirk.vdb@gmail.com>
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (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
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#ifndef VIDEO_THUMBNAILERC_H
#define VIDEO_THUMBNAILERC_H

#include <inttypes.h>
#include "ffmpegthumbnailertypes.h"

#ifdef __cplusplus
extern "C"
{
#endif

struct AVFormatContext;
struct thumbnailer_data;

typedef void(*thumbnailer_log_callback)(ThumbnailerLogLevel, const char*);

typedef struct video_thumbnailer_struct
{
    int                         thumbnail_size __attribute__((deprecated("use video_thumbnailer_set_size()"))); /* default = 128 (deprecated, use video_thumbnailer_set_size)*/
    int                         seek_percentage;            /* default = 10 */
    char*                       seek_time;                  /* default = NULL (format hh:mm:ss, overrides seek_percentage if set) */
    int                         overlay_film_strip;         /* default = 0 */
    int                         workaround_bugs;            /* default = 0 */
    int                         thumbnail_image_quality;    /* default = 8 (0 is bad, 10 is best)*/
    ThumbnailerImageType        thumbnail_image_type;       /* default = Png */
    struct AVFormatContext*     av_format_context;          /* default = NULL */
    int                         maintain_aspect_ratio;      /* default = 1 */
    int                         prefer_embedded_metadata;   /* default = 0 */

    struct thumbnailer_data*    tdata;                      /* for internal use only */
} video_thumbnailer;

typedef struct image_data_struct
{
    uint8_t*                image_data_ptr;       /* points to the image data after call to generate_thumbnail_to_buffer */
    int                     image_data_size;      /* contains the size of the image data after call to generate_thumbnail_to_buffer (=width*height*3)*/
    int                     image_data_width;     /* contains the width of the image data after call to generate_thumbnail_to_buffer */
    int                     image_data_height;    /* contains the height of the image data after call to generate_thumbnail_to_buffer */
    ThumbnailerImageSource  image_data_source;    /* contains the source that was used to generate the thumbnail */

    void*       internal_data;        /* for internal use only */
} image_data;

/* create video_thumbnailer structure */
video_thumbnailer* video_thumbnailer_create(void);
/* destroy video_thumbnailer structure */
void video_thumbnailer_destroy(video_thumbnailer* thumbnailer);

/* create image_data structure */
image_data* video_thumbnailer_create_image_data(void);
/* destroy image_data structure */
void video_thumbnailer_destroy_image_data(image_data* data);

/* generate thumbnail from video file (movie_filename), image data is stored in generated_image_data struct */
int video_thumbnailer_generate_thumbnail_to_buffer(video_thumbnailer* thumbnailer, const char* movie_filename, image_data* generated_image_data);
/* generate thumbnail from video file (movie_filename), image is written to output_fileName on disk*/
int video_thumbnailer_generate_thumbnail_to_file(video_thumbnailer* thumbnailer, const char* movie_filename, const char* output_fileName);
/* install a logging callback that gets called on errors and informational messages, reset by passing NULL.
   by default no logging is generated on stdout or stderr */
void video_thumbnailer_set_log_callback(video_thumbnailer* thumbnailer, thumbnailer_log_callback cb);
/* Finer control of the generate image thumbnail size
   Using this function overrides the size setting of the video_thumbnailer struct
   Use a value of 0 or less to ignore the setting:
   e.g. Calling this function with 0 and 100 as arguments will set the width using the video aspect ratio */
int video_thumbnailer_set_size(video_thumbnailer* thumbnailer, int width, int height);

#ifdef __cplusplus
}
#endif

#endif