You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.4KB

  1. /*
  2. * Video splitter
  3. * copyright (c) 2007 Bobby Bingham
  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. #include "avfilter.h"
  22. static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
  23. {
  24. avfilter_start_frame(link->dst->outputs[0],
  25. avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
  26. avfilter_start_frame(link->dst->outputs[1],
  27. avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
  28. }
  29. static void end_frame(AVFilterLink *link)
  30. {
  31. avfilter_end_frame(link->dst->outputs[0]);
  32. avfilter_end_frame(link->dst->outputs[1]);
  33. avfilter_unref_buffer(link->cur_buf);
  34. }
  35. static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
  36. {
  37. avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
  38. avfilter_draw_slice(link->dst->outputs[1], y, h, slice_dir);
  39. }
  40. AVFilter avfilter_vf_split =
  41. {
  42. .name = "split",
  43. .inputs = (AVFilterPad[]) {{ .name = "default",
  44. .type = AVMEDIA_TYPE_VIDEO,
  45. .get_video_buffer= avfilter_null_get_video_buffer,
  46. .start_frame = start_frame,
  47. .draw_slice = draw_slice,
  48. .end_frame = end_frame, },
  49. { .name = NULL}},
  50. .outputs = (AVFilterPad[]) {{ .name = "default",
  51. .type = AVMEDIA_TYPE_VIDEO, },
  52. { .name = "default2",
  53. .type = AVMEDIA_TYPE_VIDEO, },
  54. { .name = NULL}},
  55. };