FFmpeg
libwebpenc_common.h
Go to the documentation of this file.
1 /*
2  * WebP encoding support via libwebp
3  * Copyright (c) 2013 Justin Ruggles <justin.ruggles@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * WebP encoder using libwebp: common structs and methods.
25  */
26 
27 #ifndef AVCODEC_LIBWEBPENC_COMMON_H
28 #define AVCODEC_LIBWEBPENC_COMMON_H
29 
30 #include <webp/encode.h>
31 
32 #include "libavutil/attributes.h"
33 #include "libavutil/frame.h"
34 #include "libavutil/log.h"
35 #include "libavutil/pixfmt.h"
36 #include "avcodec.h"
37 #include "codec.h"
38 #include "internal.h"
39 
40 typedef struct LibWebPContextCommon {
41  AVClass *class; // class for AVOptions
42  float quality; // lossy quality 0 - 100
43  int lossless; // use lossless encoding
44  int preset; // configuration preset
45  int chroma_warning; // chroma linesize mismatch warning has been printed
46  int conversion_warning; // pixel format conversion warning has been printed
47  WebPConfig config; // libwebp configuration
49  int cr_size;
52 
53 int ff_libwebp_error_to_averror(int err);
54 
56 
58  const AVFrame *frame, AVFrame **alt_frame_ptr,
59  WebPPicture **pic_ptr);
60 
61 extern const enum AVPixelFormat ff_libwebpenc_pix_fmts[];
62 extern const AVClass ff_libwebpenc_class;
63 extern const AVCodecDefault ff_libwebp_defaults[];
64 
65 #endif /* AVCODEC_LIBWEBPENC_COMMON_H */
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
LibWebPContextCommon::chroma_warning
int chroma_warning
Definition: libwebpenc_common.h:45
LibWebPContextCommon::quality
float quality
Definition: libwebpenc_common.h:42
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
internal.h
LibWebPContextCommon::lossless
int lossless
Definition: libwebpenc_common.h:43
ff_libwebpenc_pix_fmts
enum AVPixelFormat ff_libwebpenc_pix_fmts[]
Definition: libwebpenc_common.c:61
codec.h
ff_libwebpenc_class
const AVClass ff_libwebpenc_class
Definition: libwebpenc_common.c:54
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:257
AVCodecDefault
Definition: internal.h:215
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_libwebp_encode_init_common
av_cold int ff_libwebp_encode_init_common(AVCodecContext *avctx)
Definition: libwebpenc_common.c:81
frame.h
LibWebPContextCommon::ref
AVFrame * ref
Definition: libwebpenc_common.h:48
LibWebPContextCommon::conversion_warning
int conversion_warning
Definition: libwebpenc_common.h:46
LibWebPContextCommon
Definition: libwebpenc_common.h:40
attributes.h
log.h
LibWebPContextCommon::cr_threshold
int cr_threshold
Definition: libwebpenc_common.h:50
ff_libwebp_error_to_averror
int ff_libwebp_error_to_averror(int err)
Definition: libwebpenc_common.c:67
avcodec.h
pixfmt.h
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
ff_libwebp_get_frame
int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s, const AVFrame *frame, AVFrame **alt_frame_ptr, WebPPicture **pic_ptr)
Definition: libwebpenc_common.c:124
AVCodecContext
main external API structure.
Definition: avcodec.h:383
LibWebPContextCommon::config
WebPConfig config
Definition: libwebpenc_common.h:47
LibWebPContextCommon::cr_size
int cr_size
Definition: libwebpenc_common.h:49
ff_libwebp_defaults
const AVCodecDefault ff_libwebp_defaults[]
Definition: libwebpenc_common.c:30
LibWebPContextCommon::preset
int preset
Definition: libwebpenc_common.h:44