MediaContent.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef TINYWRAP_MEDIA_CONTENT_H
  23. #define TINYWRAP_MEDIA_CONTENT_H
  24. #include "tinymedia.h"
  25. #include "Common.h"
  26. class MediaContentCPIM;
  27. class MediaContent
  28. {
  29. public:
  30. #if !defined(SWIG)
  31. MediaContent(tmedia_content_t* content);
  32. #endif
  33. virtual ~MediaContent();
  34. public:
  35. const char* getType();
  36. virtual unsigned getDataLength();
  37. virtual unsigned getData(void* pOutput, unsigned nMaxsize);
  38. // SWIG %newobject()
  39. static MediaContent* parse(const void* pData, unsigned nSize, const char* pType);
  40. static MediaContentCPIM* parse(const void* pData, unsigned nSize);
  41. virtual unsigned getPayloadLength() = 0;
  42. virtual unsigned getPayload(void* pOutput, unsigned nMaxsize) = 0;
  43. protected:
  44. tmedia_content_t* m_pContent;
  45. private:
  46. tsk_buffer_t* m_pData;
  47. };
  48. /* ============ message/CPIM ================= */
  49. class MediaContentCPIM : public MediaContent
  50. {
  51. public:
  52. #if !defined(SWIG)
  53. MediaContentCPIM(tmedia_content_t* pContent);
  54. #endif
  55. virtual ~MediaContentCPIM();
  56. public:
  57. virtual unsigned getPayloadLength();
  58. virtual unsigned getPayload(void* pOutput, unsigned nMaxsize);
  59. #if !defined(SWIG)
  60. const void* getPayloadPtr();
  61. #endif
  62. const char* getHeaderValue(const char* pName);
  63. };
  64. #endif /*TINYWRAP_MEDIA_CONTENT_H*/