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.

74 lines
2.0KB

  1. /*
  2. * Null Video Hook
  3. * Copyright (c) 2002 Philip Gladstone
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <stdio.h>
  20. #include "framehook.h"
  21. typedef struct {
  22. int dummy;
  23. } ContextInfo;
  24. int Configure(void **ctxp, int argc, char *argv[])
  25. {
  26. fprintf(stderr, "Called with argc=%d\n", argc);
  27. *ctxp = av_mallocz(sizeof(ContextInfo));
  28. return 0;
  29. }
  30. void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, INT64 pts)
  31. {
  32. ContextInfo *ci = (ContextInfo *) ctx;
  33. char *buf = 0;
  34. AVPicture picture1;
  35. AVPicture *pict = picture;
  36. (void) ci;
  37. if (pix_fmt != PIX_FMT_RGB24) {
  38. int size;
  39. size = avpicture_get_size(PIX_FMT_RGB24, width, height);
  40. buf = av_malloc(size);
  41. avpicture_fill(&picture1, buf, PIX_FMT_RGB24, width, height);
  42. if (img_convert(&picture1, PIX_FMT_RGB24,
  43. picture, pix_fmt, width, height) < 0) {
  44. av_free(buf);
  45. return;
  46. }
  47. pict = &picture1;
  48. }
  49. /* Insert filter code here */
  50. if (pix_fmt != PIX_FMT_RGB24) {
  51. if (img_convert(picture, pix_fmt,
  52. &picture1, PIX_FMT_RGB24, width, height) < 0) {
  53. }
  54. }
  55. av_free(buf);
  56. }
  57. /* To ensure correct typing */
  58. FrameHookConfigureFn ConfigureFn = Configure;
  59. FrameHookProcessFn ProcessFn = Process;