libdirac_libschro.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. /**
  21. * @file libavcodec/libdirac_libschro.h
  22. * data structures common to libdirac and libschroedinger
  23. */
  24. #ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H
  25. #define AVCODEC_LIBDIRAC_LIBSCHRO_H
  26. #include "avcodec.h"
  27. typedef struct
  28. {
  29. uint16_t width;
  30. uint16_t height;
  31. uint16_t frame_rate_num;
  32. uint16_t frame_rate_denom;
  33. } FfmpegDiracSchroVideoFormatInfo;
  34. /**
  35. * Returns the index into the Dirac Schro common video format info table
  36. */
  37. unsigned int ff_dirac_schro_get_video_format_idx (AVCodecContext *avccontext);
  38. /**
  39. * contains a single encoded frame returned from Dirac or Schroedinger
  40. */
  41. typedef struct FfmpegDiracSchroEncodedFrame
  42. {
  43. /** encoded frame data */
  44. uint8_t *p_encbuf;
  45. /** encoded frame size */
  46. uint32_t size;
  47. /** encoded frame number. Will be used as pts */
  48. uint32_t frame_num;
  49. /** key frame flag. 1 : is key frame , 0 : in not key frame */
  50. uint16_t key_frame;
  51. } FfmpegDiracSchroEncodedFrame;
  52. /**
  53. * queue element
  54. */
  55. typedef struct FfmpegDiracSchroQueueElement
  56. {
  57. /** Data to be stored in queue*/
  58. void *data;
  59. /** Pointer to next element queue */
  60. struct FfmpegDiracSchroQueueElement *next;
  61. } FfmpegDiracSchroQueueElement;
  62. /**
  63. * A simple queue implementation used in libdirac and libschroedinger
  64. */
  65. typedef struct FfmpegDiracSchroQueue
  66. {
  67. /** Pointer to head of queue */
  68. FfmpegDiracSchroQueueElement *p_head;
  69. /** Pointer to tail of queue */
  70. FfmpegDiracSchroQueueElement *p_tail;
  71. /** Queue size*/
  72. int size;
  73. } FfmpegDiracSchroQueue;
  74. /**
  75. * Initialise the queue
  76. */
  77. void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue);
  78. /**
  79. * Add an element to the end of the queue
  80. */
  81. int ff_dirac_schro_queue_push_back (FfmpegDiracSchroQueue *queue, void *p_data);
  82. /**
  83. * Return the first element in the queue
  84. */
  85. void *ff_dirac_schro_queue_pop (FfmpegDiracSchroQueue *queue);
  86. /**
  87. * Free the queue resources. free_func is a function supplied by the caller to
  88. * free any resources allocated by the caller. The data field of the queue
  89. * element is passed to it.
  90. */
  91. void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue,
  92. void (*free_func)(void *));
  93. #endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */