avi_dev.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJMEDIA_VIDEODEV_AVI_DEV_H__
  19. #define __PJMEDIA_VIDEODEV_AVI_DEV_H__
  20. /**
  21. * @file avi_dev.h
  22. * @brief AVI player virtual device
  23. */
  24. #include <pjmedia-videodev/videodev.h>
  25. #include <pjmedia/avi_stream.h>
  26. PJ_BEGIN_DECL
  27. /**
  28. * @defgroup avi_dev AVI Player Virtual Device
  29. * @ingroup video_device_api
  30. * @brief AVI player virtual device
  31. * @{
  32. * This describes a virtual capture device which takes its input from an AVI
  33. * file.
  34. */
  35. /**
  36. * Settings for the AVI player virtual device. This param corresponds to
  37. * PJMEDIA_VID_DEV_CAP_AVI_PLAY capability of the video device/stream.
  38. */
  39. typedef struct pjmedia_avi_dev_param
  40. {
  41. /**
  42. * Specifies the full path of the AVI file to be played.
  43. */
  44. pj_str_t path;
  45. /**
  46. * If this setting is specified when setting the device, this specifies
  47. * the title to be assigned as the device name. If this setting not
  48. * specified, the filename part of the path will be used.
  49. */
  50. pj_str_t title;
  51. /**
  52. * The underlying AVI streams created by the device. If the value is NULL,
  53. * that means the device has not been configured yet. Application can use
  54. * this field to retrieve the audio stream of the AVI. This setting is
  55. * "get"-only and will be ignored in "set capability" operation.
  56. */
  57. pjmedia_avi_streams *avi_streams;
  58. } pjmedia_avi_dev_param;
  59. /**
  60. * Reset pjmedia_avi_dev_param with the default settings. This mostly will
  61. * reset all values to NULL or zero.
  62. *
  63. * @param p The parameter to be initialized.
  64. */
  65. PJ_DECL(void) pjmedia_avi_dev_param_default(pjmedia_avi_dev_param *p);
  66. /**
  67. * Create a AVI device factory, and register it to the video device
  68. * subsystem. At least one factory needs to be created before an AVI
  69. * device can be allocated and used, and normally only one factory is
  70. * needed per application.
  71. *
  72. * @param pf Pool factory to be used.
  73. * @param max_dev Number of devices to be reserved.
  74. * @param p_ret Pointer to return the factory instance, to be
  75. * used when allocating a virtual device.
  76. *
  77. * @return PJ_SUCCESS on success or the appropriate error code.
  78. */
  79. PJ_DECL(pj_status_t) pjmedia_avi_dev_create_factory(
  80. pj_pool_factory *pf,
  81. unsigned max_dev,
  82. pjmedia_vid_dev_factory **p_ret);
  83. /**
  84. * Allocate one device ID to be used to play the specified AVI file in
  85. * the parameter.
  86. *
  87. * @param f The factory.
  88. * @param param The parameter, with at least the AVI file path
  89. * set.
  90. * @param p_id Optional pointer to receive device ID to play
  91. * the file.
  92. *
  93. * @return PJ_SUCCESS or the appropriate error code.
  94. *
  95. */
  96. PJ_DECL(pj_status_t) pjmedia_avi_dev_alloc(pjmedia_vid_dev_factory *f,
  97. pjmedia_avi_dev_param *param,
  98. pjmedia_vid_dev_index *p_id);
  99. /**
  100. * Retrieve the parameters set for the virtual device.
  101. *
  102. * @param id Device ID.
  103. * @param param Structure to receive the settings.
  104. *
  105. * @return PJ_SUCCESS or the appropriate error code.
  106. */
  107. PJ_DECL(pj_status_t) pjmedia_avi_dev_get_param(pjmedia_vid_dev_index id,
  108. pjmedia_avi_dev_param *param);
  109. /**
  110. * Free the resources associated with the virtual device.
  111. *
  112. * @param id The device ID.
  113. *
  114. * @return PJ_SUCCESS or the appropriate error code.
  115. */
  116. PJ_DECL(pj_status_t) pjmedia_avi_dev_free(pjmedia_vid_dev_index id);
  117. /**
  118. * @}
  119. */
  120. PJ_END_DECL
  121. #endif /* __PJMEDIA_VIDEODEV_AVI_DEV_H__ */