Message ID | CAPSOpYumig9yTEOAGg284UW=1HM_+z313T-F92_UEMNeApVHyA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Apr 16, 2019 at 12:14:13PM -0500, Jonathan Gilbert wrote: > Hello :-) > > I had a project recently where I wanted to externally specify a list > of specific frame numbers to drop. I understand this can be done with > select expressions like "not(eq(n,45)+eq(n,47)+eq(n,75))", but in my > case I wanted to drop nearly 16,000 frames, which would have required > a command-line over 250 KB in size. I chose a different approach: I > have added functionality to f_select.c so that you can specify the > list of frames you want to include/exclude in an external response > file. I have successfully used this code for my project, and thought I > might submit it up to for consideration. :-) > > I've never submitted a patch in this format before, I hope I'm doing > this correctly. > > Thanks very much, > > Jonathan Gilbert Applying: libavfilter/f_select: response file support error: corrupt patch at line 51 error: could not build fake ancestor please make sure your MUA doesnt wrap long lines or attach the patch [...]
2019-04-16 19:14 GMT+02:00, Jonathan Gilbert <logic@deltaq.org>: > Hello :-) > > I had a project recently where I wanted to externally specify a list > of specific frame numbers to drop. I understand this can be done with > select expressions like "not(eq(n,45)+eq(n,47)+eq(n,75))", but in my > case I wanted to drop nearly 16,000 frames, which would have required > a command-line over 250 KB in size. I chose a different approach: I > have added functionality to f_select.c so that you can specify the > list of frames you want to include/exclude in an external response > file. I have successfully used this code for my project, and thought I > might submit it up to for consideration. :-) > > I've never submitted a patch in this format before, I hope I'm doing > this correctly. This is definitely not the only issue: Instead of using malloc() and friends, please see libavutil/mem.h for the appropriate functions. Carl Eugen
I've changed the allocation functions and attached the output of `git format-patch` to this e-mail. Thanks, Jonathan Gilbert On Tue, Apr 16, 2019 at 5:50 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote: > 2019-04-16 19:14 GMT+02:00, Jonathan Gilbert <logic@deltaq.org>: > > Hello :-) > > > > I had a project recently where I wanted to externally specify a list > > of specific frame numbers to drop. I understand this can be done with > > select expressions like "not(eq(n,45)+eq(n,47)+eq(n,75))", but in my > > case I wanted to drop nearly 16,000 frames, which would have required > > a command-line over 250 KB in size. I chose a different approach: I > > have added functionality to f_select.c so that you can specify the > > list of frames you want to include/exclude in an external response > > file. I have successfully used this code for my project, and thought I > > might submit it up to for consideration. :-) > > > > I've never submitted a patch in this format before, I hope I'm doing > > this correctly. > > This is definitely not the only issue: > Instead of using malloc() and friends, please see libavutil/mem.h > for the appropriate functions. > > Carl Eugen > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Ping! :-) Thanks, Jonathan Gilbert On Wed, Apr 17, 2019 at 4:18 AM Jonathan Gilbert <logic@deltaq.org> wrote: > I've changed the allocation functions and attached the output of `git > format-patch` to this e-mail. > > Thanks, > > Jonathan Gilbert > > On Tue, Apr 16, 2019 at 5:50 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> > wrote: > >> 2019-04-16 19:14 GMT+02:00, Jonathan Gilbert <logic@deltaq.org>: >> > Hello :-) >> > >> > I had a project recently where I wanted to externally specify a list >> > of specific frame numbers to drop. I understand this can be done with >> > select expressions like "not(eq(n,45)+eq(n,47)+eq(n,75))", but in my >> > case I wanted to drop nearly 16,000 frames, which would have required >> > a command-line over 250 KB in size. I chose a different approach: I >> > have added functionality to f_select.c so that you can specify the >> > list of frames you want to include/exclude in an external response >> > file. I have successfully used this code for my project, and thought I >> > might submit it up to for consideration. :-) >> > >> > I've never submitted a patch in this format before, I hope I'm doing >> > this correctly. >> >> This is definitely not the only issue: >> Instead of using malloc() and friends, please see libavutil/mem.h >> for the appropriate functions. >> >> Carl Eugen >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > >
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 1132375758..0852fffb44 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -22,6 +22,8 @@ * @file * filter for selecting which frame passes in the filterchain */ +#include <stdio.h> +#include <ctype.h> #include "libavutil/avstring.h" #include "libavutil/eval.h" @@ -139,10 +141,33 @@ enum var_name { VAR_VARS_NB }; +enum filemode { + SELECT_FILEMODE_INCLUDE, + SELECT_FILEMODE_EXCLUDE +}; + +enum filetype { + SELECT_FILETYPE_FRAMENO, + SELECT_FILETYPE_PTS +}; + +enum warnunused { + SELECT_WARNUNUSED_NO, + SELECT_WARNUNUSED_YES, + SELECT_WARNUNUSED_ALL +}; + typedef struct SelectContext { const AVClass *class; char *expr_str; AVExpr *expr; + char *file_str; + int *file_frame_list; + int file_frame_list_length; + enum filemode filemode; + enum filetype filetype; + char *file_frame_list_used; + enum warnunused file_warn_unused; double var_values[VAR_VARS_NB]; int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise