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