|
- #ifndef _hls_parser_h_
- #define _hls_parser_h_
-
- #include <stdint.h>
- #include <stddef.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- enum
- {
- HLS_M3U8_UNKNOWN = 0,
- HLS_M3U8_PLAYLIST,
- HLS_M3U8_MASTER,
- };
-
- enum
- {
- HLS_PLAYLIST_TYPE_LIVE = 0,
- HLS_PLAYLIST_TYPE_EVENT,
- HLS_PLAYLIST_TYPE_VOD,
- };
-
- enum
- {
- HLS_MEDIA_UNKNOWN = 0,
- HLS_MEDIA_AUDIO,
- HLS_MEDIA_VIDEO,
- HLS_MEDIA_SUBTITLE,
- HLS_MEDIA_CLOSED_CAPTIONS,
- };
-
-
- struct hls_media_t
- {
- char* type;
- char* uri;
-
- char* group_id;
- char* language;
- char* assoc_language;
- char* name;
- char* instream_id;
- char* characteristics;
- char* channels;
-
- int autoselect;
- int is_default;
- int forced;
- };
-
-
- struct hls_variant_t
- {
- uint32_t bandwidth;
- uint32_t average_bandwidth;
- int width, height;
- double fps;
- char* hdcp_level;
- char* uri;
- char* codecs;
- char* video_range;
- char* audio;
- char* video;
- char* subtitle;
- char* closed_captions;
-
- struct hls_variant_t* i_frame_stream_inf;
- };
-
- struct hls_segment_t
- {
- double duration;
- char* uri;
- char* title;
-
- int64_t bytes;
- int64_t offset;
-
-
-
-
-
-
- int discontinuity;
-
- struct {
- char* method;
- char* uri;
- char* keyformat;
- char* keyformatversions;
- uint8_t iv[16];
- } key;
-
-
-
- struct {
- char* uri;
- int64_t bytes;
- int64_t offset;
- } map;
-
- char* program_date_time;
-
- struct {
- char* id;
- char* cls;
- char* start_date;
- char* end_date;
- double duration;
- double planned_duration;
- char* x_client_attribute;
- int end_on_next;
- } daterange;
- };
-
-
-
-
-
- struct hls_playlist_t
- {
- int version;
-
- uint64_t target_duration;
- uint64_t media_sequence;
- uint64_t discontinuity_sequence;
- int endlist;
- int type;
- int i_frames_only;
- int independent_segments;
- double start_time_offset;
- int start_precise;
-
- struct hls_segment_t* segments;
- size_t count;
- };
-
- struct hls_master_t
- {
- int version;
-
- size_t variant_count;
- struct hls_variant_t *variants;
-
-
- size_t media_count;
- struct hls_media_t* medias;
-
- struct {
- char* data_id;
- char* value;
- char* uri;
- char* language;
- } *session_data;
- size_t session_data_count;
-
- struct {
- char* method;
- char* uri;
- char* keyformat;
- char* keyformatversions;
- uint8_t iv[16];
- } *session_key;
- size_t session_key_count;
-
- int independent_segments;
- double start_time_offset;
- int start_precise;
- };
-
-
-
- int hls_parser_probe(const char* m3u8, size_t len);
-
-
-
-
- int hls_master_parse(struct hls_master_t** master, const char* m3u8, size_t len);
-
- int hls_master_free(struct hls_master_t** master);
-
- int hls_master_best_variant(const struct hls_master_t* master);
-
- int hls_master_rendition(const struct hls_master_t* master, int variant, int type, const char* name);
-
-
-
-
- int hls_playlist_parse(struct hls_playlist_t** playlist, const char* m3u8, size_t len);
-
- int hls_playlist_free(struct hls_playlist_t** playlist);
-
-
- int64_t hls_playlist_duration(const struct hls_playlist_t* playlist);
-
- #ifdef __cplusplus
- }
- #endif
- #endif
|