null.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <stdio.h>
  20. #include "framehook.h"
  21. typedef struct {
  22. int dummy;
  23. } ContextInfo;
  24. void Release(void *ctx)
  25. {
  26. ContextInfo *ci;
  27. ci = (ContextInfo *) ctx;
  28. if (ctx)
  29. av_free(ctx);
  30. }
  31. int Configure(void **ctxp, int argc, char *argv[])
  32. {
  33. fprintf(stderr, "Called with argc=%d\n", argc);
  34. *ctxp = av_mallocz(sizeof(ContextInfo));
  35. return 0;
  36. }
  37. void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, int64_t pts)
  38. {
  39. ContextInfo *ci = (ContextInfo *) ctx;
  40. char *buf = 0;
  41. AVPicture picture1;
  42. AVPicture *pict = picture;
  43. (void) ci;
  44. if (pix_fmt != PIX_FMT_RGB24) {
  45. int size;
  46. size = avpicture_get_size(PIX_FMT_RGB24, width, height);
  47. buf = av_malloc(size);
  48. avpicture_fill(&picture1, buf, PIX_FMT_RGB24, width, height);
  49. if (img_convert(&picture1, PIX_FMT_RGB24,
  50. picture, pix_fmt, width, height) < 0) {
  51. av_free(buf);
  52. return;
  53. }
  54. pict = &picture1;
  55. }
  56. /* Insert filter code here */
  57. if (pix_fmt != PIX_FMT_RGB24) {
  58. if (img_convert(picture, pix_fmt,
  59. &picture1, PIX_FMT_RGB24, width, height) < 0) {
  60. }
  61. }
  62. av_free(buf);
  63. }