Projects
Multimedia
bento4
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
bento4.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Sun Apr 22 05:20:51 UTC 2018 - aloisio@gmx.com + +- Update to 1.5.1-623 + +------------------------------------------------------------------- Mon Jan 8 10:24:20 UTC 2018 - aloisio@gmx.com - Update to 1.5.1-622
View file
bento4.spec
Changed
@@ -16,10 +16,10 @@ # -%define _over 1.5.1-622 -%define _libver 1_5_1r622 +%define _over 1.5.1-623 +%define _libver 1_5_1r623 Name: bento4 -Version: 1.5.1r622 +Version: 1.5.1r623 Release: 0 Summary: C++ toolkit for all your MP4 and MPEG DASH media format needs License: GPL-2.0
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp42Avc/Mp42Avc.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp42Avc/Mp42Avc.cpp
Changed
@@ -158,7 +158,9 @@ return AP4_FAILURE; } - if (sdesc->GetFormat() == AP4_SAMPLE_FORMAT_AVC3 || sdesc->GetFormat() == AP4_SAMPLE_FORMAT_AVC4) { + if (sdesc->GetFormat() == AP4_SAMPLE_FORMAT_AVC3 || + sdesc->GetFormat() == AP4_SAMPLE_FORMAT_AVC4 || + sdesc->GetFormat() == AP4_SAMPLE_FORMAT_DVAV) { // no need for a prefix, SPS/PPS NALs should be in the elementary stream already return AP4_SUCCESS; }
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp
Changed
@@ -173,7 +173,7 @@ " --encryption-key-format <format>\n" " Encryption key format. (default: 'identity')\n" " --encryption-key-format-versions <versions>\n" - " Encryption key format versions." + " Encryption key format versions.\n" " --encryption-key-line <ext-x-key-line>\n" " Preformatted encryption key line (only the portion after the #EXT-X-KEY: tag).\n" " This option can be used multiple times, once for each preformatted key line to be included in the playlist.\n" @@ -2036,7 +2036,9 @@ if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC1 || sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC2 || sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC3 || - sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC4) { + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC4 || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVAV || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVA1) { if (Options.encryption_mode == ENCRYPTION_MODE_SAMPLE_AES) { stream_type = AP4_MPEG2_STREAM_TYPE_SAMPLE_AES_AVC; AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description); @@ -2049,7 +2051,9 @@ stream_type = AP4_MPEG2_STREAM_TYPE_AVC; } } else if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HEV1 || - sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HVC1) { + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HVC1 || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVHE || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVH1) { stream_type = AP4_MPEG2_STREAM_TYPE_HEVC; } else { fprintf(stderr, "ERROR: video codec not supported\n");
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp
Changed
@@ -593,10 +593,14 @@ if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC1 || sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC2 || sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC3 || - sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC4) { + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AVC4 || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVAV || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVA1) { stream_type = AP4_MPEG2_STREAM_TYPE_AVC; } else if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HEV1 || - sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HVC1) { + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_HVC1 || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVHE || + sample_description->GetFormat() == AP4_SAMPLE_FORMAT_DVH1) { stream_type = AP4_MPEG2_STREAM_TYPE_HEVC; } else { fprintf(stderr, "ERROR: video codec not supported\n");
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp4Encrypt/Mp4Encrypt.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp4Encrypt/Mp4Encrypt.cpp
Changed
@@ -560,6 +560,25 @@ method == METHOD_MPEG_CENS || method == METHOD_MPEG_CBCS) { AP4_CencVariant variant = AP4_CENC_VARIANT_MPEG_CENC; + AP4_UI32 options = 0; + + // init local options based on global options + if (AP4_GlobalOptions::GetBool("mpeg-cenc.eme-pssh")) { + options |= AP4_CencEncryptingProcessor::OPTION_EME_PSSH; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.piff-compatible")) { + options |= AP4_CencEncryptingProcessor::OPTION_PIFF_COMPATIBILITY; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.piff-iv-size-16")) { + options |= AP4_CencEncryptingProcessor::OPTION_PIFF_IV_SIZE_16; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.iv-size-8")) { + options |= AP4_CencEncryptingProcessor::OPTION_IV_SIZE_8; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.no-senc")) { + options |= AP4_CencEncryptingProcessor::OPTION_NO_SENC; + } + switch (method) { case METHOD_PIFF_CBC: variant = AP4_CENC_VARIANT_PIFF_CBC; @@ -588,7 +607,7 @@ default: break; } - AP4_CencEncryptingProcessor* cenc_processor = new AP4_CencEncryptingProcessor(variant); + AP4_CencEncryptingProcessor* cenc_processor = new AP4_CencEncryptingProcessor(variant, options); cenc_processor->GetKeyMap().SetKeys(key_map); cenc_processor->GetPropertyMap().SetProperties(property_map); for (unsigned int i=0; i<pssh_atoms.ItemCount(); i++) {
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp
Changed
@@ -90,6 +90,7 @@ " --sequence-number-start <start> Value of the first segment sequence number (default: 1)\n" " --force-i-frame-sync <auto|all> treat all I-frames as sync samples (for open-gop sequences)\n" " 'auto' only forces the flag if an open-gop source is detected, 'all' forces the flag in all cases\n" + " --copy-udta copy the moov/udta atom from input to output\n" ); exit(1); } @@ -286,6 +287,14 @@ }; /*---------------------------------------------------------------------- +| IndexSegmentInfo ++---------------------------------------------------------------------*/ +class IndexedSegmentInfo { +public: + AP4_List<FragmentInfo> m_Fragments; +}; + +/*---------------------------------------------------------------------- | Fragment +---------------------------------------------------------------------*/ static void @@ -294,13 +303,15 @@ AP4_Array<TrackCursor*>& cursors, unsigned int fragment_duration, AP4_UI32 timescale, - AP4_UI32 track_id, - bool create_segment_index) + bool create_segment_index, + bool copy_udta) { - AP4_List<FragmentInfo> fragments; - TrackCursor* index_cursor = NULL; - AP4_Result result; + AP4_List<FragmentInfo> fragments; + AP4_List<IndexedSegmentInfo> indexed_segments; + IndexedSegmentInfo* current_indexed_segment = NULL; + AP4_Result result; + // get the movie AP4_Movie* input_movie = input_file.GetMovie(); if (input_movie == NULL) { fprintf(stderr, "ERROR: no moov found in the input file\n"); @@ -319,11 +330,6 @@ for (unsigned int i=0; i<cursors.ItemCount(); i++) { AP4_Track* track = cursors[i]->m_Track; - // skip non matching tracks if we have a selector - if (track_id && track->GetId() != track_id) { - continue; - } - result = cursors[i]->Init(); if (AP4_FAILED(result)) { fprintf(stderr, "ERROR: failed to init sample cursor (%d), skipping track %d\n", result, track->GetId()); @@ -400,10 +406,9 @@ // select the anchor cursor TrackCursor* anchor_cursor = NULL; - for (unsigned int i=0; i<cursors.ItemCount(); i++) { - if (cursors[i]->m_Track->GetId() == track_id) { - anchor_cursor = cursors[i]; - } + if (cursors.ItemCount() == 1) { + // only one track, that's our anchor + anchor_cursor = cursors[0]; } if (anchor_cursor == NULL) { for (unsigned int i=0; i<cursors.ItemCount(); i++) { @@ -431,22 +436,30 @@ } } if (anchor_cursor == NULL) { - // this shoudl never happen + // this should never happen fprintf(stderr, "ERROR: no anchor track\n"); return; } - if (create_segment_index) { - index_cursor = anchor_cursor; - } if (Options.debug) { printf("Using track ID %d as anchor\n", anchor_cursor->m_Track->GetId()); } + // decide which tracks to index and in which order + TrackCursor* indexed_cursor = anchor_cursor; + // update the mehd duration mehd->SetDuration(output_movie->GetDuration()); // add the mvex container to the moov container output_movie->GetMoovAtom()->AddChild(mvex); + + // copy the moov/udta atom to the moov container + if (copy_udta) { + AP4_Atom* udta = input_movie->GetMoovAtom()->GetChild(AP4_ATOM_TYPE_UDTA); + if (udta != NULL) { + output_movie->GetMoovAtom()->AddChild(udta->Clone()); + } + } // compute all the fragments unsigned int sequence_number = Options.sequence_number_start; @@ -455,7 +468,6 @@ // pick the first track with a fragment index lower than the anchor's for (unsigned int i=0; i<cursors.ItemCount(); i++) { - if (track_id && cursors[i]->m_Track->GetId() != track_id) continue; if (cursors[i]->m_Eos) continue; if (cursors[i]->m_FragmentIndex < anchor_cursor->m_FragmentIndex) { cursor = cursors[i]; @@ -471,7 +483,6 @@ anchor_cursor = NULL; if (!Options.trim) { for (unsigned int i=0; i<cursors.ItemCount(); i++) { - if (track_id && cursors[i]->m_Track->GetId() != track_id) continue; if (cursors[i]->m_Eos) continue; if (anchor_cursor == NULL || cursors[i]->m_Track->GetType() == AP4_Track::TYPE_VIDEO || @@ -626,6 +637,17 @@ FragmentInfo* fragment = new FragmentInfo(cursor->m_Samples, cursor->m_Tfra, cursor->m_Timestamp, moof); fragments.Add(fragment); + // keep track of fragments that will be part of the index + if (cursor == anchor_cursor) { + // start a new segment + current_indexed_segment = new IndexedSegmentInfo(); + indexed_segments.Add(current_indexed_segment); + } else { + if (current_indexed_segment) { + current_indexed_segment->m_Fragments.Add(fragment); + } + } + // add samples to the fragment unsigned int sample_count = 0; AP4_Array<AP4_TrunAtom::Entry> trun_entries; @@ -742,17 +764,17 @@ // write the moov atom output_movie->GetMoovAtom()->Write(output_stream); - // write the (not-yet fully computed) index if needed + // write the (not-yet fully computed) indexes if needed AP4_SidxAtom* sidx = NULL; AP4_Position sidx_position = 0; output_stream.Tell(sidx_position); if (create_segment_index) { - sidx = new AP4_SidxAtom(index_cursor->m_Track->GetId(), - timescale?timescale:index_cursor->m_Track->GetMediaTimeScale(), + sidx = new AP4_SidxAtom(indexed_cursor->m_Track->GetId(), + timescale ? timescale : indexed_cursor->m_Track->GetMediaTimeScale(), 0, 0); // reserve space for the entries now, but they will be computed and updated later - sidx->SetReferenceCount(fragments.ItemCount()); + sidx->SetReferenceCount(indexed_segments.ItemCount()); sidx->Write(output_stream); } @@ -802,12 +824,25 @@ if (create_segment_index) { unsigned int segment_index = 0; AP4_SidxAtom::Reference reference; - for (AP4_List<FragmentInfo>::Item* item = fragments.FirstItem(); - item; - item = item->GetNext()) { - FragmentInfo* fragment = item->GetData(); - reference.m_ReferencedSize = (AP4_UI32)(fragment->m_Moof->GetSize()+fragment->m_MdatSize); - reference.m_SubsegmentDuration = fragment->m_Duration; + for (AP4_List<IndexedSegmentInfo>::Item* item = indexed_segments.FirstItem(); + item; + item = item->GetNext()) { + IndexedSegmentInfo* segment = item->GetData(); + + // compute the total size and duration of the segment + AP4_UI32 segment_size = 0; + AP4_UI32 segment_duration = 0; + for (AP4_List<FragmentInfo>::Item* item = segment->m_Fragments.FirstItem(); + item; + item = item->GetNext()) { + FragmentInfo* fragment = item->GetData(); + segment_size += (AP4_UI32)(fragment->m_Moof->GetSize()+fragment->m_MdatSize); + segment_duration += fragment->m_Duration; + } + + // update the sidx entry + reference.m_ReferencedSize = segment_size; + reference.m_SubsegmentDuration = segment_duration; reference.m_StartsWithSap = true; sidx->SetReference(segment_index++, reference); } @@ -822,9 +857,6 @@ // create an mfra container and write out the index AP4_ContainerAtom mfra(AP4_ATOM_TYPE_MFRA); for (unsigned int i=0; i<cursors.ItemCount(); i++) { - if (track_id && cursors[i]->m_Track->GetId() != track_id) { - continue; - }
View file
bento4-1.5.1r622.tar.gz/Source/C++/Apps/Mp4Mux/Mp4Mux.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Apps/Mp4Mux/Mp4Mux.cpp
Changed
@@ -154,30 +154,6 @@ remove(m_Filename.GetChars()); } - AP4_Result StoreSample(AP4_Sample& from_sample, AP4_Sample& to_sample) { - // clone the sample fields - to_sample = from_sample; - - // read the sample data - AP4_DataBuffer sample_data; - AP4_Result result = from_sample.ReadData(sample_data); - if (AP4_FAILED(result)) return result; - - // mark where we are going to store the sample data - AP4_Position position; - m_Stream->Tell(position); - to_sample.SetOffset(position); - - // write the sample data - result = m_Stream->Write(sample_data.GetData(), sample_data.GetDataSize()); - if (AP4_FAILED(result)) return result; - - // update the stream for the new sample - to_sample.SetDataStream(*m_Stream); - - return AP4_SUCCESS; - } - AP4_ByteStream* GetStream() { return m_Stream; } private: @@ -1040,14 +1016,16 @@ return 1; } - // create a multimedia file - AP4_File file(movie); + { + // create a multimedia file + AP4_File file(movie); - // set the file type - file.SetFileType(AP4_FILE_BRAND_MP42, 1, &brands[0], brands.ItemCount()); + // set the file type + file.SetFileType(AP4_FILE_BRAND_MP42, 1, &brands[0], brands.ItemCount()); - // write the file to the output - AP4_FileWriter::Write(file, *output); + // write the file to the output + AP4_FileWriter::Write(file, *output); + } // cleanup delete sample_storage;
View file
bento4-1.5.1r622.tar.gz/Source/C++/Codecs/Ap4AvcParser.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Codecs/Ap4AvcParser.cpp
Changed
@@ -210,7 +210,7 @@ constraint_set3_flag(0), level_idc(0), seq_parameter_set_id(0), - chroma_format_idc(0), + chroma_format_idc(1), separate_colour_plane_flag(0), bit_depth_luma_minus8(0), bit_depth_chroma_minus8(0),
View file
bento4-1.5.1r622.tar.gz/Source/C++/Codecs/Ap4HevcParser.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Codecs/Ap4HevcParser.cpp
Changed
@@ -686,7 +686,7 @@ num_tile_columns_minus1(0), num_tile_rows_minus1(0), uniform_spacing_flag(1), - loop_filter_across_tiles_enabled_flag(0), + loop_filter_across_tiles_enabled_flag(1), pps_loop_filter_across_slices_enabled_flag(0), deblocking_filter_control_present_flag(0), deblocking_filter_override_enabled_flag(0),
View file
bento4-1.5.1r622.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp
Changed
@@ -64,6 +64,37 @@ const unsigned int AP4_CENC_NAL_UNIT_ENCRYPTION_MIN_SIZE = 112; /*---------------------------------------------------------------------- +| AP4_CencSubSampleMapAppend ++---------------------------------------------------------------------*/ +static void +AP4_CencSubSampleMapAppendEntry(AP4_Array<AP4_UI16>& bytes_of_cleartext_data, + AP4_Array<AP4_UI32>& bytes_of_encrypted_data, + unsigned int cleartext_size, + unsigned int encrypted_size) +{ + // if there's already an entry, attempt to extend the last entry + if (bytes_of_cleartext_data.ItemCount() > 0) { + AP4_Cardinal last_index = bytes_of_cleartext_data.ItemCount() - 1; + if (bytes_of_encrypted_data[last_index] == 0) { + cleartext_size += bytes_of_cleartext_data[last_index]; + bytes_of_cleartext_data.RemoveLast(); + bytes_of_encrypted_data.RemoveLast(); + } + } + + // append chunks of cleartext size taking into account that the cleartext_size field is only 16 bits + while (cleartext_size > 0xFFFF) { + bytes_of_cleartext_data.Append(0xFFFF); + bytes_of_encrypted_data.Append(0); + cleartext_size -= 0xFFFF; + } + + // append whatever is left + bytes_of_cleartext_data.Append(cleartext_size); + bytes_of_encrypted_data.Append(encrypted_size); +} + +/*---------------------------------------------------------------------- | AP4_CencBasicSubSampleMapper::GetSubSampleMap +---------------------------------------------------------------------*/ AP4_Result @@ -160,7 +191,9 @@ } else if (m_Format == AP4_SAMPLE_FORMAT_AVC1 || m_Format == AP4_SAMPLE_FORMAT_AVC2 || m_Format == AP4_SAMPLE_FORMAT_AVC3 || - m_Format == AP4_SAMPLE_FORMAT_AVC4) { + m_Format == AP4_SAMPLE_FORMAT_AVC4 || + m_Format == AP4_SAMPLE_FORMAT_DVAV || + m_Format == AP4_SAMPLE_FORMAT_DVA1) { unsigned int nalu_type = in[m_NaluLengthSize] & 0x1F; if (nalu_type != AP4_AVC_NAL_UNIT_TYPE_CODED_SLICE_OF_NON_IDR_PICTURE && nalu_type != AP4_AVC_NAL_UNIT_TYPE_CODED_SLICE_DATA_PARTITION_A && @@ -171,7 +204,9 @@ skip = true; } } else if (m_Format == AP4_SAMPLE_FORMAT_HEV1 || - m_Format == AP4_SAMPLE_FORMAT_HVC1) { + m_Format == AP4_SAMPLE_FORMAT_HVC1 || + m_Format == AP4_SAMPLE_FORMAT_DVHE || + m_Format == AP4_SAMPLE_FORMAT_DVH1) { unsigned int nalu_type = (in[m_NaluLengthSize] >> 1) & 0x3F; if (nalu_type >= 32) { // this NAL unit is not a VCL NAL unit @@ -183,17 +218,10 @@ if (cenc_layout && AP4_CompareStrings(cenc_layout, "nalu-length-and-type-only") == 0) { unsigned int cleartext_size = m_NaluLengthSize+1; unsigned int encrypted_size = nalu_size > cleartext_size ? nalu_size-cleartext_size : 0; - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(encrypted_size); + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, cleartext_size, encrypted_size); } else if (skip) { // use cleartext regions to cover the entire NAL unit - unsigned int range = nalu_size; - while (range) { - AP4_UI16 cleartext_size = (range <= 0xFFFF) ? range : 0xFFFF; - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(0); - range -= cleartext_size; - } + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, nalu_size, 0); } else { // leave some cleartext bytes at the start and encrypt the rest (multiple of blocks) unsigned int encrypted_size = nalu_size-(AP4_CENC_NAL_UNIT_ENCRYPTION_MIN_SIZE-16); @@ -201,8 +229,7 @@ unsigned int cleartext_size = nalu_size-encrypted_size; AP4_ASSERT(encrypted_size >= 16); AP4_ASSERT(cleartext_size >= m_NaluLengthSize); - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(encrypted_size); + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, cleartext_size, encrypted_size); } // move the pointers @@ -229,7 +256,9 @@ if (format == AP4_SAMPLE_FORMAT_AVC1 || format == AP4_SAMPLE_FORMAT_AVC2 || format == AP4_SAMPLE_FORMAT_AVC3 || - format == AP4_SAMPLE_FORMAT_AVC4) { + format == AP4_SAMPLE_FORMAT_AVC4 || + format == AP4_SAMPLE_FORMAT_DVAV || + format == AP4_SAMPLE_FORMAT_DVA1) { // create the parser m_AvcParser = new AP4_AvcFrameParser(); @@ -252,7 +281,9 @@ ParseAvcData(pps.GetData(), pps.GetDataSize()); } } else if (format == AP4_SAMPLE_FORMAT_HEV1 || - format == AP4_SAMPLE_FORMAT_HVC1) { + format == AP4_SAMPLE_FORMAT_HVC1 || + format == AP4_SAMPLE_FORMAT_DVHE || + format == AP4_SAMPLE_FORMAT_DVH1) { // create the parser m_HevcParser = new AP4_HevcFrameParser(); @@ -358,7 +389,9 @@ if (m_Format == AP4_SAMPLE_FORMAT_AVC1 || m_Format == AP4_SAMPLE_FORMAT_AVC2 || m_Format == AP4_SAMPLE_FORMAT_AVC3 || - m_Format == AP4_SAMPLE_FORMAT_AVC4) { + m_Format == AP4_SAMPLE_FORMAT_AVC4 || + m_Format == AP4_SAMPLE_FORMAT_DVAV || + m_Format == AP4_SAMPLE_FORMAT_DVA1) { const AP4_UI08* nalu_data = &in[m_NaluLengthSize]; unsigned int nalu_type = nalu_data[0] & 0x1F; @@ -381,9 +414,7 @@ // leave the slice header in the clear, including the NAL type unsigned int cleartext_size = m_NaluLengthSize+1+(slice_header.size+7)/8; unsigned int encrypted_size = nalu_size-cleartext_size; - - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(encrypted_size); + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, cleartext_size, encrypted_size); } else { // this NAL unit does not have a slice header skip = true; @@ -398,7 +429,9 @@ } } } else if (m_Format == AP4_SAMPLE_FORMAT_HEV1 || - m_Format == AP4_SAMPLE_FORMAT_HVC1) { + m_Format == AP4_SAMPLE_FORMAT_HVC1 || + m_Format == AP4_SAMPLE_FORMAT_DVHE || + m_Format == AP4_SAMPLE_FORMAT_DVH1) { const AP4_UI08* nalu_data = &in[m_NaluLengthSize]; unsigned int nalu_type = (nalu_data[0] >> 1) & 0x3F; @@ -415,11 +448,8 @@ // NOTE: the slice header is always a multiple of 8 bits because of byte_alignment() unsigned int header_size = slice_header.size/8; unsigned int cleartext_size = m_NaluLengthSize+2+header_size; - // unsigned int encrypted_size = nalu_size-cleartext_size; - - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(encrypted_size); + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, cleartext_size, encrypted_size); } else { skip = true; @@ -440,13 +470,7 @@ if (skip) { // use cleartext regions to cover the entire NAL unit - unsigned int range = nalu_size; - while (range) { - AP4_UI16 cleartext_size = (range <= 0xFFFF) ? range : 0xFFFF; - bytes_of_cleartext_data.Append(cleartext_size); - bytes_of_encrypted_data.Append(0); - range -= cleartext_size; - } + AP4_CencSubSampleMapAppendEntry(bytes_of_cleartext_data, bytes_of_encrypted_data, nalu_size, 0); } // move the pointers @@ -854,6 +878,7 @@ public: // constructor AP4_CencFragmentEncrypter(AP4_CencVariant variant, + AP4_UI32 options, AP4_ContainerAtom* traf, AP4_CencEncryptingProcessor::Encrypter* encrypter, AP4_UI32 cleartext_sample_description_index); @@ -868,6 +893,7 @@ private: // members AP4_CencVariant m_Variant; + AP4_UI32 m_Options; AP4_ContainerAtom* m_Traf; AP4_CencSampleEncryption* m_SampleEncryptionAtom; AP4_CencSampleEncryption* m_SampleEncryptionAtomShadow; @@ -881,10 +907,12 @@ | AP4_CencFragmentEncrypter::AP4_CencFragmentEncrypter +---------------------------------------------------------------------*/ AP4_CencFragmentEncrypter::AP4_CencFragmentEncrypter(AP4_CencVariant variant, + AP4_UI32 options, AP4_ContainerAtom* traf, AP4_CencEncryptingProcessor::Encrypter* encrypter, AP4_UI32 cleartext_sample_description_index) : m_Variant(variant), + m_Options(options), m_Traf(traf),
View file
bento4-1.5.1r622.tar.gz/Source/C++/Core/Ap4CommonEncryption.h -> bento4-1.5.1r623.tar.gz/Source/C++/Core/Ap4CommonEncryption.h
Changed
@@ -592,6 +592,13 @@ class AP4_CencEncryptingProcessor : public AP4_Processor { public: + // class constants + static const AP4_UI32 OPTION_EME_PSSH = 0x01; ///< Include a 'standard EME' pssh atom in the output + static const AP4_UI32 OPTION_PIFF_COMPATIBILITY = 0x02; ///< Attempt to create an output that is compatible with the PIFF format + static const AP4_UI32 OPTION_PIFF_IV_SIZE_16 = 0x04; ///< With the PIFF-compatibiity option, use an IV of size 16 when possible (instead of 8) + static const AP4_UI32 OPTION_IV_SIZE_8 = 0x08; ///< Use an IV of size 8 when possible (instead of 16 by default). + static const AP4_UI32 OPTION_NO_SENC = 0x10; ///< Don't output an 'senc' atom + // types struct Encrypter { Encrypter(AP4_UI32 track_id, AP4_UI32 cleartext_fragments, AP4_CencSampleEncrypter* sample_encrypter) : @@ -608,6 +615,7 @@ // constructor AP4_CencEncryptingProcessor(AP4_CencVariant variant, + AP4_UI32 options = 0, AP4_BlockCipherFactory* block_cipher_factory = NULL); ~AP4_CencEncryptingProcessor(); @@ -630,6 +638,7 @@ protected: // members AP4_CencVariant m_Variant; + AP4_UI32 m_Options; AP4_BlockCipherFactory* m_BlockCipherFactory; AP4_ProtectionKeyMap m_KeyMap; AP4_TrackPropertyMap m_PropertyMap;
View file
bento4-1.5.1r622.tar.gz/Source/C++/Core/Ap4FtypAtom.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Core/Ap4FtypAtom.cpp
Changed
@@ -42,14 +42,18 @@ | AP4_FtypAtom::AP4_FtypAtom +---------------------------------------------------------------------*/ AP4_FtypAtom::AP4_FtypAtom(AP4_UI32 size, AP4_ByteStream& stream) : - AP4_Atom(AP4_ATOM_TYPE_FTYP, size) + AP4_Atom(AP4_ATOM_TYPE_FTYP, size), + m_MajorBrand(0), + m_MinorVersion(0) { + if (size < 16) return; stream.ReadUI32(m_MajorBrand); stream.ReadUI32(m_MinorVersion); size -= 16; - while (size) { + while (size >= 4) { AP4_UI32 compatible_brand; - stream.ReadUI32(compatible_brand); + AP4_Result result = stream.ReadUI32(compatible_brand); + if (AP4_FAILED(result)) return; m_CompatibleBrands.Append(compatible_brand); size -= 4; }
View file
bento4-1.5.1r622.tar.gz/Source/C++/Core/Ap4Processor.h -> bento4-1.5.1r623.tar.gz/Source/C++/Core/Ap4Processor.h
Changed
@@ -218,12 +218,12 @@ /** * This method can be overridden by concrete subclasses. * It is called once for each track in the input file. - * @param track Pointer to the track for which a handler should be + * @param trak Pointer to the track for which a handler should be * created. * @return A pointer to a track handler, or NULL if no handler * needs to be created for that track. */ - virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* /*trak*/) { return NULL; } + virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak) { (void)trak; return NULL; } /** * This method can be overridden by concrete subclasses.
View file
bento4-1.5.1r622.tar.gz/Source/C++/Core/Ap4Protection.cpp -> bento4-1.5.1r623.tar.gz/Source/C++/Core/Ap4Protection.cpp
Changed
@@ -232,6 +232,8 @@ case AP4_SAMPLE_FORMAT_AVC2: case AP4_SAMPLE_FORMAT_AVC3: case AP4_SAMPLE_FORMAT_AVC4: + case AP4_SAMPLE_FORMAT_DVAV: + case AP4_SAMPLE_FORMAT_DVA1: return new AP4_AvcSampleDescription( format, m_Width, @@ -242,6 +244,8 @@ case AP4_SAMPLE_FORMAT_HVC1: case AP4_SAMPLE_FORMAT_HEV1: + case AP4_SAMPLE_FORMAT_DVHE: + case AP4_SAMPLE_FORMAT_DVH1: return new AP4_HevcSampleDescription( format, m_Width,
View file
bento4-1.5.1r622.tar.gz/Source/Python/utils/mp4-dash.py -> bento4-1.5.1r623.tar.gz/Source/Python/utils/mp4-dash.py
Changed
@@ -28,7 +28,7 @@ # setup main options VERSION = "1.8.0" -SDK_REVISION = '622' +SDK_REVISION = '623' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += [SCRIPT_PATH] @@ -379,7 +379,7 @@ maxHeight = 0 for video_track in video_tracks: if minWidth == 0 or video_track.width < minWidth: minWidth = video_track.width - if minHeight == 0 or video_track.width < minHeight: minHeight = video_track.height + if minHeight == 0 or video_track.height < minHeight: minHeight = video_track.height if video_track.width > maxWidth: maxWidth = video_track.width if video_track.height > maxHeight: maxHeight = video_track.height @@ -599,7 +599,7 @@ def OutputHlsCommon(options, track, media_subdir, playlist_name, media_file_name): hls_target_duration = math.ceil(max(track.segment_durations)) - playlist_file = open(path.join(options.output_dir, media_subdir, playlist_name), 'w+') + playlist_file = open(path.join(options.output_dir, media_subdir, playlist_name), 'wb+') playlist_file.write('#EXTM3U\r\n') playlist_file.write('# Created with Bento4 mp4-dash.py, VERSION=' + VERSION + '-' + SDK_REVISION+'\r\n') playlist_file.write('#\r\n') @@ -697,7 +697,7 @@ all_video_tracks = sum(video_sets.values(), []) all_subtitles_tracks = sum(subtitles_sets.values(), []) - master_playlist_file = open(path.join(options.output_dir, options.hls_master_playlist_name), 'w+'); + master_playlist_file = open(path.join(options.output_dir, options.hls_master_playlist_name), 'wb+') master_playlist_file.write('#EXTM3U\r\n') master_playlist_file.write('# Created with Bento4 mp4-dash.py, VERSION=' + VERSION + '-' + SDK_REVISION+'\r\n') master_playlist_file.write('#\r\n')
View file
bento4-1.5.1r622.tar.gz/Source/Python/utils/mp4-hls.py -> bento4-1.5.1r623.tar.gz/Source/Python/utils/mp4-hls.py
Changed
@@ -27,13 +27,13 @@ # setup main options VERSION = "1.1.0" -SDK_REVISION = '622' +SDK_REVISION = '623' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += [SCRIPT_PATH] ############################################# def CreateSubtitlesPlaylist(playlist_filename, webvtt_filename, duration): - playlist = open(playlist_filename, 'w+') + playlist = open(playlist_filename, 'wb+') playlist.write('#EXTM3U\r\n') playlist.write('#EXT-X-TARGETDURATION:%d\r\n' % (duration)) playlist.write('#EXT-X-VERSION:3\r\n') @@ -183,17 +183,20 @@ file_extension = media_info.get('file_extension', 'ts') kwargs = { - 'index_filename': path.join(out_dir, 'stream.m3u8'), + 'index_filename': path.join(out_dir, options.media_playlist_name), 'segment_filename_template': path.join(out_dir, 'segment-%d.'+file_extension), 'segment_url_template': 'segment-%d.'+file_extension, 'show_info': True } + if options.base_url != "": + kwargs["segment_url_template"] = options.base_url+media_info["dir"]+'/'+'segment-%d.'+file_extension + if options.hls_version != 3: kwargs['hls_version'] = str(options.hls_version) if options.hls_version >= 4: - kwargs['iframe_index_filename'] = path.join(out_dir, 'iframes.m3u8') + kwargs['iframe_index_filename'] = path.join(out_dir, options.iframe_playlist_name) if options.output_single_file: kwargs['segment_filename_template'] = path.join(out_dir, 'media.'+file_extension) @@ -234,6 +237,7 @@ json_info = Mp42Hls(options, media_info['source'].filename, **kwargs) + media_info['info'] = json.loads(json_info, strict=False) if options.verbose: print json_info @@ -340,7 +344,7 @@ ProcessSource(options, audio_track.media_info, out_dir) # start the master playlist - master_playlist = open(path.join(options.output_dir, options.master_playlist_name), "w+") + master_playlist = open(path.join(options.output_dir, options.master_playlist_name), "wb+") master_playlist.write("#EXTM3U\r\n") master_playlist.write('# Created with Bento4 mp4-hls.py version '+VERSION+'r'+SDK_REVISION+'\r\n') @@ -402,7 +406,7 @@ audio_track.media_info['language_name'], audio_track.media_info['language'], extra_info, - audio_track.media_info['dir']+'/stream.m3u8')).encode('utf-8')) + options.base_url+audio_track.media_info['dir']+'/'+options.media_playlist_name)).encode('utf-8')) audio_groups.append({ 'name': group_name, 'codec': group_codec, @@ -457,7 +461,7 @@ ext_x_stream_inf += ',SUBTITLES="subtitles"' master_playlist.write(ext_x_stream_inf+'\r\n') - master_playlist.write(media['dir']+'/stream.m3u8\r\n') + master_playlist.write(options.base_url+media['dir']+'/'+options.media_playlist_name+'\r\n') # write the I-FRAME playlist info if not audio_only and options.hls_version >= 4: @@ -472,7 +476,7 @@ media_info['video']['codec'], int(media_info['video']['width']), int(media_info['video']['height']), - media['dir']+'/iframes.m3u8') + options.base_url+media['dir']+'/'+options.iframe_playlist_name) master_playlist.write(ext_x_i_frame_stream_inf+'\r\n') ############################################# @@ -510,6 +514,10 @@ help="HLS Version (default: 4)") parser.add_option('', '--master-playlist-name', dest="master_playlist_name", metavar="<filename>", default='master.m3u8', help="Master Playlist name") + parser.add_option('', '--media-playlist-name', dest="media_playlist_name", metavar="<name>", default='stream.m3u8', + help="Media Playlist name") + parser.add_option('', '--iframe-playlist-name', dest="iframe_playlist_name", metavar="<name>", default='iframes.m3u8', + help="I-frame Playlist name") parser.add_option('', '--output-single-file', dest="output_single_file", action='store_true', default=False, help="Store segment data in a single output file per input file") parser.add_option('', '--audio-format', dest="audio_format", default='packed', @@ -536,6 +544,8 @@ help="Output the encryption key to a file (default: don't output the key). This option is only valid when the encryption key format is 'identity'") parser.add_option('', "--exec-dir", metavar="<exec_dir>", dest="exec_dir", default=default_exec_dir, help="Directory where the Bento4 executables are located") + parser.add_option('', "--base-url", metavar="<base_url>", dest="base_url", default="", + help="The base URL for the Media Playlists and TS files listed in the playlists. This is the prefix for the files.") (options, args) = parser.parse_args() if len(args) == 0: parser.print_help() @@ -551,7 +561,7 @@ # check options if options.output_encryption_key: - if options.encryption_key_uri: + if options.encryption_key_uri != "key.bin": sys.stderr.write("WARNING: the encryption key will not be output because a non-default key URI was specified\n") options.output_encryption_key = False if not options.encryption_key:
View file
bento4-1.5.1r622.tar.gz/Source/Python/utils/mp4utils.py -> bento4-1.5.1r623.tar.gz/Source/Python/utils/mp4utils.py
Changed
@@ -550,6 +550,7 @@ for atom in self.tree: segment_size += atom['size'] if atom['name'] == 'moof': + segment_size = atom['size'] trafs = FilterChildren(atom, 'traf') if len(trafs) != 1: PrintErrorAndExit('ERROR: unsupported input file, more than one "traf" box in fragment') @@ -578,7 +579,6 @@ # remove the 'trun' entries to save some memory for traf in trafs: traf['children'] = [x for x in traf['children'] if x['name'] != 'trun'] - elif atom['name'] == 'mdat': # end of fragment on 'mdat' atom if track: @@ -589,7 +589,7 @@ segment_bitrate = 0 track.segment_bitrates.append(segment_bitrate) segment_size = 0 - + # parse the 'mfra' index if there is one and update segment durations. # this is needed to deal with input files that have an 'mfra' index that # does not exactly match the sample durations (because of rounding errors),
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.