Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 17:27:40 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 17:37:21 +0400
commit43bac121d3de0076e76e6f8438934d53f2707ce2 (patch)
tree30b2ed942e6a8790baf2ba26e7153a33d6704986 /libavfilter/vf_blackframe.c
parent2a2a643c90ff091f1fa4a0634bcc4e18639bcee0 (diff)
parent62dcdb028cc84845fd263bb09304c4c6500bda7a (diff)
Merge commit '62dcdb028cc84845fd263bb09304c4c6500bda7a'
* commit '62dcdb028cc84845fd263bb09304c4c6500bda7a': vf_blackframe: switch to an AVOptions-based system. vf_aspect: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_aspect.c libavfilter/vf_blackframe.c In the aspect filter most changes are merged but not the final switch to the libav API because that is too restrictive and has difficulty handling the syntax. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_blackframe.c')
-rw-r--r--libavfilter/vf_blackframe.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c
index 11c8e50893..968d451c61 100644
--- a/libavfilter/vf_blackframe.c
+++ b/libavfilter/vf_blackframe.c
@@ -40,24 +40,13 @@
typedef struct {
const AVClass *class;
- unsigned int bamount; ///< black amount
- unsigned int bthresh; ///< black threshold
+ int bamount; ///< black amount
+ int bthresh; ///< black threshold
unsigned int frame; ///< frame number
unsigned int nblack; ///< number of black pixels counted so far
unsigned int last_keyframe; ///< frame number of the last received key-frame
} BlackFrameContext;
-#define OFFSET(x) offsetof(BlackFrameContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
-
-static const AVOption blackframe_options[] = {
- { "amount", "set least percentual amount of pixels below the black threshold enabling black detection", OFFSET(bamount), AV_OPT_TYPE_INT, {.i64=98}, 0, 100, FLAGS },
- { "thresh", "set threshold below which a pixel value is considered black", OFFSET(bthresh), AV_OPT_TYPE_INT, {.i64=32}, 0, 255, FLAGS },
- { NULL }
-};
-
-AVFILTER_DEFINE_CLASS(blackframe);
-
static int query_formats(AVFilterContext *ctx)
{
static const enum AVPixelFormat pix_fmts[] = {
@@ -70,16 +59,6 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args)
-{
- BlackFrameContext *blackframe = ctx->priv;
-
- av_log(ctx, AV_LOG_VERBOSE, "bamount:%u bthresh:%u\n",
- blackframe->bamount, blackframe->bthresh);
-
- return 0;
-}
-
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
AVFilterContext *ctx = inlink->dst;
@@ -110,6 +89,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+#define OFFSET(x) offsetof(BlackFrameContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+static const AVOption blackframe_options[] = {
+ { "amount", "Percentage of the pixels that have to be below the threshold "
+ "for the frame to be considered black.", OFFSET(bamount), AV_OPT_TYPE_INT, { .i64 = 98 }, 0, 100, FLAGS },
+ { "threshold", "threshold below which a pixel value is considered black",
+ OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255, FLAGS },
+ { NULL },
+};
+
+AVFILTER_DEFINE_CLASS(blackframe);
+
static const AVFilterPad avfilter_vf_blackframe_inputs[] = {
{
.name = "default",
@@ -128,14 +119,12 @@ static const AVFilterPad avfilter_vf_blackframe_outputs[] = {
{ NULL }
};
-static const char *const shorthand[] = { "amount", "thresh", NULL };
-
AVFilter avfilter_vf_blackframe = {
.name = "blackframe",
.description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),
.priv_size = sizeof(BlackFrameContext),
- .init = init,
+ .priv_class = &blackframe_class,
.query_formats = query_formats,
@@ -144,5 +133,4 @@ AVFilter avfilter_vf_blackframe = {
.outputs = avfilter_vf_blackframe_outputs,
.priv_class = &blackframe_class,
- .shorthand = shorthand,
};