1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/mp: remove framestep wrapped filter

An equivalent framestep filter has been natively integrated.
This commit is contained in:
Stefano Sabatini 2012-08-16 19:06:00 +02:00
parent 48d116400c
commit dc7e4d685f
5 changed files with 1 additions and 210 deletions

View File

@ -2431,7 +2431,6 @@ The list of the currently supported filters follows:
@item field @item field
@item fil @item fil
@item fixpts @item fixpts
@item framestep
@item fspp @item fspp
@item geq @item geq
@item harddup @item harddup

View File

@ -164,7 +164,6 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_field.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fil.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fil.o
#OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_filmdint.o #OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_filmdint.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fixpts.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fixpts.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_framestep.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fspp.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_fspp.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_geq.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_geq.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_harddup.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_harddup.o

View File

@ -1,205 +0,0 @@
/*
* filter to output only 1 every n frame, or only the I (key)frame
*
* The parameters are:
*
* [I] | [i]num
*
* if you call the filter with I (uppercase) as the parameter
* ... -vf framestep=I ...
* then ONLY the keyframes are outputted.
* For DVD it means, generally, one every 15 frames (IBBPBBPBBPBBPBB), for avi it means
* every scene change or every keyint value (see -lavcopts).
*
* if you call the filter with the i (lowercase)
* ... -vf framestep=i ...
* then a I! followed by a cr is printed when a key frame (eg Intra frame) is
* found, leaving the current line of mplayer/mencoder, where you got the
* time, in seconds, and frame of the key. Use this information to split the
* AVI.
*
* After the i or alone you can put a positive number and only one frame every
* x (the number you set) is passed on the filter chain, limiting the output
* of the frame.
*
* Example
* ... -vf framestep=i20 ...
* Dump one every 20 frames, printing on the console when a I-Frame is encounter.
*
* ... -vf framestep=25
* Dump one every 25 frames.
*
* If you call the filter without parameter it does nothing (except using memory
* and resource of your system,. of course).
*
* This filter doesn' t work like the option -sstep seconds.
*
* The -sstep seek to the new position, without decoding all frames but,
* expecially on avi file coded whith mpeg4 (lavc or xvid or divx), the
* seek is not always too much precise.
*
* This filter simply discard the unwanted frames, so you are very precise in
* counting the frame but sometime you use a lot of CPU for nothing.
*
* As usual it depends on what you're doing.
*
* copyright (c) 2003 Daniele Forghieri ( guru@digitalfantasy.it )
*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "cpudetect.h"
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
/* Uncomment if you want to print some info on the format */
// #define DUMP_FORMAT_DATA
/* Private data */
struct vf_priv_s {
/* Current frame */
int frame_cur;
/* Frame output step, 0 = all */
int frame_step;
/* Only I-Frame (2), print on I-Frame (1) */
int dump_iframe;
};
/* Filter handler */
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *priv;
int skip;
priv = vf->priv;
/* Print the 'I' if is a intra frame. The \n advance the current line so you got the
* current file time (in second) and the frame number on the console ;-)
*/
if (priv->dump_iframe) {
if (mpi->pict_type == 1) {
mp_msg(MSGT_VFILTER, MSGL_INFO, "I!\n");
}
}
/* decide if frame must be shown */
if (priv->dump_iframe == 2) {
/* Only key frame */
skip = mpi->pict_type == 1 ? 0 : 1;
}
else {
/* Only 1 every frame_step */
skip = 0;
if ((priv->frame_step != 0) && ((priv->frame_cur % priv->frame_step) != 0)) {
skip = 1;
}
}
/* Increment current frame */
++priv->frame_cur;
if (skip == 0) {
/* Get image, export type (we don't modify tghe image) */
dmpi=vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0,
mpi->w, mpi->h);
/* Copy only the pointer ( MP_IMGTYPE_EXPORT ! ) */
dmpi->planes[0] = mpi->planes[0];
dmpi->planes[1] = mpi->planes[1];
dmpi->planes[2] = mpi->planes[2];
dmpi->stride[0] = mpi->stride[0];
dmpi->stride[1] = mpi->stride[1];
dmpi->stride[2] = mpi->stride[2];
dmpi->width = mpi->width;
dmpi->height = mpi->height;
/* Chain to next filter / output ... */
return vf_next_put_image(vf, dmpi, pts);
}
/* Skip the frame */
return 0;
}
static void uninit(struct vf_instance *vf)
{
/* Free private data */
free(vf->priv);
}
/* Main entry funct for the filter */
static int vf_open(vf_instance_t *vf, char *args)
{
struct vf_priv_s *p;
vf->put_image = put_image;
vf->uninit = uninit;
vf->default_reqs = VFCAP_ACCEPT_STRIDE;
vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
if (p == NULL) {
return 0;
}
if (args != NULL) {
#ifdef DUMP_FORMAT_DATA
if (*args == 'd') {
p->dump_iframe = 3;
}
else
#endif
if (*args == 'I') {
/* Dump only KEY (ie INTRA) frame */
p->dump_iframe = 2;
}
else {
if (*args == 'i') {
/* Print a 'I!' when a i-frame is encounter */
p->dump_iframe = 1;
++args;
}
if (*args != '\0') {
p->frame_step = atoi(args);
if (p->frame_step <= 0) {
mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_ErrorParsingArgument);
return 0;
}
}
}
}
return 1;
}
const vf_info_t vf_info_framestep = {
"Dump one every n / key frames",
"framestep",
"Daniele Forghieri",
"",
vf_open,
NULL
};

View File

@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 11 #define LIBAVFILTER_VERSION_MINOR 11
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \

View File

@ -144,7 +144,6 @@ extern const vf_info_t vf_info_filmdint;
extern const vf_info_t vf_info_fixpts; extern const vf_info_t vf_info_fixpts;
extern const vf_info_t vf_info_flip; extern const vf_info_t vf_info_flip;
extern const vf_info_t vf_info_format; extern const vf_info_t vf_info_format;
extern const vf_info_t vf_info_framestep;
extern const vf_info_t vf_info_fspp; extern const vf_info_t vf_info_fspp;
extern const vf_info_t vf_info_geq; extern const vf_info_t vf_info_geq;
extern const vf_info_t vf_info_halfpack; extern const vf_info_t vf_info_halfpack;
@ -204,7 +203,6 @@ static const vf_info_t* const filters[]={
&vf_info_fil, &vf_info_fil,
// &vf_info_filmdint, cmmx.h vd.h ‘opt_screen_size_x’ // &vf_info_filmdint, cmmx.h vd.h ‘opt_screen_size_x’
&vf_info_fixpts, &vf_info_fixpts,
&vf_info_framestep,
&vf_info_fspp, &vf_info_fspp,
&vf_info_geq, &vf_info_geq,
&vf_info_harddup, &vf_info_harddup,