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.

109 lines
2.7 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*******************************************************************************
  2. moov.h - A library for splitting Quicktime/MPEG4 files.
  3. Copyright (C) 2007-2009 CodeShop B.V.
  4. http://www.code-shop.com
  5. For licensing see the LICENSE file
  6. ******************************************************************************/
  7. #ifndef MOOV_H_AKW
  8. #define MOOV_H_AKW
  9. // NOTE: don't include stdio.h (for FILE) or sys/types.h (for off_t).
  10. // nginx redefines _FILE_OFFSET_BITS and off_t will have different sizes
  11. // depending on include order
  12. #include "mod_streaming_export.h"
  13. #ifndef _MSC_VER
  14. #include <inttypes.h>
  15. #else
  16. #include "inttypes.h"
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. struct mp4_context_t;
  22. struct bucket_t;
  23. MOD_STREAMING_DLL_LOCAL extern char const* fragment_type_audio;
  24. MOD_STREAMING_DLL_LOCAL extern char const* fragment_type_video;
  25. enum fragment_type_t
  26. {
  27. FRAGMENT_TYPE_UNKNOWN,
  28. FRAGMENT_TYPE_AUDIO,
  29. FRAGMENT_TYPE_VIDEO
  30. };
  31. enum input_format_t
  32. {
  33. INPUT_FORMAT_MP4,
  34. INPUT_FORMAT_FLV
  35. };
  36. typedef enum input_format_t input_format_t;
  37. enum output_format_t
  38. {
  39. OUTPUT_FORMAT_MP4,
  40. OUTPUT_FORMAT_MOV,
  41. OUTPUT_FORMAT_RAW,
  42. OUTPUT_FORMAT_FLV,
  43. OUTPUT_FORMAT_TS
  44. };
  45. typedef enum output_format_t output_format_t;
  46. struct mp4_split_options_t
  47. {
  48. int client_is_flash;
  49. float start;
  50. uint64_t start_integer;
  51. float end;
  52. int adaptive;
  53. int fragments;
  54. enum output_format_t output_format;
  55. enum input_format_t input_format;
  56. char const* fragment_type;
  57. unsigned int fragment_bitrate;
  58. unsigned int fragment_track_id;
  59. uint64_t fragment_start;
  60. int seconds;
  61. uint64_t* byte_offsets;
  62. };
  63. typedef struct mp4_split_options_t mp4_split_options_t;
  64. MOD_STREAMING_DLL_LOCAL extern
  65. mp4_split_options_t* mp4_split_options_init();
  66. MOD_STREAMING_DLL_LOCAL extern
  67. int mp4_split_options_set(mp4_split_options_t* options,
  68. const char* args_data,
  69. unsigned int args_size);
  70. MOD_STREAMING_DLL_LOCAL extern
  71. void mp4_split_options_exit(mp4_split_options_t* options);
  72. /* Returns true when the test string is a prefix of the input */
  73. MOD_STREAMING_DLL_LOCAL extern
  74. int starts_with(const char* input, const char* test);
  75. /* Returns true when the test string is a suffix of the input */
  76. MOD_STREAMING_DLL_LOCAL extern
  77. int ends_with(const char* input, const char* test);
  78. MOD_STREAMING_DLL_LOCAL extern
  79. int mp4_split(struct mp4_context_t* mp4_context,
  80. unsigned int* trak_sample_start,
  81. unsigned int* trak_sample_end,
  82. mp4_split_options_t const* options);
  83. MOD_STREAMING_DLL_LOCAL extern uint64_t get_filesize(const char *path);
  84. #ifdef __cplusplus
  85. } /* extern C definitions */
  86. #endif
  87. #endif // MOOV_H_AKW
  88. // End Of File