25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

56 satır
2.4KB

  1. #ifndef _mkv_reader_h_
  2. #define _mkv_reader_h_
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #include "mkv-buffer.h"
  6. #include "mkv-format.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. typedef struct mkv_reader_t mkv_reader_t;
  11. mkv_reader_t* mkv_reader_create(const struct mkv_buffer_t* buffer, void* param);
  12. void mkv_reader_destroy(mkv_reader_t* mkv);
  13. struct mkv_reader_trackinfo_t
  14. {
  15. /// @param[in] object: MKV_CODEC_VIDEO_H264/MKV_CODEC_AUDIO_AAC, see more @mkv-format.h
  16. void (*onvideo)(void* param, uint32_t track, enum mkv_codec_t codec, int width, int height, const void* extra, size_t bytes);
  17. void (*onaudio)(void* param, uint32_t track, enum mkv_codec_t codec, int channel_count, int bit_per_sample, int sample_rate, const void* extra, size_t bytes);
  18. void (*onsubtitle)(void* param, uint32_t track, enum mkv_codec_t codec, const void* extra, size_t bytes);
  19. };
  20. /// @return 0-OK, other-error
  21. int mkv_reader_getinfo(mkv_reader_t* mkv, struct mkv_reader_trackinfo_t* ontrack, void* param);
  22. uint64_t mkv_reader_getduration(mkv_reader_t* mkv);
  23. /// audio: AAC raw data, don't include ADTS/AudioSpecificConfig
  24. /// video: 4-byte data length(don't include self length) + H.264 NALU(don't include 0x00000001)
  25. /// @param[in] flags MKV_FLAGS_xxx, such as: MKV_FLAGS_KEYFRAME
  26. typedef void (*mkv_reader_onread)(void* param, uint32_t track, const void* buffer, size_t bytes, int64_t pts, int64_t dts, int flags);
  27. /// @return 1-read one frame, 0-EOF, <0-error
  28. int mkv_reader_read(mkv_reader_t* mkv, void* buffer, size_t bytes, mkv_reader_onread onread, void* param);
  29. /// audio: AAC raw data, don't include ADTS/AudioSpecificConfig
  30. /// video: 4-byte data length(don't include self length) + H.264 NALU(don't include 0x00000001)
  31. /// @param[in] flags MKV_FLAGS_xxx, such as: MKV_FLAGS_KEYFRAME
  32. /// @return NULL-error, other-user alloc buffer
  33. typedef void* (*mkv_reader_onread2)(void* param, uint32_t track, size_t bytes, int64_t pts, int64_t dts, int flags);
  34. /// samp as mkv_reader_read + user alloc buffer
  35. /// NOTICE: user should free buffer on return error!!!
  36. /// @return 1-read one frame, 0-EOF, <0-error
  37. int mkv_reader_read2(mkv_reader_t* mkv, mkv_reader_onread2 onread, void* param);
  38. /// @param[in,out] timestamp input seek timestamp, output seek location timestamp
  39. /// @return 0-ok, other-error
  40. int mkv_reader_seek(mkv_reader_t* mkv, int64_t* timestamp);
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif /* !_mkv_reader_h_ */