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.

71 lines
2.4KB

  1. #ifndef _flv_muxer_h_
  2. #define _flv_muxer_h_
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #if defined(__cplusplus)
  6. extern "C" {
  7. #endif
  8. typedef struct flv_muxer_t flv_muxer_t;
  9. ///Video: FLV VideoTagHeader + AVCVIDEOPACKET: AVCDecoderConfigurationRecord(ISO 14496-15) / One or more NALUs(four-bytes length + NALU)
  10. ///Audio: FLV AudioTagHeader + AACAUDIODATA: AudioSpecificConfig(14496-3) / Raw AAC frame data in UI8
  11. ///@param[in] data FLV Audio/Video Data(don't include FLV Tag Header)
  12. ///@param[in] type 8-audio, 9-video
  13. ///@return 0-ok, other-error
  14. typedef int (*flv_muxer_handler)(void* param, int type, const void* data, size_t bytes, uint32_t timestamp);
  15. flv_muxer_t* flv_muxer_create(flv_muxer_handler handler, void* param);
  16. void flv_muxer_destroy(flv_muxer_t* muxer);
  17. /// re-create AAC/AVC sequence header
  18. int flv_muxer_reset(flv_muxer_t* muxer);
  19. /// @param[in] data AAC ADTS stream, 0xFFF15C40011FFC...
  20. int flv_muxer_aac(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  21. /// @param[in] data mp3 stream
  22. int flv_muxer_mp3(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  23. /// g711 alaw/mu-law
  24. int flv_muxer_g711a(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  25. int flv_muxer_g711u(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  26. /// @param[in] data opus stream, first opus head, then opus samples
  27. int flv_muxer_opus(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  28. /// @param[in] data h.264 annexb bitstream: H.264 start code + H.264 NALU, 0x0000000168...
  29. int flv_muxer_avc(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  30. /// @param[in] data h.265 annexb bitstream: H.265 start code + H.265 NALU, 0x00000001...
  31. int flv_muxer_hevc(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  32. /// @param[in] data av1 low overhead bitstream format
  33. int flv_muxer_av1(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);
  34. struct flv_metadata_t
  35. {
  36. int audiocodecid;
  37. double audiodatarate; // kbps
  38. int audiosamplerate;
  39. int audiosamplesize;
  40. int stereo;
  41. int videocodecid;
  42. double videodatarate; // kbps
  43. double framerate; // fps
  44. double duration;
  45. int interval; // frame interval
  46. int width;
  47. int height;
  48. };
  49. int flv_muxer_metadata(flv_muxer_t* muxer, const struct flv_metadata_t* metadata);
  50. #if defined(__cplusplus)
  51. }
  52. #endif
  53. #endif /* !_flv_muxer_h_ */