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 13
View file
bento4.changes
Changed
@@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Sun Jan 13 09:15:40 UTC 2019 - aloisio@gmx.com + +- Update to version 1.5.1-628 +- Refreshed bento4-shared_library.patch + +------------------------------------------------------------------- Mon Jan 7 09:04:56 UTC 2019 - Luigi Baldoni <aloisio@gmx.com> - Update to version 1.5.1-627
View file
bento4.spec
Changed
@@ -16,10 +16,10 @@ # -%define _over 1.5.1-627 -%define _libver 1_5_1r627 +%define _over 1.5.1-628 +%define _libver 1_5_1r628 Name: bento4 -Version: 1.5.1r627 +Version: 1.5.1r628 Release: 0 Summary: C++ toolkit for all your MP4 and MPEG DASH media format needs License: GPL-2.0-or-later @@ -79,9 +79,15 @@ %files %doc README.md %{_bindir}/bento4-aac2mp4 +%{_bindir}/bento4-avcinfo +%{_bindir}/bento4-fixaacsampledescription +%{_bindir}/bento4-hevcinfo %{_bindir}/bento4-mp42aac +%{_bindir}/bento4-mp42avc +%{_bindir}/bento4-mp42hevc %{_bindir}/bento4-mp42hls %{_bindir}/bento4-mp42ts +%{_bindir}/bento4-mp4audioclip %{_bindir}/bento4-mp4compact %{_bindir}/bento4-mp4dcfpackager %{_bindir}/bento4-mp4decrypt @@ -94,6 +100,8 @@ %{_bindir}/bento4-mp4iframeindex %{_bindir}/bento4-mp4info %{_bindir}/bento4-mp4mux +%{_bindir}/bento4-mp4pssh +%{_bindir}/bento4-mp4rtphintinfo %{_bindir}/bento4-mp4split %{_bindir}/bento4-mp4tag
View file
bento4-shared_library.patch
Changed
@@ -1,7 +1,7 @@ -Index: Bento4-1.5.1-621/CMakeLists.txt +Index: Bento4-1.5.1-628/CMakeLists.txt =================================================================== ---- Bento4-1.5.1-621.orig/CMakeLists.txt -+++ Bento4-1.5.1-621/CMakeLists.txt +--- Bento4-1.5.1-628.orig/CMakeLists.txt ++++ Bento4-1.5.1-628/CMakeLists.txt @@ -27,13 +27,21 @@ file(GLOB AP4_SOURCES ${SOURCE_SYSTEM}/StdC/*.cpp ) @@ -26,7 +26,7 @@ # Includes include_directories( @@ -47,6 +55,11 @@ include_directories( - set(BENTO4_APPS "Aac2Mp4;Mp42Aac;Mp42Ts;Mp42Hls;Mp4Compact;Mp4DcfPackager;Mp4Decrypt;Mp4Dump;Mp4Edit;Mp4Encrypt;Mp4Extract;Mp4Fragment;Mp4Info;Mp4Mux;Mp4Split;Mp4Tag;Mp4Diff;Mp4IframeIndex") + file(GLOB BENTO4_APPS RELATIVE ${SOURCE_ROOT}/Apps ${SOURCE_ROOT}/Apps/*) foreach(app ${BENTO4_APPS}) string(TOLOWER ${app} binary_name) + string(CONCAT binary_name "bento4-" ${binary_name})
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4
Deleted
-(directory)
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4/__init__.py
Deleted
@@ -1,32 +0,0 @@ -from ctypes import * -import sys - -if sys.platform == 'darwin': - bento4dll = 'libBento4C.dylib' -else: - raise "Unsupported Platform" - -# library -lb4 = CDLL(bento4dll) - -# type mapping -Ap4Result = c_int -Ap4Flags = c_uint -Ap4Mask = c_uint -Ap4Cardinal = c_uint -Ap4Ordinal = c_uint -Ap4TimeStamp = c_uint -Ap4Duration = c_ulong -Ap4UI32 = c_uint -Ap4SI32 = c_int -Ap4UI16 = c_ushort -Ap4SI16 = c_short -Ap4UI08 = c_ubyte -Ap4Byte = c_byte -Ap4Size = c_ulong -Ap4UI64 = c_ulonglong -Ap4SI64 = c_longlong -Ap4LargeSize = c_ulonglong -Ap4Offset = c_longlong -Ap4Position = c_ulonglong -
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4/core.py
Deleted
@@ -1,612 +0,0 @@ -from bento4 import * -from bento4.errors import check_result -from ctypes import c_int, c_char_p, string_at -from struct import pack, unpack - -def atom_type(name): - return unpack('>I', pack('>4s', name))[0] - -def atom_name(type): - return unpack('>4s', pack('>I', type))[0] - -class File(object): - FILE_BRAND_QT__ = atom_type('qt ') - FILE_BRAND_ISOM = atom_type('isom') - FILE_BRAND_MP41 = atom_type('mp41') - FILE_BRAND_MP42 = atom_type('mp42') - FILE_BRAND_3GP1 = atom_type('3gp1') - FILE_BRAND_3GP2 = atom_type('3gp2') - FILE_BRAND_3GP3 = atom_type('3gp3') - FILE_BRAND_3GP4 = atom_type('3gp4') - FILE_BRAND_3GP5 = atom_type('3gp5') - FILE_BRAND_3G2A = atom_type('3g2a') - FILE_BRAND_MMP4 = atom_type('mmp4') - FILE_BRAND_M4A_ = atom_type('M4A ') - FILE_BRAND_M4P_ = atom_type('M4P ') - FILE_BRAND_MJP2 = atom_type('mjp2') - - def __init__(self, name='', movie=None): - self.moov = movie # can't have self.movie because movie is a property - if movie is None: - if len(name) == 0: - raise ValueError("name param cannot be empty") - result = Ap4Result() - self.bt4stream = lb4.AP4_FileByteStream_Create(c_char_p(name), - c_int(0), # read - byref(result)) - check_result(result.value) - self.bt4file = lb4.AP4_File_FromStream(self.bt4stream, 0) - else: - self.bt4file = lb4.AP4_File_Create(movie.bt4movie) - movie.bt4owner = False - movie.file = self - - def __del__(self): - lb4.AP4_File_Destroy(self.bt4file) - try: - lb4.AP4_Stream_Release(self.bt4stream) - except AttributeError: - pass # depending on how the object was created, - # self.bt4stream may or may not exist - - def inspect(self, inspector): - f = lb4.AP4_File_Inspect - f.restype = check_result - f(self.bt4file, inspector.bt4inspector) - - @property - def moov_is_before_mdat(self): - c = lb4.AP4_File_IsMoovBeforeMdat(self.bt4file) - return True if c !=0 else False - - @property - def movie(self): - if self.moov: - return self.moov - - bt4movie = lb4.AP4_File_GetMovie(self.bt4file) - if bt4movie is None: - return None - else: - self.moov = Movie(bt4movie=bt4movie) - self.moov.file = file # add a reference here for ref counting - return self.moov - - def get_type(self): - """returns a tuple (major_brand, minor_version, [compatible_brands])""" - major_brand = Ap4UI32() - minor_version = Ap4UI32() - compat = Ap4UI32() - compat_count = Ap4UI32() - - # get the file type - f = lb4.AP4_File_GetFileType - f.restype = check_result - f(self.bt4file, byref(major_brand), - byref(minor_version), byref(compat_count)) - - # get the compatible brands - f = lb4.AP4_File_GetCompatibleBrand - f.restype = check_result - compat_brands = [] - for i in xrange(compat_count.value): - f(self.bt4file, i, byref(compat)) - compat_brands += [compat.value] - return (major_brand.value, minor_version.value, compat_brands) - - def set_type(self, value): - """value: a tuple (major_brand, minor_version, [compatible_brands])""" - major_brand, minor_version, compat_brands = value - compat_count = len(compat_brands) - compat_brand_array = Ap4UI32*compat_count - f = lb4.AP4_File_SetFileType - f.restype = check_result - f(self.bt4file, major_brand, minor_version, - compat_brand_array(*compat_brands), compat_count) - - type = property(get_type, set_type) - - -class Movie(object): - - def __init__(self, timescale=0, bt4movie=None): - self.bt4owner = False - if bt4movie is None: - self.bt4movie = lb4.AP4_Movie_Create(Ap4UI32(timescale)) - else: - self.bt4movie = bt4movie - - def __del__(self): - if self.bt4owner: - lb4.AP4_Movie_Destroy(self.bt4movie) - - @property - def tracks(self): - result = {} - count = lb4.AP4_Movie_GetTrackCount(self.bt4movie) - for i in xrange(count): - bt4track = lb4.AP4_Movie_GetTrackByIndex(self.bt4movie, Ap4Ordinal(i)) - track = Track(bt4track=bt4track) - track.movie = self # add a reference here for ref counting - result[track.id] = track - return result - - @property - def duration(self): - return (lb4.AP4_Movie_GetDuration(self.bt4movie), - lb4.AP4_Movie_GetTimeScale(self.bt4movie)) - - def add_track(self, track): - result = lb4.AP4_Movie_AddTrack(self.bt4movie. track.bt4track) - if result.value != 0: - raise RuntimeError("Track insertion failed with error %d" % - result.value) - track.bt4owner = False # change ownership - track.movie = self - - -class Track(object): - TYPE_UNKNOWN = 0 - TYPE_AUDIO = 1 - TYPE_VIDEO = 2 - TYPE_SYSTEM = 3 - TYPE_HINT = 4 - TYPE_TEXT = 5 - TYPE_JPEG = 6 - TYPE_RTP = 7 - - HANDLER_TYPE_SOUN = atom_type('soun') - HANDLER_TYPE_VIDE = atom_type('vide') - HANDLER_TYPE_HINT = atom_type('hint') - HANDLER_TYPE_MDIR = atom_type('mdir') - HANDLER_TYPE_TEXT = atom_type('text') - HANDLER_TYPE_TX3G = atom_type('tx3g') - HANDLER_TYPE_JPEG = atom_type('jpeg') - HANDLER_TYPE_ODSM = atom_type('odsm') - HANDLER_TYPE_SDSM = atom_type('sdsm') - - def __init__(self, type=TYPE_UNKNOWN, sample_table=None, id=0, - track_duration=(), media_duration=(), language='', - dimensions=(), bt4track=None): - """durations are tuple: (duration, timescale) - track_duration is in the timescale of the movie""" - self.bt4owner = False - self.movie_timescale = -1 # invalid on purpose - if bt4track is None: - self.bt4owner = True - self.bt4track = lb4.AP4_Track_Create(c_int(type), - sample_table.bt4table, - Ap4UI32(id), - Ap4UI32(track_duration[1]), - Ap4UI32(track_duration[0]), - Ap4UI32(media_duration[1]), - Ap4UI32(media_duration[0]), - c_char_p(language), - Ap4UI32(width), - Ap4UI32(height)) - self.movie_timescale = track_duration[1] - sample_table.bt4owner = False # change the ownership - else: - self.bt4track = bt4track - - def __del__(self): - if self.bt4owner: - lb4.AP4_Track_Destroy(self.bt4track) - - @property - def type(self): - return lb4.AP4_Track_GetType(self.bt4track) -
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4/errors.py
Deleted
@@ -1,61 +0,0 @@ - -SUCCESS = 0 -FAILURE = -1 -ERROR_OUT_OF_MEMORY = -2 -ERROR_INVALID_PARAMETERS = -3 -ERROR_NO_SUCH_FILE = -4 -ERROR_PERMISSION_DENIED = -5 -ERROR_CANNOT_OPEN_FILE = -6 -ERROR_EOS = -7 -ERROR_WRITE_FAILED = -8 -ERROR_READ_FAILED = -9 -ERROR_INVALID_FORMAT = -10 -ERROR_NO_SUCH_ITEM = -11 -ERROR_OUT_OF_RANGE = -12 -ERROR_INTERNAL = -13 -ERROR_INVALID_STATE = -14 -ERROR_LIST_EMPTY = -15 -ERROR_LIST_OPERATION_ABORTED = -16 -ERROR_INVALID_RTP_CONSTRUCTOR_TYPE = -17 -ERROR_NOT_SUPPORTED = -18 -ERROR_INVALID_TRACK_TYPE = -19 -ERROR_INVALID_RTP_PACKET_EXTRA_DATA = -20 -ERROR_BUFFER_TOO_SMALL = -21 -ERROR_NOT_ENOUGH_DATA = -22 - -RESULT_EXCEPTION_MAP = { - FAILURE: (Exception, ''), - ERROR_OUT_OF_MEMORY: (MemoryError, ''), - ERROR_INVALID_PARAMETERS: (ValueError, 'Invalid parameter '), - ERROR_NO_SUCH_FILE: (IOError, 'No such file '), - ERROR_PERMISSION_DENIED: (IOError, 'Permission denied '), - ERROR_CANNOT_OPEN_FILE: (IOError, 'Cannot open file '), - ERROR_EOS: (EOFError, ''), - ERROR_WRITE_FAILED: (IOError, 'Write failed '), - ERROR_READ_FAILED: (IOError, 'Read failed '), - ERROR_INVALID_FORMAT: (ValueError, 'Invalid format '), - ERROR_NO_SUCH_ITEM: (LookupError, ''), - ERROR_OUT_OF_RANGE: (IndexError, ''), - ERROR_INTERNAL: (RuntimeError, 'Bento4 internal error '), - ERROR_INVALID_STATE: (RuntimeError, 'Bento4 invalid state'), - ERROR_LIST_EMPTY: (IndexError, 'List empty '), - ERROR_LIST_OPERATION_ABORTED: (RuntimeError, 'List operation aborted '), - ERROR_INVALID_RTP_CONSTRUCTOR_TYPE: (ValueError, 'Invalid RTP constructor type '), - ERROR_NOT_SUPPORTED: (NotImplementedError, ''), - ERROR_INVALID_TRACK_TYPE: (ValueError, 'Invalid track type '), - ERROR_INVALID_RTP_PACKET_EXTRA_DATA: (ValueError, 'Invalid Rtp packet extra data '), - ERROR_BUFFER_TOO_SMALL: (MemoryError, 'Buffer too small '), - ERROR_NOT_ENOUGH_DATA: (IOError, 'Not enough data ') -} - -def check_result(result, msg=''): - # shortcut - if result == SUCCESS: - return - try: - exception, msg_prefix = RESULT_EXCEPTION_MAP[result] - except KeyError: - raise RuntimeError("Bento4 unknown error: code %d" % result) - raise exception(msg_prefix+msg) - -
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4/inspectors.py
Deleted
@@ -1,170 +0,0 @@ -from bento4 import * -from ctypes import CFUNCTYPE, c_char_p, byref, c_int, c_float, string_at -from xml.etree.ElementTree import Element, SubElement -from base64 import b16encode - -class AtomInspector(object): - def __init__(self, bt4inspector): - self.bt4inspector = bt4inspector - super(AtomInspector, self).__init__() - - def __del__(self): - lb4.AP4_AtomInspector_Destroy(self.bt4inspector) - - -class PrintInspector(AtomInspector): - def __init__(self, stream): - self.stream = stream - bt4inspector = lb4.AP4_PrintInspector_Create(stream.bt4stream) - super(PrintInspector, self).__init__(bt4inspector) - -class InspectorDelegate(Structure): - pass - -start_element_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate), - c_char_p, c_char_p) - -end_element_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate)) - -add_int_field_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate), - c_char_p, Ap4UI64, c_int) - -add_float_field_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate), - c_char_p, c_float, c_int) - -add_string_field_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate), - c_char_p, c_char_p, c_int) - -add_bytes_field_proto = CFUNCTYPE(None, - POINTER(InspectorDelegate), - c_char_p, c_void_p, Ap4Size, c_int) - -InspectorDelegate._fields_ = [("start_element", start_element_proto), - ("end_element", end_element_proto), - ("add_int_field", add_int_field_proto), - ("add_float_field", add_float_field_proto), - ("add_string_field", add_string_field_proto), - ("add_bytes_field", add_bytes_field_proto), - ("destroy", c_void_p), # must be set to None - ("oid", c_int)] # object id - -# global dict of objects constructed with a delegate -pyinspector_objects = {} - -# -# redirection functions -# -def delegate_start_element(pdelegate, name, extra): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_start_element(name, extra) - -def delegate_end_element(pdelegate): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_end_element() - -def delegate_add_int_field(pdelegate, name, value, hint): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_add_int_field(name, value, hint) - -def delegate_add_float_field(pdelegate, name, value, hint): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_add_float_field(name, value, hint) - -def delegate_add_string_field(pdelegate, name, value, hint): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_add_string_field(name, value, hint) - -def delegate_add_bytes_field(pdelegate, name, bytes, byte_count, hint): - pyinspector = pyinspector_objects[pdelegate[0].oid] - pyinspector.c_add_bytes_field(name, bytes, byte_count, hint) - - -class PyInspector(AtomInspector): - - def __init__(self, pyinspector): - self.delegate = InspectorDelegate( - start_element=start_element_proto(delegate_start_element), - end_element=end_element_proto(delegate_end_element), - add_int_field=add_int_field_proto(delegate_add_int_field), - add_float_field=add_float_field_proto(delegate_add_float_field), - add_string_field=add_string_field_proto(delegate_add_string_field), - add_bytes_field=add_bytes_field_proto(delegate_add_bytes_field), - destroy=None, - oid=id(pyinspector)) - pyinspector_objects[id(pyinspector)] = pyinspector - bt4inspector = lb4.AP4_AtomInspector_FromDelegate(byref(self.delegate)) - super(PyInspector, self).__init__(bt4inspector) - - def c_start_element(self, name, extra): - pass - - def c_end_element(self): - pass - - def c_add_int_field(self, name, value, hint): - pass - - def c_add_float_field(self, name, value, hint): - pass - - def c_add_string_field(self, name, value, hint): - pass - - def c_add_bytes_field(self, name, bytes, byte_count, hint): - pass - - -class XmlInspector(PyInspector): - - def __init__(self): - self.root = Element("Mp4File") - self.current = (None, self.root) # parent, element - super(XmlInspector, self).__init__(self) - - def c_start_element(self, name, extra): - parent, element = self.current - new_element = SubElement(element, "Atom", name=name[1:-1]) - if extra: - a = extra.split('=') - if len(a) == 2: - new_element.attrib[a[0]] = a[1] - self.current = ((parent, element), new_element) - - def c_end_element(self): - (grandparent, parent), element = self.current - self.current = (grandparent, parent) - - def c_add_int_field(self, name, value, hint): - int_element = SubElement(self.current[1], "Field", - name=name, type='int') - int_element.text = str(value) - - def c_add_float_field(self, name, value, hint): - float_element = SubElement(self.current[1], "Field", - name=name, type='float') - float_element.text = str(value) - - def c_add_string_field(self, name, value, hint): - str_element = SubElement(self.current[1], "Field", - name=name, type='string') - str_element.text = value - - def c_add_bytes_field(self, name, bytes, byte_count, hint): - bytes_element = SubElement(self.current[1], "Field", - name=name, type='bytes') - bytes_element.text = b16encode(string_at(bytes, byte_count)) - - - - - - - - - -
View file
bento4-1.5.1r627.tar.gz/Source/Python/bento4/streams.py
Deleted
@@ -1,354 +0,0 @@ -from ctypes import c_int, c_double, c_char_p, byref, \ - CFUNCTYPE, POINTER, string_at -from bento4 import * -from bento4.errors import check_result, SUCCESS, ERROR_READ_FAILED, FAILURE, \ - ERROR_WRITE_FAILED, ERROR_EOS, ERROR_OUT_OF_RANGE, \ - ERROR_NOT_SUPPORTED - - -class ByteStream(object): - """abstract ByteStream class""" - - def __init__(self, bt4stream): - self.bt4stream = bt4stream - super(ByteStream, self).__init__() - - def __del__(self): - lb4.AP4_ByteStream_Release(self.bt4stream) - - @property - def size(self): - v = Ap4LargeSize() - f = lb4.AP4_ByteStream_GetSize - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_partial(self, bytes_to_read): - bytes_read = Ap4Size() - p = create_string_buffer(bytes_to_read) - f = lb4.AP4_ByteStream_ReadPartial - f.restype = check_result - f(self.bt4stream, p, Ap4Size(bytes_to_read), byref(bytes_read)) - return (p.raw, bytes_read.value) - - def read(self, bytes_to_read): - p = create_string_buffer(bytes_to_read) - f = lb4.AP4_ByteStream_Read - f.restype = check_result - f(self.bt4stream, p, Ap4Size(bytes_to_read)) - return p.raw - - def read_double(self): - v = c_double() - f = lb4.AP4_ByteStream_ReadDouble - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_ui64(self): - v = Ap4UI64() - f = lb4.AP4_ByteStream_ReadUI64 - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_ui32(self): - v = Ap4UI32() - f = lb4.AP4_ByteStream_ReadUI32 - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_ui24(self): - v = Ap4UI32() - f = lb4.AP4_ByteStream_ReadUI24 - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_ui16(self): - v = Ap4UI16() - f = lb4.AP4_ByteStream_ReadUI16 - f.restype = check_result - f(self.bt4stream, byref(v)) - return v.value - - def read_ui08(self): - v = Ap4UI08() - f = lb4.AP4_ByteStream_ReadUI08 - f.restype = check_result - f(self.straem, byref(v)) - return v.value - - def read_string(self, length): - p = create_string_buffer(length+1) - f = lb4.AP4_ByteStream_ReadString - f.restype = check_result - f(self.bt4stream, p, Ap4Size(length+1)) - return p.value - - def write_partial(self, buffer): - bytes_written = Ap4Size() - f = lb4.AP4_ByteStream_WritePartial - f.restype = check_result - f(self.bt4stream, c_char_p(buffer), - Ap4Size(len(buffer)),byref(bytes_written)) - return bytes_written - - def write(self, buffer): - f = lb4.AP4_ByteStream_Write - f.restype = check_result - f(self.bt4stream, c_char_p(buffer), Ap4Size(len(buffer))) - - - def write_double(self, value): - f = lb4.AP4_ByteStream_WriteDouble - f.restype = check_result - f(self.bt4stream, c_double(value)) - - def write_ui64(self, value): - f = lb4.AP4_ByteStream_WriteUI64 - f.restype = check_result - f(self.bt4stream, Ap4UI64(value)) - - def write_ui32(self, value): - f = lb4.AP4_ByteStream_WriteUI32 - f.restype = check_result - f(self.bt4stream, Ap4UI32(value)) - - def write_ui24(self, value): - f = lb4.AP4_ByteStream_WriteUI24 - f.restype = check_result - f(self.bt4stream, Ap4UI32(value)) - - def write_ui16(self, value): - f = lb4.AP4_ByteStream_WriteUI16 - f.restype = check_result - f(self.bt4stream, Ap4UI16(value)) - - def write_ui08(self, value): - f = lb4.AP4_ByteStream_WriteUI08 - f.restype = check_result - f(self.bt4stream, Ap4UI08(value)) - - def write_string(self, value): - f = lb4.AP4_ByteStream_Write - f.restype = check_result - f(self.bt4stream, c_char_p(buffer)) - - def copy_to(self, receiver, size): - f = lb4.AP4_ByteStream_CopyTo - f.restype = check_result - f(self.bt4stream, receiver.stream, AP4_Size(size)) - - def seek(self, position): - f = lb4.AP4_ByteStream_Seek - f.restype = check_result - f(self.bt4stream, Ap4Position(position)) - - def flush(self): - f = lb4.AP4_ByteStream_Flush - f.restype = check_result - f(self.bt4stream) - - def tell(self): - pos = Ap4Position() - f = lb4.AP4_ByteStream_Tell - f.restype = check_result - f(self.bt4stream, byref(pos)) - return pos.value - - -class MemoryByteStream(ByteStream): - - @staticmethod - def from_buffer(buffer): - """Factory method""" - buffer_size = Ap4Size(len(buffer)) - bt4stream = lb4.AP4_MemoryByteStream_FromBuffer(c_char_p(buffer), - buffer_size) - return MemoryByteStream(bt4stream=bt4stream) - - - def __init__(self, size=0, bt4stream=None): - if bt4stream is None: - bt4stream = lb4.AP4_MemoryByteStream_Create(Ap4Size(size)) - super(MemoryByteStream, self).__init__(bt4stream) - - -class FileByteStream(ByteStream): - MODE_READ = 0 - MODE_WRITE = 1 - MODE_READ_WRITE = 2 - - def __init__(self, name, mode): - result = Ap4Result(0) - f = lb4.AP4_FileByteStream_Create - bt4stream = f(c_char_p(name), c_int(mode), byref(result)) - check_result(result) - super(FileByteStream, self).__init__(bt4stream) - - -class ByteStreamDelegate(Structure): - pass - -read_partial_proto = CFUNCTYPE(Ap4Result, - POINTER(ByteStreamDelegate), - POINTER(Ap4Byte), - Ap4Size,
View file
bento4-1.5.1r627.tar.gz/.gitignore -> bento4-1.5.1r628.tar.gz/.gitignore
Changed
@@ -44,3 +44,4 @@ *.opendb Build/Targets/x86_64-microsoft-win32-vs2015/**/Debug/ Build/Targets/x86_64-microsoft-win32-vs2015/**/Release +IDEWorkspaceChecks.plist
View file
bento4-1.5.1r628.tar.gz/.lgtm.yml
Added
@@ -0,0 +1,6 @@ +path_classifiers: + docs: + - Documents + + test: + - Test
View file
bento4-1.5.1r627.tar.gz/Build/Build.scons -> bento4-1.5.1r628.tar.gz/Build/Build.scons
Changed
@@ -156,10 +156,9 @@ build_source_files = env['AP4_SYSTEM_SOURCES'], included_modules = 'Config') -for name in ['Mp4Dump', 'Mp4Info', 'Mp4Edit', 'Mp4Encrypt', 'Mp4Decrypt', 'Mp4Tag', 'Mp4Extract', 'Mp4RtpHintInfo', 'Mp42Aac', 'Mp42Avc', 'Mp42Hevc', 'Mp42Ts', 'Mp42Hls', 'Mp4DcfPackager', 'Mp4Fragment', 'Mp4Compact', 'Mp4Split', 'Mp4AudioClip', 'Mp4Mux', 'Mp4Diff', 'Mp4IframeIndex', 'AvcInfo', 'HevcInfo']: - Executable(name, source_dir='C++/Apps/'+name) +for dir in GlobSources('C++/Apps', ['*']): + Executable(os.path.basename(dir), source_dir=dir) -Executable('Aac2Mp4', source_dir='C++/Apps/Aac2Mp4') Executable('CryptoTest', source_dir='C++/Test/Crypto') Executable('AvcTrackWriterTest', source_dir='C++/Test/Avc') Executable('PassthroughWriterTest', source_dir='C++/Test/PassthroughWriter')
View file
bento4-1.5.1r627.tar.gz/Build/Targets/universal-apple-macosx/Bento4.xcodeproj/project.pbxproj -> bento4-1.5.1r628.tar.gz/Build/Targets/universal-apple-macosx/Bento4.xcodeproj/project.pbxproj
Changed
@@ -4303,6 +4303,7 @@ 1DEB91F008733DB70010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -4349,6 +4350,7 @@ 1DEB91F108733DB70010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES;
View file
bento4-1.5.1r627.tar.gz/Build/Targets/x86-microsoft-win32-vs2010/Build.py -> bento4-1.5.1r628.tar.gz/Build/Targets/x86-microsoft-win32-vs2010/Build.py
Changed
@@ -7,7 +7,6 @@ """ -import os import sys import getopt import subprocess @@ -81,7 +80,7 @@ buildSwitch = 'build' if rebuildAll: buildSwitch = 'rebuild' elif makeClean: buildSwitch = 'clean' - + cmd_list = ['%s/devenv.com' % VSBINDIR, '/%s' % buildSwitch, buildName, solutionFile] cmd = " ".join(cmd_list) print 'Executing:'
View file
bento4-1.5.1r627.tar.gz/Build/Targets/x86_64-microsoft-win32-vs2015/Build.py -> bento4-1.5.1r628.tar.gz/Build/Targets/x86_64-microsoft-win32-vs2015/Build.py
Changed
@@ -7,7 +7,6 @@ """ -import os import sys import getopt import subprocess @@ -81,7 +80,7 @@ buildSwitch = 'build' if rebuildAll: buildSwitch = 'rebuild' elif makeClean: buildSwitch = 'clean' - + cmd_list = ['%s/devenv.com' % VSBINDIR, '/%s' % buildSwitch, buildName, solutionFile] cmd = " ".join(cmd_list) print 'Executing:'
View file
bento4-1.5.1r627.tar.gz/CMakeLists.txt -> bento4-1.5.1r628.tar.gz/CMakeLists.txt
Changed
@@ -4,7 +4,7 @@ project(bento4) # Variables -set(SOURCE_ROOT Source/C++) +set(SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Source/C++) set(SOURCE_CODECS ${SOURCE_ROOT}/Codecs) set(SOURCE_CORE ${SOURCE_ROOT}/Core) set(SOURCE_CRYPTO ${SOURCE_ROOT}/Crypto) @@ -44,7 +44,7 @@ ) # Apps -set(BENTO4_APPS "Aac2Mp4;Mp42Aac;Mp42Ts;Mp42Hls;Mp4Compact;Mp4DcfPackager;Mp4Decrypt;Mp4Dump;Mp4Edit;Mp4Encrypt;Mp4Extract;Mp4Fragment;Mp4Info;Mp4Mux;Mp4Split;Mp4Tag;Mp4Diff;Mp4IframeIndex") +file(GLOB BENTO4_APPS RELATIVE ${SOURCE_ROOT}/Apps ${SOURCE_ROOT}/Apps/*) foreach(app ${BENTO4_APPS}) string(TOLOWER ${app} binary_name) add_executable(${binary_name} ${SOURCE_ROOT}/Apps/${app}/${app}.cpp)
View file
bento4-1.5.1r627.tar.gz/README.md -> bento4-1.5.1r628.tar.gz/README.md
Changed
@@ -1,9 +1,11 @@ -Bento4 +Bento4 ===== [![Build Status](https://travis-ci.org/axiomatic-systems/Bento4.svg?branch=master)](https://travis-ci.org/axiomatic-systems/Bento4.svg?branch=master) +[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/cpp/g/axiomatic-systems/Bento4.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/axiomatic-systems/Bento4/context:cpp) +[![Total Alerts](https://img.shields.io/lgtm/alerts/g/axiomatic-systems/Bento4.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/axiomatic-systems/Bento4/alerts) -Bento4 is a C++ class library and tools designed to read and write ISO-MP4 files. -This format is defined in international specifications ISO/IEC 14496-12, 14496-14 and 14496-15. +Bento4 is a C++ class library and tools designed to read and write ISO-MP4 files. +This format is defined in international specifications ISO/IEC 14496-12, 14496-14 and 14496-15. The format is a derivative of the Apple Quicktime file format, so Bento4 can be used to read and write most Quicktime files as well. Visit [www.bento4.com](http://www.bento4.com) for details @@ -121,4 +123,3 @@ For Release builds: ```make AP4_BUILD_CONFIG=Release``` -
View file
bento4-1.5.1r627.tar.gz/Scripts/ExportSourceTree.py -> bento4-1.5.1r628.tar.gz/Scripts/ExportSourceTree.py
Changed
@@ -4,7 +4,7 @@ import os import shutil import re - + ############################################################# # GetSdkRevision ############################################################# @@ -51,7 +51,7 @@ BENTO4_VERSION = GetVersion() SDK_REVISION = GetSdkRevision() -if SDK_REVISION == None: +if SDK_REVISION is None: sys.exit(1) print "Exporting Revision", SDK_REVISION @@ -59,7 +59,7 @@ SDK_NAME='Bento4-SRC-'+BENTO4_VERSION+'-'+SDK_REVISION SDK_OUTPUT_ROOT=BENTO4_HOME+'/SDK' SDK_ROOT=SDK_OUTPUT_ROOT+'/'+SDK_NAME - + print SDK_NAME # remove any previous SDK directory @@ -71,7 +71,7 @@ os.makedirs(SDK_OUTPUT_ROOT) ### export -cmd = 'git archive --format=zip HEAD -o '+SDK_ROOT+'.zip' +cmd = 'git archive --format=zip HEAD -o '+SDK_ROOT+'.zip' print cmd #cmd = 'svn export -r'+SDK_REVISION+' https://zebulon.bok.net/svn/Bento4/trunk '+SDK_NAME os.system(cmd)
View file
bento4-1.5.1r627.tar.gz/Scripts/SdkPackager.py -> bento4-1.5.1r628.tar.gz/Scripts/SdkPackager.py
Changed
@@ -13,8 +13,6 @@ import sys import os import shutil -import glob -import datetime import fnmatch import zipfile import re
View file
bento4-1.5.1r627.tar.gz/Scripts/SdkPrepForRelease.py -> bento4-1.5.1r628.tar.gz/Scripts/SdkPrepForRelease.py
Changed
@@ -12,8 +12,6 @@ import sys import os -import shutil -import platform ############################################################# # Main
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp42Aac/Mp42Aac.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp42Aac/Mp42Aac.cpp
Changed
@@ -273,8 +273,8 @@ // show info AP4_Debug("Audio Track:\n"); - AP4_Debug(" duration: %ld ms\n", audio_track->GetDurationMs()); - AP4_Debug(" sample count: %ld\n", audio_track->GetSampleCount()); + AP4_Debug(" duration: %u ms\n", (int)audio_track->GetDurationMs()); + AP4_Debug(" sample count: %u\n", (int)audio_track->GetSampleCount()); switch (sample_description->GetType()) { case AP4_SampleDescription::TYPE_MPEG: {
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp42Avc/Mp42Avc.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp42Avc/Mp42Avc.cpp
Changed
@@ -331,8 +331,8 @@ // show info AP4_Debug("Video Track:\n"); - AP4_Debug(" duration: %ld ms\n", video_track->GetDurationMs()); - AP4_Debug(" sample count: %ld\n", video_track->GetSampleCount()); + AP4_Debug(" duration: %u ms\n", (int)video_track->GetDurationMs()); + AP4_Debug(" sample count: %u\n", (int)video_track->GetSampleCount()); switch (sample_description->GetType()) { case AP4_SampleDescription::TYPE_AVC:
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp42Hevc/Mp42Hevc.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp42Hevc/Mp42Hevc.cpp
Changed
@@ -398,8 +398,8 @@ // show info AP4_Debug("Video Track:\n"); - AP4_Debug(" duration: %ld ms\n", video_track->GetDurationMs()); - AP4_Debug(" sample count: %ld\n", video_track->GetSampleCount()); + AP4_Debug(" duration: %u ms\n", (int)video_track->GetDurationMs()); + AP4_Debug(" sample count: %u\n", (int)video_track->GetSampleCount()); switch (sample_description->GetType()) { case AP4_SampleDescription::TYPE_HEVC:
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp
Changed
@@ -2,7 +2,7 @@ | | AP4 - MP4 to HLS File Converter | -| Copyright 2002-2015 Axiomatic Systems, LLC +| Copyright 2002-2018 Axiomatic Systems, LLC | | | This file is part of Bento4/AP4 (MP4 Atom Processing Library). @@ -39,9 +39,9 @@ /*---------------------------------------------------------------------- | constants +---------------------------------------------------------------------*/ -#define BANNER "MP4 To HLS File Converter - Version 1.1\n"\ +#define BANNER "MP4 To HLS File Converter - Version 1.2\n"\ "(Bento4 Version " AP4_VERSION_STRING ")\n"\ - "(c) 2002-2015 Axiomatic Systems, LLC" + "(c) 2002-2018 Axiomatic Systems, LLC" /*---------------------------------------------------------------------- | options @@ -91,6 +91,7 @@ const char* encryption_key_format; const char* encryption_key_format_versions; AP4_Array<AP4_String> encryption_key_lines; + AP4_UI64 pcr_offset; } Options; static struct _Stats { @@ -143,6 +144,7 @@ " Target segment duration in seconds (default: 6)\n" " --segment-duration-threshold <t>\n" " Segment duration threshold in milliseconds (default: 15)\n" + " --pcr-offset <offset> in units of 90kHz (default 10000)\n" " --index-filename <filename>\n" " Filename to use for the playlist/index (default: stream.m3u8)\n" " --segment-filename-template <pattern>\n" @@ -1551,6 +1553,7 @@ Options.encryption_key_uri = "key.bin"; Options.encryption_key_format = NULL; Options.encryption_key_format_versions = NULL; + Options.pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET; AP4_SetMemory(Options.encryption_key, 0, sizeof(Options.encryption_key)); AP4_SetMemory(Options.encryption_iv, 0, sizeof(Options.encryption_iv)); AP4_SetMemory(&Stats, 0, sizeof(Stats)); @@ -1639,6 +1642,12 @@ return 1; } Options.video_track_id = (unsigned int)strtoul(*args++, NULL, 10); + } else if (!strcmp(arg, "--pcr-offset")) { + if (*args == NULL) { + fprintf(stderr, "ERROR: --pcr-offset requires a number\n"); + return 1; + } + Options.pcr_offset = (unsigned int)strtoul(*args++, NULL, 10); } else if (!strcmp(arg, "--output-single-file")) { Options.output_single_file = true; } else if (!strcmp(arg, "--index-filename")) { @@ -2014,8 +2023,8 @@ stream_id, audio_stream, Options.audio_pid, - NULL, - 0); + NULL, 0, + Options.pcr_offset); if (AP4_FAILED(result)) { fprintf(stderr, "could not create audio stream (%d)\n", result); goto end; @@ -2072,8 +2081,8 @@ stream_id, video_stream, Options.video_pid, - NULL, - 0); + NULL, 0, + Options.pcr_offset); if (AP4_FAILED(result)) { fprintf(stderr, "could not create video stream (%d)\n", result); goto end;
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp
Changed
@@ -37,9 +37,9 @@ /*---------------------------------------------------------------------- | constants +---------------------------------------------------------------------*/ -#define BANNER "MP4 To MPEG2-TS File Converter - Version 1.2\n"\ +#define BANNER "MP4 To MPEG2-TS File Converter - Version 1.3\n"\ "(Bento4 Version " AP4_VERSION_STRING ")\n"\ - "(c) 2002-2014 Axiomatic Systems, LLC" + "(c) 2002-2018 Axiomatic Systems, LLC" /*---------------------------------------------------------------------- | options @@ -55,6 +55,7 @@ const char* output; unsigned int segment_duration; unsigned int segment_duration_threshold; + unsigned int pcr_offset; } Options; /*---------------------------------------------------------------------- @@ -80,6 +81,7 @@ " like \"seg-%cd.ts\"]\n" " --segment-duration-threshold in ms (default = 50)\n" " [only used with the --segment option]\n" + " --pcr-offset <offset> in units of 90kHz (default 10000)\n" " --verbose\n" " --playlist <filename>\n" " --playlist-hls-version <n> (default=3)\n" @@ -417,6 +419,7 @@ Options.input = NULL; Options.output = NULL; Options.segment_duration_threshold = DefaultSegmentDurationThreshold; + Options.pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET; // parse command line AP4_Result result; @@ -454,6 +457,12 @@ return 1; } Options.video_pid = (unsigned int)strtoul(*args++, NULL, 10); + } else if (!strcmp(arg, "--pcr-offset")) { + if (*args == NULL) { + fprintf(stderr, "ERROR: --pcr-offset requires a number\n"); + return 1; + } + Options.pcr_offset = (unsigned int)strtoul(*args++, NULL, 10); } else if (!strcmp(arg, "--playlist")) { if (*args == NULL) { fprintf(stderr, "ERROR: --playlist requires a filename\n"); @@ -575,7 +584,9 @@ stream_type, stream_id, audio_stream, - Options.audio_pid); + Options.audio_pid, + NULL, 0, + Options.pcr_offset); if (AP4_FAILED(result)) { fprintf(stderr, "could not create audio stream (%d)\n", result); goto end; @@ -613,7 +624,9 @@ stream_type, stream_id, video_stream, - Options.video_pid); + Options.video_pid, + NULL, 0, + Options.pcr_offset); if (AP4_FAILED(result)) { fprintf(stderr, "could not create video stream (%d)\n", result); goto end;
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp
Changed
@@ -303,7 +303,7 @@ Fragment(AP4_File& input_file, AP4_ByteStream& output_stream, AP4_Array<TrackCursor*>& cursors, - unsigned int fragment_duration, + AP4_UI32 fragment_duration, AP4_UI32 timescale, bool create_segment_index, bool copy_udta) @@ -521,7 +521,7 @@ cursor->m_Track->GetMediaTimeScale()); if (target_dts <= cursor->m_Sample.GetDts()) { // we must be at the end, past the last anchor sample, just use the target duration - target_dts = AP4_ConvertTime(fragment_duration*(cursor->m_FragmentIndex+1), + target_dts = AP4_ConvertTime((AP4_UI64)fragment_duration*(cursor->m_FragmentIndex+1), 1000, cursor->m_Track->GetMediaTimeScale());
View file
bento4-1.5.1r627.tar.gz/Source/C++/Apps/Mp4Pssh/Mp4Pssh.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Apps/Mp4Pssh/Mp4Pssh.cpp
Changed
@@ -87,6 +87,10 @@ } } + ~Command() { + delete m_Pssh; + } + // members Type m_Type; AP4_UI08 m_SystemId[16]; @@ -281,7 +285,7 @@ buffer.SetDataSize((AP4_UI32)file_size); result = input->Read(buffer.UseData(), (AP4_UI32)file_size); - if (file_size > MP4_PSSH_MAX_DATA_SIZE) { + if (AP4_FAILED(result)) { fprintf(stderr, "ERROR: failed to read data from file (%d)\n", result); input->Release(); return result;
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4ByteStream.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4ByteStream.cpp
Changed
@@ -38,7 +38,6 @@ | constants +---------------------------------------------------------------------*/ const int AP4_BYTE_STREAM_COPY_BUFFER_SIZE = 65536; -const int AP4_MEMORY_BYTE_STREAM_MAX_SIZE = 0x4000000; // 64 megs /*---------------------------------------------------------------------- | AP4_ByteStream::Read @@ -759,11 +758,6 @@ return AP4_SUCCESS; } - // check that we don't exceed the max - if (m_Position+bytes_to_write > (AP4_Position)AP4_MEMORY_BYTE_STREAM_MAX_SIZE) { - return AP4_ERROR_OUT_OF_RANGE; - } - // reserve space in the buffer AP4_Size space_needed = (AP4_Size)(m_Position+bytes_to_write); AP4_Result result = m_Buffer->Reserve(space_needed);
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp
Changed
@@ -309,6 +309,7 @@ AP4_CencCbcsSubSampleMapper::~AP4_CencCbcsSubSampleMapper() { delete m_AvcParser; + delete m_HevcParser; } /*----------------------------------------------------------------------
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4FragmentSampleTable.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4FragmentSampleTable.cpp
Changed
@@ -261,7 +261,7 @@ AP4_SampleDescription* AP4_FragmentSampleTable::GetSampleDescription(AP4_Ordinal /*index*/) { - return NULL; // FIXME + return NULL; // TODO } /*---------------------------------------------------------------------- @@ -270,7 +270,7 @@ AP4_Cardinal AP4_FragmentSampleTable::GetSampleDescriptionCount() { - return 1; // FIXME + return 1; // TODO } /*---------------------------------------------------------------------- @@ -294,7 +294,7 @@ AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /*ts*/, AP4_Ordinal& sample_index) { - sample_index = 0; // FIXME + sample_index = 0; // TODO return AP4_SUCCESS; } @@ -304,6 +304,6 @@ AP4_Ordinal AP4_FragmentSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal /*sample_index*/, bool /*before*/) { - return 0; // FIXME + return 0; // TODO }
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4HdlrAtom.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4HdlrAtom.cpp
Changed
@@ -130,7 +130,7 @@ result = stream.WriteUI08(name_size - 1); if (AP4_FAILED(result)) return result; - result = stream.Write(m_HandlerName.GetChars(), name_size); + result = stream.Write(m_HandlerName.GetChars(), name_size - 1); if (AP4_FAILED(result)) return result; } } else {
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4Marlin.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4Marlin.cpp
Changed
@@ -353,7 +353,7 @@ AP4_BlockCipherFactory* block_cipher_factory, AP4_MarlinIpmpSampleDecrypter*& sample_decrypter) { - // FIXME: need to parse group key info + // TODO: need to parse group key info return Create(key, key_size, block_cipher_factory, sample_decrypter); } @@ -730,7 +730,7 @@ // create an initial object descriptor AP4_InitialObjectDescriptor* iod = - // FIXME: get real values from the property map + // TODO: get real values from the property map new AP4_InitialObjectDescriptor(AP4_DESCRIPTOR_TAG_MP4_IOD, 1022, // object descriptor id false,
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4Mpeg2Ts.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4Mpeg2Ts.cpp
Changed
@@ -285,9 +285,9 @@ unsigned int pes_header_size = 14+(with_dts?5:0); AP4_BitWriter pes_header(pes_header_size); - // adjust the base timestamp so we don't start at 0 - // dts += 10000; - // pts += 10000; + // adjust the base timestamp, offset from the PCR + dts += m_PcrOffset; + pts += m_PcrOffset; pes_header.Write(0x000001, 24); // packet_start_code_prefix pes_header.Write(m_StreamId, 8); // stream_id @@ -332,7 +332,7 @@ if (payload_size > AP4_MPEG2TS_PACKET_PAYLOAD_SIZE) payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE; if (first_packet) { - WritePacketHeader(first_packet, payload_size, with_pcr, (with_dts?dts:pts)*300, output); + WritePacketHeader(first_packet, payload_size, with_pcr, ((with_dts?dts:pts)-m_PcrOffset)*300, output); first_packet = false; output.Write(pes_header.GetData(), pes_header_size); output.Write(data, payload_size-pes_header_size); @@ -360,7 +360,8 @@ AP4_UI16 stream_id, AP4_Mpeg2TsWriter::SampleStream*& stream, const AP4_UI08* descriptor, - AP4_Size descriptor_length); + AP4_Size descriptor_length, + AP4_UI64 pcr_offset); AP4_Result WriteSample(AP4_Sample& sample, AP4_DataBuffer& sample_data, AP4_SampleDescription* sample_description, @@ -373,13 +374,15 @@ AP4_UI08 stream_type, AP4_UI16 stream_id, const AP4_UI08* descriptor, - AP4_Size descriptor_length) : + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) : AP4_Mpeg2TsWriter::SampleStream(pid, stream_type, stream_id, timescale, descriptor, - descriptor_length) {} + descriptor_length, + pcr_offset) {} }; /*---------------------------------------------------------------------- @@ -392,9 +395,10 @@ AP4_UI16 stream_id, AP4_Mpeg2TsWriter::SampleStream*& stream, const AP4_UI08* descriptor, - AP4_Size descriptor_length) + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) { - stream = new AP4_Mpeg2TsAudioSampleStream(pid, timescale, stream_type, stream_id, descriptor, descriptor_length); + stream = new AP4_Mpeg2TsAudioSampleStream(pid, timescale, stream_type, stream_id, descriptor, descriptor_length, pcr_offset); return AP4_SUCCESS; } @@ -469,7 +473,8 @@ AP4_UI16 stream_id, AP4_Mpeg2TsWriter::SampleStream*& stream, const AP4_UI08* descriptor, - AP4_Size descriptor_length); + AP4_Size descriptor_length, + AP4_UI64 pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET); AP4_Result WriteSample(AP4_Sample& sample, AP4_DataBuffer& sample_data, AP4_SampleDescription* sample_description, @@ -482,13 +487,15 @@ AP4_UI08 stream_type, AP4_UI16 stream_id, const AP4_UI08* descriptor, - AP4_Size descriptor_size) : + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) : AP4_Mpeg2TsWriter::SampleStream(pid, stream_type, stream_id, timescale, descriptor, - descriptor_size), + descriptor_length, + pcr_offset), m_SampleDescriptionIndex(-1), m_NaluLengthSize(0), m_SamplesWritten(0) {} @@ -509,10 +516,11 @@ AP4_UI16 stream_id, AP4_Mpeg2TsWriter::SampleStream*& stream, const AP4_UI08* descriptor, - AP4_Size descriptor_length) + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) { // create the stream object - stream = new AP4_Mpeg2TsVideoSampleStream(pid, timescale, stream_type, stream_id, descriptor, descriptor_length); + stream = new AP4_Mpeg2TsVideoSampleStream(pid, timescale, stream_type, stream_id, descriptor, descriptor_length, pcr_offset); return AP4_SUCCESS; } @@ -867,7 +875,8 @@ SampleStream*& stream, AP4_UI16 pid, const AP4_UI08* descriptor, - AP4_Size descriptor_length) + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) { // default stream = NULL; @@ -878,7 +887,8 @@ stream_id, m_Audio, descriptor, - descriptor_length); + descriptor_length, + pcr_offset); if (AP4_FAILED(result)) return result; stream = m_Audio; return AP4_SUCCESS; @@ -894,7 +904,8 @@ SampleStream*& stream, AP4_UI16 pid, const AP4_UI08* descriptor, - AP4_Size descriptor_length) + AP4_Size descriptor_length, + AP4_UI64 pcr_offset) { // default stream = NULL; @@ -905,7 +916,8 @@ stream_id, m_Video, descriptor, - descriptor_length); + descriptor_length, + pcr_offset); if (AP4_FAILED(result)) return result; stream = m_Video; return AP4_SUCCESS;
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4Mpeg2Ts.h -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4Mpeg2Ts.h
Changed
@@ -59,6 +59,8 @@ const AP4_UI08 AP4_MPEG2_STREAM_TYPE_ATSC_AC3 = 0x81; const AP4_UI08 AP4_MPEG2_STREAM_TYPE_ATSC_EAC3 = 0x81; +const AP4_UI64 AP4_MPEG2_TS_DEFAULT_PCR_OFFSET = 10000; + /*---------------------------------------------------------------------- | AP4_Mpeg2TsWriter +---------------------------------------------------------------------*/ @@ -92,11 +94,18 @@ class SampleStream : public Stream { public: - SampleStream(AP4_UI16 pid, AP4_UI08 stream_type, AP4_UI16 stream_id, AP4_UI32 timescale, const AP4_UI08* descriptor, AP4_Size descriptor_length) : + SampleStream(AP4_UI16 pid, + AP4_UI08 stream_type, + AP4_UI16 stream_id, + AP4_UI32 timescale, + const AP4_UI08* descriptor, + AP4_Size descriptor_length, + AP4_UI64 pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET) : Stream(pid), m_StreamType(stream_type), m_StreamId(stream_id), - m_TimeScale(timescale) { + m_TimeScale(timescale), + m_PcrOffset(pcr_offset) { if (descriptor && descriptor_length) { m_Descriptor.SetData(descriptor, descriptor_length); } @@ -132,6 +141,7 @@ AP4_UI16 m_StreamId; AP4_UI32 m_TimeScale; AP4_DataBuffer m_Descriptor; + AP4_UI64 m_PcrOffset; }; // constructor @@ -148,14 +158,16 @@ SampleStream*& stream, AP4_UI16 pid = AP4_MPEG2_TS_DEFAULT_PID_AUDIO, const AP4_UI08* descriptor = NULL, - AP4_Size descriptor_length = 0); + AP4_Size descriptor_length = 0, + AP4_UI64 pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET); AP4_Result SetVideoStream(AP4_UI32 timescale, AP4_UI08 stream_type, AP4_UI16 stream_id, SampleStream*& stream, AP4_UI16 pid = AP4_MPEG2_TS_DEFAULT_PID_VIDEO, const AP4_UI08* descriptor = NULL, - AP4_Size descriptor_length = 0); + AP4_Size descriptor_length = 0, + AP4_UI64 pcr_offset = AP4_MPEG2_TS_DEFAULT_PCR_OFFSET); private: Stream* m_PAT;
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4SampleDescription.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4SampleDescription.cpp
Changed
@@ -207,7 +207,7 @@ +---------------------------------------------------------------------*/ AP4_UnknownSampleDescription::AP4_UnknownSampleDescription(AP4_Atom* atom) : AP4_SampleDescription(AP4_SampleDescription::TYPE_UNKNOWN, - atom->GetType(), + atom->GetType(), NULL), m_Atom(atom->Clone()) { @@ -230,10 +230,10 @@ AP4_Atom* atom_clone = NULL; if (m_Atom) { atom_clone = m_Atom->Clone(); - if (atom_clone == NULL) { - if (result) *result = AP4_FAILURE; - return NULL; - } + } + if (atom_clone == NULL) { + if (result) *result = AP4_FAILURE; + return NULL; } if (result) *result = AP4_SUCCESS; return new AP4_UnknownSampleDescription(atom_clone);
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4SegmentBuilder.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4SegmentBuilder.cpp
Changed
@@ -29,7 +29,6 @@ /*---------------------------------------------------------------------- | includes +---------------------------------------------------------------------*/ -#include <stdio.h> // FIXME: testing #include "Ap4SegmentBuilder.h" #include "Ap4Results.h" #include "Ap4ByteStream.h"
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4String.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4String.cpp
Changed
@@ -100,7 +100,7 @@ const AP4_String& AP4_String::operator=(const AP4_String& s) { - if (&s == this) return s; + if (&s == this) return *this; if (m_Chars != &EmptyString) delete[] m_Chars; m_Length = s.m_Length; m_Chars = new char[m_Length+1];
View file
bento4-1.5.1r627.tar.gz/Source/C++/Core/Ap4SttsAtom.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/Core/Ap4SttsAtom.cpp
Changed
@@ -134,7 +134,7 @@ // update the sample and dts bases sample_start += entry.m_SampleCount; - dts_start += entry.m_SampleCount*entry.m_SampleDuration; + dts_start += (AP4_UI64)entry.m_SampleCount * (AP4_UI64)entry.m_SampleDuration; } // sample is greater than the number of samples
View file
bento4-1.5.1r627.tar.gz/Source/C++/MetaData/Ap4MetaData.cpp -> bento4-1.5.1r628.tar.gz/Source/C++/MetaData/Ap4MetaData.cpp
Changed
@@ -783,6 +783,27 @@ // not supported return AP4_ERROR_NOT_SUPPORTED; + } else if (m_Key.GetNamespace() == "3gpp") { + // convert the name into an atom type + if (m_Key.GetName().GetLength() != 4) { + // the name is not in the right format + return AP4_ERROR_INVALID_PARAMETERS; + } + AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars()); + + if (AP4_MetaDataAtomTypeHandler::IsTypeInList(atom_type, + AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypeList)) { + AP4_String atom_value = m_Value->ToString(); + const char* language = "eng"; // default + if (m_Value->GetLanguage().GetLength() != 0) { + language = m_Value->GetLanguage().GetChars(); + } + atom = new AP4_3GppLocalizedStringAtom(atom_type, language, atom_value.GetChars()); + return AP4_SUCCESS; + } + + // not supported + return AP4_ERROR_NOT_SUPPORTED; } else { // create a '----' atom AP4_ContainerAtom* container = new AP4_ContainerAtom(AP4_ATOM_TYPE_dddd); @@ -847,16 +868,18 @@ AP4_Atom* atom; AP4_Result result = ToAtom(atom); if (AP4_FAILED(result)) return result; - AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom); - if (entry_atom == NULL) { - return AP4_ERROR_INVALID_FORMAT; - } // look for the 'moov' AP4_Movie* movie = file.GetMovie(); - if (movie == NULL) return AP4_ERROR_INVALID_FORMAT; + if (movie == NULL) { + delete atom; + return AP4_ERROR_INVALID_FORMAT; + } AP4_MoovAtom* moov = movie->GetMoovAtom(); - if (moov == NULL) return AP4_ERROR_INVALID_FORMAT; + if (moov == NULL) { + delete atom; + return AP4_ERROR_INVALID_FORMAT; + } // look for 'udta', and create if it does not exist AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta", true)); @@ -884,10 +907,21 @@ // look if there is already a container for this entry AP4_ContainerAtom* existing = FindInIlst(ilst); if (existing == NULL) { + // look for a simple entry with the same type + AP4_Atom* previous = ilst->GetChild(atom->GetType()); + if (previous) { + ilst->RemoveChild(previous); + } + // just add the one we have - ilst->AddChild(entry_atom); + ilst->AddChild(atom); } else { // add the entry's data to the existing entry + AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom); + if (entry_atom == NULL) { + return AP4_ERROR_INVALID_FORMAT; + } + AP4_DataAtom* data_atom = AP4_DYNAMIC_CAST(AP4_DataAtom, entry_atom->GetChild(AP4_ATOM_TYPE_DATA)); if (data_atom == NULL) return AP4_ERROR_INTERNAL; entry_atom->RemoveChild(data_atom); @@ -925,6 +959,39 @@ } /*---------------------------------------------------------------------- +| AP4_MetaData::Entry::AddToFileUdta ++---------------------------------------------------------------------*/ +AP4_Result +AP4_MetaData::Entry::AddToFileUdta(AP4_File& file, AP4_Ordinal index) +{ + // check that we have a correct entry + if (m_Value == NULL) return AP4_ERROR_INVALID_STATE; + + // convert the entry into an atom + AP4_Atom* atom; + AP4_Result result = ToAtom(atom); + if (AP4_FAILED(result)) return result; + + // look for the 'moov' + AP4_Movie* movie = file.GetMovie(); + if (movie == NULL) return AP4_ERROR_INVALID_FORMAT; + AP4_MoovAtom* moov = movie->GetMoovAtom(); + if (moov == NULL) return AP4_ERROR_INVALID_FORMAT; + + // look for 'udta', and create if it does not exist + AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta", true)); + if (udta == NULL) return AP4_ERROR_INTERNAL; + + // convert the entry into an atom + AP4_Atom* data_atom; + result = ToAtom(data_atom); + if (AP4_FAILED(result)) return result; + + // add the entry's data to the container + return udta->AddChild(data_atom, index); +} + +/*---------------------------------------------------------------------- | AP4_MetaData::Entry::AddToFile +---------------------------------------------------------------------*/ AP4_Result @@ -938,6 +1005,8 @@ return AddToFileIlst(file, index); } else if (m_Key.GetNamespace() == "dcf") { return AddToFileDcf(file, index); + } else if (m_Key.GetNamespace() == "3gpp") { + return AddToFileUdta(file, index); } else { // custom namespace return AddToFileIlst(file, index); @@ -1005,6 +1074,30 @@ } /*---------------------------------------------------------------------- +| AP4_MetaData::Entry::RemoveFromFileUdta ++---------------------------------------------------------------------*/ +AP4_Result +AP4_MetaData::Entry::RemoveFromFileUdta(AP4_File& file, AP4_Ordinal index) +{ + // look for the 'moov' + AP4_Movie* movie = file.GetMovie(); + if (movie == NULL) return AP4_ERROR_INVALID_FORMAT; + AP4_MoovAtom* moov = movie->GetMoovAtom(); + if (moov == NULL) return AP4_ERROR_INVALID_FORMAT; + + // look for 'udta' + AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta")); + if (udta == NULL) return AP4_ERROR_NO_SUCH_ITEM; + + // remove the data atom in the entry + AP4_UI32 type = AP4_BytesToUInt32BE((const unsigned char*)m_Key.GetName().GetChars()); + AP4_Result result = udta->DeleteChild(type, index); + if (AP4_FAILED(result)) return result; + + return AP4_SUCCESS; +} + +/*---------------------------------------------------------------------- | AP4_MetaData::Entry::RemoveFromFile +---------------------------------------------------------------------*/ AP4_Result @@ -1015,6 +1108,8 @@ return RemoveFromFileIlst(file, index); } else if (m_Key.GetNamespace() == "dcf") { return RemoveFromFileDcf(file, index); + } else if (m_Key.GetNamespace() == "3gpp") { + return RemoveFromFileUdta(file, index); } else { // custom namespace return RemoveFromFileIlst(file, index);
View file
bento4-1.5.1r627.tar.gz/Source/C++/MetaData/Ap4MetaData.h -> bento4-1.5.1r628.tar.gz/Source/C++/MetaData/Ap4MetaData.h
Changed
@@ -226,9 +226,11 @@ AP4_Result AddToFile(AP4_File& file, AP4_Ordinal index = 0); AP4_Result AddToFileIlst(AP4_File& file, AP4_Ordinal index = 0); AP4_Result AddToFileDcf(AP4_File& file, AP4_Ordinal index = 0); + AP4_Result AddToFileUdta(AP4_File& file, AP4_Ordinal index = 0); AP4_Result RemoveFromFile(AP4_File& file, AP4_Ordinal index); AP4_Result RemoveFromFileIlst(AP4_File& file, AP4_Ordinal index); AP4_Result RemoveFromFileDcf(AP4_File& file, AP4_Ordinal index); + AP4_Result RemoveFromFileUdta(AP4_File& file, AP4_Ordinal index); AP4_ContainerAtom* FindInIlst(AP4_ContainerAtom* ilst) const; AP4_Result ToAtom(AP4_Atom*& atom) const;
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/aes.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/aes.py
Changed
@@ -191,7 +191,7 @@ # decryption round keys Kd = [[0] * BC for i in xrange(ROUNDS + 1)] ROUND_KEY_COUNT = (ROUNDS + 1) * BC - KC = len(key) / 4 + KC = len(key) // 4 # copy user material bytes into temporary ints tk = [] @@ -339,14 +339,14 @@ # padding padding_size = 16-(len(plaintext) % 16) plaintext += chr(padding_size)*padding_size - + # init chainBytes = IV cipher = rijndael(key) ciphertext = '' - + # CBC Mode: For each block... - for x in range(len(plaintext)/16): + for x in range(len(plaintext)//16): # XOR with the chaining block block = ''.join([chr(ord(plaintext[x*16+y]) ^ ord(chainBytes[y])) for y in range(16)]) @@ -361,12 +361,12 @@ chainBytes = IV cipher = rijndael(key) plaintext = '' - + # sanity check if len(ciphertext)%16: raise ValueError('ciphertext not an integral number of blocks') - + # CBC Mode: For each block... - for x in range(len(ciphertext)/16): + for x in range(len(ciphertext)//16): # Decrypt it block = ciphertext[x*16 : (x*16)+16] @@ -381,5 +381,5 @@ # padding padding_size = ord(plaintext[-1:]) if padding_size > 16: raise ValueError('invalid padding') - - return plaintext[:-padding_size] \ No newline at end of file + + return plaintext[:-padding_size]
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/mp4-dash-clone.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/mp4-dash-clone.py
Changed
@@ -17,11 +17,10 @@ import sys import os import os.path -from optparse import OptionParser, make_option, OptionError +from optparse import OptionParser import urllib2 import urlparse import shutil -import itertools import json import sys from xml.etree import ElementTree @@ -45,11 +44,11 @@ cmd += args #print cmd try: - return check_output(cmd) + return check_output(cmd) except CalledProcessError, e: #print e raise Exception("binary tool failed with error %d" % e.returncode) - + def Mp4Info(filename, **args): return Bento4Command('mp4info', filename, **args) @@ -60,7 +59,7 @@ for track in info['tracks']: track_ids.append(track['id']) - + return track_ids def ProcessUrlTemplate(template, representation_id, bandwidth, time, number): @@ -80,7 +79,7 @@ if time is not None: result = result.replace('$Time$', time) result = result.replace('$$', '$') return result - + class DashSegmentBaseInfo: def __init__(self, xml): self.initialization = None @@ -89,21 +88,21 @@ e = xml.find(DASH_NS+type) if e is not None: self.type = type - + # parse common elements - + # type specifics if type == 'SegmentBase' or type == 'SegmentList': init = e.find(DASH_NS+'Initialization') if init is not None: self.initialization = init.get('sourceURL') - + if type == 'SegmentTemplate': self.initialization = e.get('initialization') self.media = e.get('media') self.timescale = e.get('timescale') self.startNumber = e.get('startNumber') - + # segment timeline st = e.find(DASH_NS+'SegmentTimeline') if st is not None: @@ -123,9 +122,9 @@ else: item['r'] = 0 self.segment_timeline.append(item) - + break - + class DashRepresentation: def __init__(self, xml, parent): self.xml = xml @@ -134,23 +133,23 @@ self.segment_urls = [] self.segment_base = DashSegmentBaseInfo(xml) self.duration = 0 - + # parse standard attributes self.bandwidth = xml.get('bandwidth') self.id = xml.get('id') - + # compute the segment base type node = self self.segment_base_type = None while node is not None: if node.segment_base.type in ['SegmentTemplate', 'SegmentList']: self.segment_base_type = node.segment_base.type - break - node = node.parent - + break + node = node.parent + # compute the init segment URL self.ComputeInitSegmentUrl() - + def SegmentBaseLookup(self, field): node = self while node is not None: @@ -166,29 +165,29 @@ return node.__dict__[field] node = node.parent return None - + def ComputeInitSegmentUrl(self): node = self while node is not None: if node.segment_base.initialization is not None: self.initialization = node.segment_base.initialization - break + break node = node.parent - + self.init_segment_url = ProcessUrlTemplate(self.initialization, representation_id=self.id, bandwidth=self.bandwidth, time=None, number=None) - + def GenerateSegmentUrls(self): if self.segment_base_type == 'SegmentTemplate': return self.GenerateSegmentUrlsFromTemplate() else: return self.GenerateSegmentUrlsFromList() - + def GenerateSegmentUrlsFromTemplate(self): media = self.SegmentBaseLookup('media') if media is None: print 'WARNING: no media attribute found for representation' return - + timeline = self.SegmentBaseLookup('segment_timeline') if timeline is None: start = self.SegmentBaseLookup('startNumber') @@ -200,7 +199,7 @@ url = ProcessUrlTemplate(media, representation_id=self.id, bandwidth=self.bandwidth, time="0", number=str(current_number)) current_number += 1 yield url - + else: current_number = 1 current_time = 0 @@ -212,14 +211,14 @@ current_number += 1 current_time += s['d'] yield url - + def GenerateSegmentUrlsFromList(self): segs = self.xml.find(DASH_NS+'SegmentList').findall(DASH_NS+'SegmentURL') for seg in segs: media = seg.get('media') if media is not None: yield media - + def __str__(self): result = "Representation: " return result @@ -232,7 +231,7 @@ self.representations = [] for r in self.xml.findall(DASH_NS+'Representation'): self.representations.append(DashRepresentation(r, self)) - + def __str__(self): result = 'Adaptation Set:\n' + '\n'.join([str (r) for r in self.representations]) return result @@ -245,11 +244,11 @@ self.adaptation_sets = [] for s in self.xml.findall(DASH_NS+'AdaptationSet'): self.adaptation_sets.append(DashAdaptationSet(s, self)) - + def __str__(self): result = 'Period:\n' + '\n'.join([str(s) for s in self.adaptation_sets]) return result - + class DashMPD: def __init__(self, url, xml): self.url = url @@ -260,17 +259,17 @@ self.type = xml.get('type')
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/mp4-dash-encode.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/mp4-dash-encode.py
Changed
@@ -210,8 +210,7 @@ ########################### if __name__ == '__main__': - global Options - Options = None + Options = None # global try: main() except Exception, err:
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/mp4-dash.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/mp4-dash.py
Changed
@@ -18,7 +18,6 @@ import xml.etree.ElementTree as xml from xml.dom.minidom import parseString import tempfile -import fractions import re import platform import sys @@ -28,7 +27,7 @@ # setup main options VERSION = "1.8.0" -SDK_REVISION = '627' +SDK_REVISION = '628' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += [SCRIPT_PATH] @@ -160,14 +159,11 @@ if options.use_segment_timeline or track.type == 'subtitles': url_template = SEGMENT_URL_TEMPLATE - use_template_numbers = True if options.smooth: url_base = path.basename(options.smooth_server_manifest_filename) url_template = url_base + DASH_MEDIA_SEGMENT_URL_PATTERN_SMOOTH % stream_name - use_template_numbers = False elif options.hippo: url_template = DASH_MEDIA_SEGMENT_URL_PATTERN_HIPPO % stream_name - use_template_numbers = False args = [container, 'SegmentTemplate'] kwargs = {'timescale': str(track.timescale), @@ -395,7 +391,10 @@ if options.encryption_key or options.marlin or options.playready or options.widevine: AddContentProtection(options, adaptation_set, video_tracks) - if not options.on_demand: + if options.on_demand: + adaptation_set.set('subsegmentAlignment', 'true') + adaptation_set.set('subsegmentStartsWithSAP', '1') + else: if options.split: init_segment_url = '$RepresentationID$/' + SPLIT_INIT_SEGMENT_NAME media_segment_url_template_prefix = '$RepresentationID$/' @@ -445,7 +444,10 @@ if options.encryption_key or options.marlin or options.playready or options.widevine: AddContentProtection(options, adaptation_set, audio_tracks) - if not options.on_demand: + if options.on_demand: + adaptation_set.set('subsegmentAlignment', 'true') + adaptation_set.set('subsegmentStartsWithSAP', '1') + else: if options.split: init_segment_url = '$RepresentationID$/' + SPLIT_INIT_SEGMENT_NAME media_segment_url_template_prefix = '$RepresentationID$/' @@ -472,10 +474,10 @@ else: audio_channel_config_value = str(audio_track.channels) scheme_id_uri = MPEG_DASH_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI - audio_channel_config = xml.SubElement(representation, - 'AudioChannelConfiguration', - schemeIdUri=scheme_id_uri, - value=audio_channel_config_value) + xml.SubElement(representation, + 'AudioChannelConfiguration', + schemeIdUri=scheme_id_uri, + value=audio_channel_config_value) if options.on_demand: base_url = xml.SubElement(representation, 'BaseURL') @@ -578,7 +580,7 @@ fields[name] = value except: raise Exception('invalid syntax for --widevine-header option') - + if 'content_id' not in fields: fields['content_id'] = '*' if 'kid' not in fields: @@ -621,7 +623,7 @@ if len(key_lines) == 0: key_lines.append('URI="'+options.hls_key_url+'",IV=0x'+track.key_info['iv']) - + for key_line in key_lines: playlist_file.write('#EXT-X-KEY:METHOD=SAMPLE-AES,'+key_line+'\r\n') @@ -686,12 +688,12 @@ index_playlist_file.write('#EXTINF:%f,\r\n' % (track.segment_durations[i])) index_playlist_file.write('#EXT-X-BYTERANGE:%d@0\r\n' % (iframe_range_size)) index_playlist_file.write(fragment_basename+'\r\n') - + index_playlist_file.write('#EXT-X-ENDLIST\r\n') ############################################# def OutputHls(options, set_attributes, audio_sets, video_sets, subtitles_sets, subtitles_files): - all_audio_tracks = sum(audio_sets.values(), []) + # all_audio_tracks = sum(audio_sets.values(), []) all_video_tracks = sum(video_sets.values(), []) all_subtitles_tracks = sum(subtitles_sets.values(), []) @@ -811,21 +813,21 @@ continue language = subtitles_track.language.decode('utf-8') language_name = LanguageNames.get(language, language).decode('utf-8') - + if options.on_demand or not options.split: media_subdir = '' - media_file_name = subtitles_track.parent.media_name + # media_file_name = subtitles_track.parent.media_name media_playlist_name = subtitles_track.representation_id+".m3u8" media_playlist_path = media_playlist_name else: media_subdir = subtitles_track.representation_id - media_file_name = '' + # media_file_name = '' media_playlist_name = options.hls_media_playlist_name media_playlist_path = media_subdir+'/'+media_playlist_name master_playlist_file.write('#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="imsc1",NAME="{0:s}",DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="{1:s}",URI="{2:s}"\r\n' .format(language_name, language, media_playlist_path)) - + # WebVTT subtitles if len(subtitles_files): master_playlist_file.write('\r\n# Subtitles (WebVTT)\r\n') @@ -1472,7 +1474,7 @@ if options.fairplay_key_uri: if not options.hls: sys.stderr.write('WARNING: --fairplay-key-uri is only valid with --hls, ignoring\n') - + if options.hls: if options.encryption_key and options.encryption_cenc_scheme != 'cbcs': raise Exception('--hls requires --encryption-cenc-scheme=cbcs') @@ -1670,8 +1672,11 @@ prev_track = None for track in tracks: if prev_track: - if track.total_sample_count != prev_track.total_sample_count: - sys.stderr.write('WARNING: video sample count mismatch between "'+str(track)+'" and "'+str(prev_track)+'"\n') + # compute the total duration, excluding the last segment, which may be somewhat mismatched + track_duration_truncated = reduce(operator.add, track.segment_scaled_durations[:-1], 0) + prev_track_duration_truncated = reduce(operator.add, prev_track.segment_scaled_durations[:-1], 0) + if track_duration_truncated != prev_track_duration_truncated: + sys.stderr.write('WARNING: video duration mismatch between "'+str(track)+'" and "'+str(prev_track)+'"\n') prev_track = track # check that the video segments match for all video tracks in the same adaptation set @@ -1679,7 +1684,7 @@ if len(tracks) > 1: anchor = tracks[0] for track in tracks[1:]: - if track.sample_counts[:-1] != anchor.sample_counts[:-1]: + if track.segment_scaled_durations[:-1] != anchor.segment_scaled_durations[:-1]: PrintErrorAndExit('ERROR: video tracks are not aligned ("'+str(track)+'" differs from '+str(anchor)+')') # check that the video segment durations are almost all equal
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/mp4-hls.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/mp4-hls.py
Changed
@@ -15,11 +15,6 @@ from optparse import OptionParser import shutil -import xml.etree.ElementTree as xml -from xml.dom.minidom import parseString -import tempfile -import fractions -import re import platform import sys from mp4utils import * @@ -27,7 +22,7 @@ # setup main options VERSION = "1.1.0" -SDK_REVISION = '627' +SDK_REVISION = '628' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += [SCRIPT_PATH] @@ -254,7 +249,6 @@ AnalyzeSources(options, media_sources) # select audio tracks - audio_media = [] audio_tracks = SelectAudioTracks(options, [media_source for media_source in mp4_sources if not media_source.spec.get('+audio_fallback')]) # check if this is an audio-only presentation
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/mp4utils.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/mp4utils.py
Changed
@@ -235,9 +235,9 @@ sys.exit(1) def XmlDuration(d): - h = int(d)/3600 + h = int(d) // 3600 d -= h*3600 - m = int(d)/60 + m = int(d) // 60 s = d-m*60 xsd = 'PT' if h: @@ -330,7 +330,7 @@ atoms.append(Mp4Atom(type, size, cursor)) cursor += size file.seek(cursor) - except: + except Exception: break return atoms @@ -365,6 +365,7 @@ self.segment_bitrates = [] self.total_sample_count = 0 self.total_duration = 0 + self.total_scaled_duration = 0 self.media_size = 0 self.average_segment_duration = 0 self.average_segment_bitrate = 0 @@ -429,6 +430,7 @@ # compute the total duration self.total_duration = reduce(operator.add, self.segment_durations, 0) + self.total_scaled_duration = reduce(operator.add, self.segment_scaled_durations, 0) # compute the average segment durations segment_count = len(self.segment_durations) @@ -469,7 +471,6 @@ moov = FilterChildren(self.parent.tree, 'moov')[0] traks = FilterChildren(moov, 'trak') for trak in traks: - tkhd = FindChild(trak, ['tkhd']) tenc = FindChild(trak, ('mdia', 'minf', 'stbl', 'stsd', 'encv', 'sinf', 'schi', 'tenc')) if tenc is None: tenc = FindChild(trak, ('mdia', 'minf', 'stbl', 'stsd', 'enca', 'sinf', 'schi', 'tenc')) @@ -1058,8 +1059,6 @@ header_xml += '</DATA></WRMHEADER>' return WrapPlayreadyHeaderXml(header_xml) - return "" - def ComputePrimetimeMetaData(metadata_spec, kid_hex): # construct the base64 header if metadata_spec is None: @@ -1140,5 +1139,3 @@ if 'policy' in fields: protobuf_fields.append((6, fields['policy'])) return WidevineMakeHeader(protobuf_fields) - - return ""
View file
bento4-1.5.1r627.tar.gz/Source/Python/utils/skm.py -> bento4-1.5.1r628.tar.gz/Source/Python/utils/skm.py
Changed
@@ -1,5 +1,4 @@ import aes -import urllib2 import os import hashlib import json @@ -23,8 +22,8 @@ # Inputs: Plaintext, n 64-bit values {P1, P2, ..., Pn}, and # Key, K (the KEK). # Outputs: Ciphertext, (n+1) 64-bit values {C0, C1, ..., Cn}. - n = len(key)/8; - if n < 1: + n = len(key) // 8; + if n < 1: raise Exception('key too short') # 1) Initialize variables. @@ -72,7 +71,7 @@ # Inputs: Ciphertext, (n+1) 64-bit values {C0, C1, ..., Cn}, and # Key, K (the KEK). # Outputs: Plaintext, n 64-bit values {P0, P1, K, Pn}. - n = len(key)/8 - 1; + n = len(key) // 8 - 1; if n < 1: raise Exception('wrapped key too short'); @@ -174,7 +173,7 @@ if options.debug: print 'Request:', base_url, json.dumps(key_object) - + response = requests.post(base_url, headers={'content-type': 'application/json'}, data=json.dumps(key_object)) else: raise Exception('Unsupported SKM query mode')
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
.