#include "hds_amf0_encoder.h" #include "../mp4/mp4_builder.h" // amf types #define AMF0_TYPE_NUMBER (0x00) #define AMF0_TYPE_BOOLEAN (0x01) #define AMF0_TYPE_STRING (0x02) #define AMF0_TYPE_ECMA_ARRAY (0x08) #define AMF0_TYPE_OBJECT_END (0x09) static const vod_str_t amf0_on_metadata = vod_string("onMetaData"); // field name strings #define AMF0_FIELD(group, name, type) static const vod_str_t amf0_ ## name = { sizeof(#name) - 1, (u_char *) #name }; #include "hds_amf0_fields_x.h" #undef AMF0_FIELD // field counts #define AMF0_COMMON 0x01 #define AMF0_VIDEO 0x0100 #define AMF0_AUDIO 0x010000 #define AMF0_COMMON_FIELDS_COUNT (amf0_field_count & 0xFF) #define AMF0_VIDEO_FIELDS_COUNT ((amf0_field_count >> 8) & 0xFF) #define AMF0_AUDIO_FIELDS_COUNT ((amf0_field_count >> 16) & 0xFF) #define AMF0_FIELD(group, name, type) group + const int amf0_field_count =
&moov_size); if (rc != VOD_OK) { vod_log_debug1(VOD_LOG_DEBUG_LEVEL, state->request_context->log, 0, "mp4_metadata_reader_read: mp4_parser_uncompress_moov failed %i", rc); return rc; } if (uncomp_buffer != NULL) { state->parts[MP4_METADATA_PART_MOOV].data = uncomp_buffer + moov_offset; state->parts[MP4_METADATA_PART_MOOV].len = moov_size; } result->parts = state->parts; result->part_count = MP4_METADATA_PART_COUNT; return VOD_OK; } media_format_t mp4_format = { FORMAT_ID_MP4, vod_string("mp4"), mp4_metadata_reader_init, mp4_metadata_reader_read, mp4_clipper_parse_moov, mp4_clipper_build_header, mp4_parser_parse_basic_metadata, mp4_parser_parse_frames, };
#include "../media_set_parser.h" // macros #define RATE_FILTER_DESC_PATTERN "[%uD]atempo=%uD.%02uD[%uD]" // enums enum { RATE_FILTER_PARAM_RATE, RATE_FILTER_PARAM_SOURCE, RATE_FILTER_PARAM_COUNT }; // constants static json_object_key_def_t rate_filter_params[] = { { vod_string("rate"), VOD_JSON_FRAC, RATE_FILTER_PARAM_RATE }, { vod_string("source"), VOD_JSON_OBJECT, RATE_FILTER_PARAM_SOURCE }, { vod_null_string, 0, 0 } }; // globals static vod_hash_t rate_filter_hash; void rate_filter_scale_track_timestamps( media_track_t* track, uint32_t speed_nom, uint32_t speed_denom) { input_frame_t* last_frame; input_frame_t* cur_frame;
uint64_t timestamp; uint64_t duration; } segment_timing_info_t; // constants static const uint8_t tfxd_uuid[] = { 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6, 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 }; static const uint8_t tfrf_uuid[] = { 0xD4, 0x80, 0x7E, 0xF2, 0xCA, 0x39, 0x46, 0x95, 0x8E, 0x54, 0x26, 0xCB, 0x9E, 0x46, 0xA7, 0x9F, }; static vod_str_t mss_fourcc_aac = vod_string("AACL"); static vod_str_t mss_fourcc_mp3 = vod_string("WMAP"); static u_char* mss_append_hex_string(u_char* p, const u_char* buffer, uint32_t buffer_size) { const u_char* buffer_end = buffer + buffer_size; static const u_char hex_chars[] = "0123456789ABCDEF"; for (; buffer < buffer_end; buffer++) { *p++ = hex_chars[*buffer >> 4]; *p++ = hex_chars[*buffer & 0x0F]; } return p; }
0x64, 0x61, 0x73, 0x68, // compatible brand }; static const u_char styp_atom_v2[] = { 0x00, 0x00, 0x00, 0x18, // atom size 0x73, 0x74, 0x79, 0x70, // styp 0x6d, 0x73, 0x64, 0x68, // major brand 0x00, 0x00, 0x00, 0x00, // minor version 0x6d, 0x73, 0x64, 0x68, // compatible brand 0x6d, 0x73, 0x69, 0x78, // compatible brand }; static dash_codec_info_t dash_codecs[VOD_CODEC_ID_COUNT] = { { vod_null_string, vod_null_string, vod_null_string }, // invalid { vod_string("video/mp4"), vod_string("mp4"), vod_string("m4s") }, // avc { vod_string("video/mp4"), vod_string("mp4"), vod_string("m4s") }, // hevc { vod_string("video/webm"), vod_string("webm"), vod_string("webm") }, // vp8 { vod_string("video/webm"), vod_string("webm"), vod_string("webm") }, // vp9 { vod_string("audio/mp4"), vod_string("mp4"), vod_string("m4s") }, // aac { vod_string("audio/mp4"), vod_string("mp4"), vod_string("m4s") }, // ac3 { vod_string("audio/mp4"), vod_string("mp4"), vod_string("m4s") }, // eac3 { vod_string("audio/mp4"), vod_string("mp4"), vod_string("m4s") }, // mp3 { vod_string("audio/mp4"), vod_string("mp4"), vod_string("m4s") }, // dts { vod_string("audio/webm"), vod_string("webm"), vod_string("webm") }, // vorbis { vod_string("audio/webm"), vod_string("webm"), vod_string("webm") }, // opus }; // mpd writing code static bool_t
#include "../media_format.h" #include "../mp4/mp4_defs.h" #include "mkv_defs.h" // constants mkv_codec_type_t mkv_codec_types[] = { // video { vod_string("V_MPEG4/ISO/AVC"), VOD_CODEC_ID_AVC, FORMAT_AVC1, TRUE }, { vod_string("V_MPEGH/ISO/HEVC"), VOD_CODEC_ID_HEVC, FORMAT_HEV1, TRUE }, { vod_string("V_VP8"), VOD_CODEC_ID_VP8, 0, FALSE }, { vod_string("V_VP9"), VOD_CODEC_ID_VP9, 0, FALSE }, // audio { vod_string("A_AAC"), VOD_CODEC_ID_AAC, FORMAT_MP4A, TRUE }, { vod_string("A_MPEG/L3"), VOD_CODEC_ID_MP3, FORMAT_MP4A, FALSE }, { vod_string("A_VORBIS"), VOD_CODEC_ID_VORBIS,0, TRUE }, { vod_string("A_OPUS"), VOD_CODEC_ID_OPUS, 0, TRUE }, { vod_null_string, 0, 0, FALSE } };