├── androidtest ├── AndroidManifest.xml ├── default.properties ├── pom.xml ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ ├── layout │ │ └── main.xml │ └── values │ │ └── strings.xml └── src │ └── com │ └── googlecode │ └── mp4parser │ └── android │ └── Mp4ParserPerformance.java ├── examples ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ ├── google │ │ └── code │ │ │ └── mp4parser │ │ │ └── example │ │ │ └── PrintStructure.java │ │ └── googlecode │ │ └── mp4parser │ │ ├── AppendExample.java │ │ ├── ExtractPictureFromItunesFile.java │ │ ├── FindCommonSync.java │ │ ├── GetDuration.java │ │ ├── MuxMp4SourcesExample.java │ │ ├── MuxVideoWithAmf0.java │ │ ├── RemoveSomeSamplesExample.java │ │ ├── ReplaceSomeSamples.java │ │ ├── ServeMp4.java │ │ ├── ShortenExample.java │ │ ├── SilencePrepender.java │ │ ├── SubTitleExample.java │ │ ├── muxformats │ │ ├── AacExample.java │ │ ├── Ac3Example.java │ │ ├── Ec3Example.java │ │ └── H264Example.java │ │ └── stuff │ │ ├── ChangeInplaceExample.java │ │ ├── ChangeMetaData.java │ │ ├── DavidAppend.java │ │ ├── DumpAmf0TrackToPropertyFile.java │ │ ├── ReadExample.java │ │ ├── ReadWriteExample.java │ │ └── VideoAudioChecker.java │ └── resources │ ├── amf0track.properties │ ├── count-deutsch-audio.mp4 │ ├── count-english-audio.mp4 │ ├── count-english.ac3 │ ├── count-subs-deutsch.srt │ ├── count-video.mp4 │ ├── davidappend │ ├── v1.mp4 │ ├── v2.mp4 │ └── v3.mp4 │ ├── example-sans-amf0.mp4 │ ├── example.f4v │ └── sample.aac ├── isoparser ├── pom.xml └── src │ ├── etc │ └── keystore.jks │ ├── main │ ├── java │ │ └── com │ │ │ ├── coremedia │ │ │ └── iso │ │ │ │ ├── AbstractBoxParser.java │ │ │ │ ├── Ascii.java │ │ │ │ ├── BoxParser.java │ │ │ │ ├── Hex.java │ │ │ │ ├── IsoFile.java │ │ │ │ ├── IsoTypeReader.java │ │ │ │ ├── IsoTypeReaderVariable.java │ │ │ │ ├── IsoTypeWriter.java │ │ │ │ ├── IsoTypeWriterVariable.java │ │ │ │ ├── PropertyBoxParserImpl.java │ │ │ │ ├── Utf8.java │ │ │ │ └── boxes │ │ │ │ ├── AbstractMediaHeaderBox.java │ │ │ │ ├── AlbumBox.java │ │ │ │ ├── AuthorBox.java │ │ │ │ ├── BitRateBox.java │ │ │ │ ├── Box.java │ │ │ │ ├── ChunkOffset64BitBox.java │ │ │ │ ├── ChunkOffsetBox.java │ │ │ │ ├── ClassificationBox.java │ │ │ │ ├── CompositionShiftLeastGreatestAtom.java │ │ │ │ ├── CompositionTimeToSample.java │ │ │ │ ├── ContainerBox.java │ │ │ │ ├── CopyrightBox.java │ │ │ │ ├── DataEntryUrlBox.java │ │ │ │ ├── DataEntryUrnBox.java │ │ │ │ ├── DataInformationBox.java │ │ │ │ ├── DataReferenceBox.java │ │ │ │ ├── DescriptionBox.java │ │ │ │ ├── EditBox.java │ │ │ │ ├── EditListBox.java │ │ │ │ ├── FileTypeBox.java │ │ │ │ ├── FreeBox.java │ │ │ │ ├── FreeSpaceBox.java │ │ │ │ ├── FullBox.java │ │ │ │ ├── GenreBox.java │ │ │ │ ├── HandlerBox.java │ │ │ │ ├── HintMediaHeaderBox.java │ │ │ │ ├── ItemDataBox.java │ │ │ │ ├── ItemLocationBox.java │ │ │ │ ├── ItemProtectionBox.java │ │ │ │ ├── KeywordsBox.java │ │ │ │ ├── MediaBox.java │ │ │ │ ├── MediaHeaderBox.java │ │ │ │ ├── MediaInformationBox.java │ │ │ │ ├── MetaBox.java │ │ │ │ ├── MovieBox.java │ │ │ │ ├── MovieHeaderBox.java │ │ │ │ ├── NullMediaHeaderBox.java │ │ │ │ ├── ObjectDescriptorBox.java │ │ │ │ ├── OmaDrmAccessUnitFormatBox.java │ │ │ │ ├── OriginalFormatBox.java │ │ │ │ ├── PerformerBox.java │ │ │ │ ├── ProgressiveDownloadInformationBox.java │ │ │ │ ├── ProtectionSchemeInformationBox.java │ │ │ │ ├── RatingBox.java │ │ │ │ ├── RecordingYearBox.java │ │ │ │ ├── SampleAuxiliaryInformationOffsetsBox.java │ │ │ │ ├── SampleAuxiliaryInformationSizesBox.java │ │ │ │ ├── SampleDependencyTypeBox.java │ │ │ │ ├── SampleDescriptionBox.java │ │ │ │ ├── SampleSizeBox.java │ │ │ │ ├── SampleTableBox.java │ │ │ │ ├── SampleToChunkBox.java │ │ │ │ ├── SchemeInformationBox.java │ │ │ │ ├── SchemeTypeBox.java │ │ │ │ ├── SoundMediaHeaderBox.java │ │ │ │ ├── StaticChunkOffsetBox.java │ │ │ │ ├── SubSampleInformationBox.java │ │ │ │ ├── SubtitleMediaHeaderBox.java │ │ │ │ ├── SyncSampleBox.java │ │ │ │ ├── TimeToSampleBox.java │ │ │ │ ├── TitleBox.java │ │ │ │ ├── TrackBox.java │ │ │ │ ├── TrackHeaderBox.java │ │ │ │ ├── TrackReferenceBox.java │ │ │ │ ├── TrackReferenceTypeBox.java │ │ │ │ ├── UnknownBox.java │ │ │ │ ├── UserBox.java │ │ │ │ ├── UserDataBox.java │ │ │ │ ├── VideoMediaHeaderBox.java │ │ │ │ ├── XmlBox.java │ │ │ │ ├── apple │ │ │ │ ├── AbstractAppleMetaDataBox.java │ │ │ │ ├── AppleAlbumArtistBox.java │ │ │ │ ├── AppleAlbumBox.java │ │ │ │ ├── AppleArtistBox.java │ │ │ │ ├── AppleCommentBox.java │ │ │ │ ├── AppleCompilationBox.java │ │ │ │ ├── AppleCopyrightBox.java │ │ │ │ ├── AppleCoverBox.java │ │ │ │ ├── AppleCustomGenreBox.java │ │ │ │ ├── AppleDataBox.java │ │ │ │ ├── AppleDataRateBox.java │ │ │ │ ├── AppleDataReferenceBox.java │ │ │ │ ├── AppleDescriptionBox.java │ │ │ │ ├── AppleEncoderBox.java │ │ │ │ ├── AppleGaplessPlaybackBox.java │ │ │ │ ├── AppleGenericBox.java │ │ │ │ ├── AppleGroupingBox.java │ │ │ │ ├── AppleIdBox.java │ │ │ │ ├── AppleItemListBox.java │ │ │ │ ├── AppleLosslessSpecificBox.java │ │ │ │ ├── AppleMeanBox.java │ │ │ │ ├── AppleMediaTypeBox.java │ │ │ │ ├── AppleNameBox.java │ │ │ │ ├── AppleNetworkBox.java │ │ │ │ ├── ApplePurchaseDateBox.java │ │ │ │ ├── AppleRatingBox.java │ │ │ │ ├── AppleRecordingYearBox.java │ │ │ │ ├── AppleReferenceMovieBox.java │ │ │ │ ├── AppleReferenceMovieDescriptorBox.java │ │ │ │ ├── AppleShowBox.java │ │ │ │ ├── AppleSortAlbumBox.java │ │ │ │ ├── AppleStandardGenreBox.java │ │ │ │ ├── AppleStoreAccountTypeBox.java │ │ │ │ ├── AppleStoreCountryCodeBox.java │ │ │ │ ├── AppleSynopsisBox.java │ │ │ │ ├── AppleTempBox.java │ │ │ │ ├── AppleTrackAuthorBox.java │ │ │ │ ├── AppleTrackNumberBox.java │ │ │ │ ├── AppleTrackTitleBox.java │ │ │ │ ├── AppleTvEpisodeBox.java │ │ │ │ ├── AppleTvEpisodeNumberBox.java │ │ │ │ ├── AppleTvSeasonBox.java │ │ │ │ └── AppleWaveBox.java │ │ │ │ ├── dece │ │ │ │ └── TrickPlayBox.java │ │ │ │ ├── fragment │ │ │ │ ├── MovieExtendsBox.java │ │ │ │ ├── MovieExtendsHeaderBox.java │ │ │ │ ├── MovieFragmentBox.java │ │ │ │ ├── MovieFragmentHeaderBox.java │ │ │ │ ├── MovieFragmentRandomAccessBox.java │ │ │ │ ├── MovieFragmentRandomAccessOffsetBox.java │ │ │ │ ├── SampleFlags.java │ │ │ │ ├── SegmentTypeBox.java │ │ │ │ ├── TrackExtendsBox.java │ │ │ │ ├── TrackFragmentBaseMediaDecodeTimeBox.java │ │ │ │ ├── TrackFragmentBox.java │ │ │ │ ├── TrackFragmentHeaderBox.java │ │ │ │ ├── TrackFragmentRandomAccessBox.java │ │ │ │ └── TrackRunBox.java │ │ │ │ ├── h264 │ │ │ │ └── AvcConfigurationBox.java │ │ │ │ ├── mdat │ │ │ │ ├── DummyMap.java │ │ │ │ ├── MediaDataBox.java │ │ │ │ └── SampleList.java │ │ │ │ ├── odf-boxes.zip │ │ │ │ ├── rtp-boxes.zip │ │ │ │ ├── sampleentry │ │ │ │ ├── AmrSpecificBox.java │ │ │ │ ├── AudioSampleEntry.java │ │ │ │ ├── MpegSampleEntry.java │ │ │ │ ├── Ovc1VisualSampleEntryImpl.java │ │ │ │ ├── SampleEntry.java │ │ │ │ ├── SubtitleSampleEntry.java │ │ │ │ ├── TextSampleEntry.java │ │ │ │ └── VisualSampleEntry.java │ │ │ │ ├── threegpp26244 │ │ │ │ └── LocationInformationBox.java │ │ │ │ └── vodafone │ │ │ │ ├── AlbumArtistBox.java │ │ │ │ ├── ContentDistributorIdBox.java │ │ │ │ ├── CoverUriBox.java │ │ │ │ └── LyricsUriBox.java │ │ │ └── googlecode │ │ │ └── mp4parser │ │ │ ├── AbstractBox.java │ │ │ ├── AbstractContainerBox.java │ │ │ ├── AbstractFullBox.java │ │ │ ├── FullContainerBox.java │ │ │ ├── RequiresParseDetailAspect.java │ │ │ ├── Version.java │ │ │ ├── annotations │ │ │ ├── DoNotParseDetail.java │ │ │ └── ParseDetail.java │ │ │ ├── authoring │ │ │ ├── AbstractTrack.java │ │ │ ├── DateHelper.java │ │ │ ├── Movie.java │ │ │ ├── Mp4TrackImpl.java │ │ │ ├── Track.java │ │ │ ├── TrackMetaData.java │ │ │ ├── adaptivestreaming │ │ │ │ ├── AbstractManifestWriter.java │ │ │ │ ├── AudioQuality.java │ │ │ │ ├── FlatManifestWriterImpl.java │ │ │ │ ├── FlatPackageWriterImpl.java │ │ │ │ ├── ManifestWriter.java │ │ │ │ ├── PackageWriter.java │ │ │ │ └── VideoQuality.java │ │ │ ├── builder │ │ │ │ ├── ByteBufferHelper.java │ │ │ │ ├── DefaultMp4Builder.java │ │ │ │ ├── FragmentIntersectionFinder.java │ │ │ │ ├── FragmentedMp4Builder.java │ │ │ │ ├── Mp4Builder.java │ │ │ │ ├── SyncSampleIntersectFinderImpl.java │ │ │ │ └── TwoSecondIntersectionFinder.java │ │ │ ├── container │ │ │ │ └── mp4 │ │ │ │ │ └── MovieCreator.java │ │ │ └── tracks │ │ │ │ ├── AACTrackImpl.java │ │ │ │ ├── AC3TrackImpl.java │ │ │ │ ├── Amf0Track.java │ │ │ │ ├── AppendTrack.java │ │ │ │ ├── ChangeTimeScaleTrack.java │ │ │ │ ├── CroppedTrack.java │ │ │ │ ├── DivideTimeScaleTrack.java │ │ │ │ ├── EC3TrackImpl.java │ │ │ │ ├── H264TrackImpl.java │ │ │ │ ├── MultiplyTimeScaleTrack.java │ │ │ │ ├── QuicktimeTextTrackImpl.java │ │ │ │ ├── ReplaceSampleTrack.java │ │ │ │ ├── SilenceTrackImpl.java │ │ │ │ └── TextTrackImpl.java │ │ │ ├── boxes │ │ │ ├── AC3SpecificBox.java │ │ │ ├── AbstractSampleEncryptionBox.java │ │ │ ├── AbstractTrackEncryptionBox.java │ │ │ ├── DTSSpecificBox.java │ │ │ ├── EC3SpecificBox.java │ │ │ ├── MLPSpecificBox.java │ │ │ ├── adobe │ │ │ │ └── ActionMessageFormat0SampleEntryBox.java │ │ │ ├── apple │ │ │ │ ├── BaseMediaInfoAtom.java │ │ │ │ ├── CleanApertureAtom.java │ │ │ │ ├── GenericMediaHeaderAtom.java │ │ │ │ ├── GenericMediaHeaderTextAtom.java │ │ │ │ ├── PixelAspectRationAtom.java │ │ │ │ ├── QuicktimeTextSampleEntry.java │ │ │ │ ├── TimeCodeBox.java │ │ │ │ ├── TrackApertureModeDimensionAtom.java │ │ │ │ ├── TrackEncodedPixelsDimensionsAtom.java │ │ │ │ ├── TrackLoadSettingsAtom.java │ │ │ │ └── TrackProductionApertureDimensionsAtom.java │ │ │ ├── basemediaformat │ │ │ │ ├── AvcNalUnitStorageBox.java │ │ │ │ ├── SampleEncryptionBox.java │ │ │ │ └── TrackEncryptionBox.java │ │ │ ├── cenc │ │ │ │ └── ProtectionSystemSpecificHeaderBox.java │ │ │ ├── mp4-boxes.zip │ │ │ ├── mp4 │ │ │ │ ├── AbstractDescriptorBox.java │ │ │ │ ├── ESDescriptorBox.java │ │ │ │ ├── ObjectDescriptorBox.java │ │ │ │ ├── objectdescriptors │ │ │ │ │ ├── AudioSpecificConfig.java │ │ │ │ │ ├── BaseDescriptor.java │ │ │ │ │ ├── BitReaderBuffer.java │ │ │ │ │ ├── BitWriterBuffer.java │ │ │ │ │ ├── DecoderConfigDescriptor.java │ │ │ │ │ ├── DecoderSpecificInfo.java │ │ │ │ │ ├── Descriptor.java │ │ │ │ │ ├── ESDescriptor.java │ │ │ │ │ ├── ExtensionDescriptor.java │ │ │ │ │ ├── ExtensionProfileLevelDescriptor.java │ │ │ │ │ ├── InitialObjectDescriptor.java │ │ │ │ │ ├── ObjectDescriptor.java_bak │ │ │ │ │ ├── ObjectDescriptorBase.java │ │ │ │ │ ├── ObjectDescriptorFactory.java │ │ │ │ │ ├── ProfileLevelIndicationDescriptor.java │ │ │ │ │ ├── SLConfigDescriptor.java │ │ │ │ │ └── UnknownDescriptor.java │ │ │ │ └── samplegrouping │ │ │ │ │ ├── CencSampleEncryptionInformationGroupEntry.java │ │ │ │ │ ├── GroupEntry.java │ │ │ │ │ ├── RateShareEntry.java │ │ │ │ │ ├── RollRecoveryEntry.java │ │ │ │ │ ├── SampleGroupDescriptionBox.java │ │ │ │ │ ├── SampleToGroupBox.java │ │ │ │ │ ├── TemporalLevelEntry.java │ │ │ │ │ ├── UnknownEntry.java │ │ │ │ │ └── VisualRandomAccessEntry.java │ │ │ ├── piff │ │ │ │ ├── PiffSampleEncryptionBox.java │ │ │ │ ├── PiffTrackEncryptionBox.java │ │ │ │ ├── PlayReadyHeader.java │ │ │ │ ├── ProtectionSpecificHeader.java │ │ │ │ ├── TfrfBox.java │ │ │ │ ├── TfxdBox.java │ │ │ │ └── UuidBasedProtectionSystemSpecificHeaderBox.java │ │ │ ├── threegpp26244 │ │ │ │ └── SegmentIndexBox.java │ │ │ ├── threegpp26245 │ │ │ │ └── FontTableBox.java │ │ │ └── ultraviolet │ │ │ │ ├── AssetInformationBox.java │ │ │ │ └── BaseLocationBox.java │ │ │ ├── h264 │ │ │ ├── BTree.java │ │ │ ├── CharCache.java │ │ │ ├── Debug.java │ │ │ ├── model │ │ │ │ ├── AspectRatio.java │ │ │ │ ├── BitstreamElement.java │ │ │ │ ├── ChromaFormat.java │ │ │ │ ├── HRDParameters.java │ │ │ │ ├── PictureParameterSet.java │ │ │ │ ├── ScalingList.java │ │ │ │ ├── ScalingMatrix.java │ │ │ │ ├── SeqParameterSet.java │ │ │ │ └── VUIParameters.java │ │ │ ├── read │ │ │ │ ├── BitstreamReader.java │ │ │ │ └── CAVLCReader.java │ │ │ └── write │ │ │ │ ├── BitstreamWriter.java │ │ │ │ └── CAVLCWriter.java │ │ │ ├── srt │ │ │ └── SrtParser.java │ │ │ └── util │ │ │ ├── AndroidLogger.java │ │ │ ├── ByteBufferByteChannel.java │ │ │ ├── CastUtils.java │ │ │ ├── ChannelHelper.java │ │ │ ├── IntHashMap.java │ │ │ ├── JuliLogger.java │ │ │ ├── LazyList.java │ │ │ ├── Logger.java │ │ │ ├── Math.java │ │ │ ├── Path.java │ │ │ └── UUIDConverter.java │ └── resources │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ ├── isoparser-default.properties │ │ └── version.txt │ └── test │ ├── java │ └── com │ │ ├── coremedia │ │ ├── drm │ │ │ └── packager │ │ │ │ └── isoparser │ │ │ │ ├── RoundTripTest.java │ │ │ │ └── Walk.java │ │ └── iso │ │ │ ├── IsoFileTest.java │ │ │ ├── IsoTypeReaderTest.java │ │ │ ├── PropertyBoxParserImplTest.java │ │ │ └── boxes │ │ │ ├── ComponsitionShiftLeastGreatestAtomTest.java │ │ │ ├── EditListBoxTest.java │ │ │ ├── FreeBoxTest.java │ │ │ ├── ItemLocationBoxTest.java │ │ │ ├── MetaBoxTest.java │ │ │ ├── MovieHeaderBoxTest.java │ │ │ ├── ProgressiveDownloadInformationBoxTest.java │ │ │ ├── SampleAuxiliaryInformationSizesBoxTest.java │ │ │ ├── SampleDependencyTypeBoxTest.java │ │ │ ├── SampleToChunkBoxTest.java │ │ │ ├── XmlBoxTest.java │ │ │ ├── apple │ │ │ └── AbstractAppleMetaDataBoxTest.java │ │ │ ├── fragment │ │ │ ├── SampleFlagsTest.java │ │ │ ├── TrackFragmentRandomAccessBoxTest.java │ │ │ └── TrackRunBoxTest.java │ │ │ ├── mdat │ │ │ └── SampleListTest.java │ │ │ └── sampleentry │ │ │ └── TextSampleEntryTest.java │ │ └── googlecode │ │ └── mp4parser │ │ ├── authoring │ │ ├── InTestMovieCreator.java │ │ ├── builder │ │ │ ├── SyncSampleIntersectFinderImplTest.java │ │ │ └── TwoSecondIntersectionFinderTest.java │ │ ├── subtext │ │ │ └── SrtParserTest.java │ │ └── tracks │ │ │ ├── AACTrackImplTest.java │ │ │ ├── AC3TrackImplTest.java │ │ │ ├── BoxComparator.java │ │ │ ├── CroppedTrackTest.java │ │ │ └── H264TrackImplTest.java │ │ ├── boxes │ │ ├── AbstractSampleEncryptionBoxTest.java │ │ ├── AbstractTrackEncryptionBoxTest.java │ │ ├── BoxWriteReadBase.java │ │ ├── apple │ │ │ ├── BaseMediaInfoAtomTest.java │ │ │ ├── CleanApertureAtomTest.java │ │ │ ├── GenericMediaHeaderTextAtomTest.java │ │ │ ├── PixelAspectRationAtomTest.java │ │ │ ├── QuicktimeTextSampleEntryTest.java │ │ │ ├── TimeCodeBoxTest.java │ │ │ ├── TrackEncodedPixelsDimensionsAtomTest.java │ │ │ ├── TrackLoadSettingsAtomTest.java │ │ │ └── TrackProductionApertureDimensionsAtomTest.java │ │ ├── basemediaformat │ │ │ ├── SampleEncryptionBoxTest.java │ │ │ └── TrackEncryptionBoxTest.java │ │ ├── cenc │ │ │ └── ProtectionSystemSpecificHeaderBoxTest.java │ │ ├── mp4 │ │ │ ├── objectdescriptors │ │ │ │ ├── BitReaderBufferTest.java │ │ │ │ └── BitWriterBufferTest.java │ │ │ └── samplegrouping │ │ │ │ ├── SampleGroupDescriptionBoxTestSuite.java │ │ │ │ └── SampleToGroupBoxTest.java │ │ ├── piff │ │ │ ├── PiffSampleEncryptionBoxTest.java │ │ │ └── PiffTrackEncryptionBoxTest.java │ │ ├── threegpp26244 │ │ │ └── SegmentIndexBoxTest.java │ │ └── ultraviolet │ │ │ ├── AssetInformationBoxTest.java │ │ │ └── BaseLocationBoxTest.java │ │ └── util │ │ └── PathTest.java │ └── resources │ ├── BBB_qpfile_10sec │ ├── BBB_fixedres_B_180x320_100.mp4 │ ├── BBB_fixedres_B_180x320_120.mp4 │ ├── BBB_fixedres_B_180x320_150.mp4 │ ├── BBB_fixedres_B_180x320_200.mp4 │ └── BBB_fixedres_B_180x320_80.mp4 │ ├── Beethoven - Bagatelle op.119 no.11 i.m4a │ ├── MOV00006.3gp │ ├── Tiny Sample - NEW - Metaxed.mp4 │ ├── Tiny Sample - NEW - Untouched.mp4 │ ├── Tiny Sample - OLD.mp4 │ ├── com │ └── googlecode │ │ └── mp4parser │ │ └── authoring │ │ └── tracks │ │ ├── aac-sample.aac │ │ ├── aac-sample.mp4 │ │ ├── ac3-sample.ac3 │ │ ├── ac3-sample.mp4 │ │ ├── h264-sample.h264 │ │ └── h264-sample.mp4 │ ├── count-english.ac3 │ ├── count.h264 │ ├── file6141.odf │ ├── isoparser-custom.properties │ ├── multiTrack.3gp │ ├── subs.srt │ ├── test-pod.m4a │ └── test.m4p ├── pom.xml └── tools ├── isoviewer ├── pom.xml └── src │ ├── etc │ └── keystore.jks │ └── main │ ├── java │ └── com │ │ ├── coremedia │ │ └── iso │ │ │ └── gui │ │ │ ├── BoxJTree.java │ │ │ ├── GenericBoxPane.java │ │ │ ├── Iso8859_1.java │ │ │ ├── IsoFileTreeModel.java │ │ │ ├── IsoSampleNALUnitReader.java │ │ │ ├── IsoViewerPanel.java │ │ │ ├── MultiLineCellRenderer.java │ │ │ ├── NonEditableJTextField.java │ │ │ ├── SampleListModel.java │ │ │ ├── SampleListRenderer.java │ │ │ ├── TrackListModel.java │ │ │ ├── TrackListRenderer.java │ │ │ ├── hex │ │ │ ├── JHexEditor.java │ │ │ ├── JHexEditorASCII.java │ │ │ ├── JHexEditorHEX.java │ │ │ └── LICENSE.txt │ │ │ └── transferhelper │ │ │ ├── ByteTransferValue.java │ │ │ ├── DoubleTransferValue.java │ │ │ ├── FloatTransferValue.java │ │ │ ├── IntegerTransferValue.java │ │ │ ├── LongTransferValue.java │ │ │ ├── ShortTransferValue.java │ │ │ ├── StringTransferValue.java │ │ │ ├── TransferHelperFactory.java │ │ │ └── TransferValue.java │ │ └── googlecode │ │ └── mp4parser │ │ └── isoviewer │ │ └── IsoViewer.java │ ├── jnlp │ └── isoviewer.jnlp │ └── resources │ ├── A.json │ ├── LICENSE.txt │ ├── NOTICE.txt │ ├── com │ └── googlecode │ │ └── mp4parser │ │ └── isoviewer │ │ └── resources │ │ ├── IsoViewer.properties │ │ └── icon.png │ └── names.properties ├── pom.xml ├── smooth-streaming-downloader ├── pom.xml └── src │ ├── main │ └── java │ │ ├── com │ │ └── googlecode │ │ │ └── mp4parser │ │ │ └── tools │ │ │ └── smoothstreamingdownloader │ │ │ └── SmoothStreamingTrack.java │ │ └── testdata │ │ └── Anchor.java │ └── test │ ├── java │ └── com │ │ └── googlecode │ │ └── mp4parser │ │ └── tools │ │ └── smoothstreamingdownloader │ │ └── SmoothStreamingTrackTest.java │ └── resources │ └── testdata │ ├── Manifest │ └── video │ └── 70090 │ ├── 0 │ ├── 24000000 │ ├── 48000000 │ ├── 72000000 │ └── 96000000 └── smooth-streaming-fragmenter ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── googlecode │ │ └── mp4parser │ │ └── tools │ │ └── smoothstreamingfragmenter │ │ └── FragmentFileSet.java └── resources │ ├── LICENSE.txt │ └── NOTICE.txt └── test ├── java └── com │ └── googlecode │ └── mp4parser │ └── tools │ └── smoothstreamingfragmenter │ └── FragmentFileSetTest.java └── resources └── smoothstreaming ├── README.txt ├── audio-96000.mp4 ├── video-128h-75kbps.mp4 ├── video-192h-155kbps.mp4 ├── video-240h-231kbps.mp4 └── video-320h-388kbps.mp4 /androidtest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /androidtest/default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Indicates whether an apk should be generated for each density. 11 | split.density=false 12 | # Project target. 13 | target=android-4 14 | -------------------------------------------------------------------------------- /androidtest/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/androidtest/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /androidtest/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/androidtest/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /androidtest/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/androidtest/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /androidtest/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /androidtest/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Android MP4Parser Performance 4 | 5 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/ExtractPictureFromItunesFile.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.coremedia.iso.boxes.apple.AppleDataBox; 5 | import com.googlecode.mp4parser.util.Path; 6 | 7 | import java.io.FileInputStream; 8 | import java.io.FileOutputStream; 9 | import java.io.IOException; 10 | 11 | 12 | public class ExtractPictureFromItunesFile { 13 | public static void main(String[] args) throws IOException { 14 | IsoFile isoFile = new IsoFile(new FileInputStream(args[0]).getChannel()); 15 | 16 | 17 | AppleDataBox data = (AppleDataBox) Path.getPath(isoFile, "/moov/udta/meta/ilst/covr/data"); 18 | String ext; 19 | if ((data.getFlags() & 0x1) == 0x1) { 20 | ext = "jpg"; 21 | } else if ((data.getFlags() & 0x2) == 0x2) { 22 | ext = "png"; 23 | } else { 24 | System.err.println("Unknown Image Type"); 25 | ext = "unknown"; 26 | } 27 | 28 | FileOutputStream fos = new FileOutputStream("image." + ext); 29 | fos.write(data.getData()); 30 | fos.close(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/GetDuration.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | 5 | import java.io.IOException; 6 | 7 | /** 8 | * Gets the duration of a video. 9 | */ 10 | public class GetDuration { 11 | public static void main(String[] args) throws IOException { 12 | String filename = GetDuration.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/count-video.mp4"; 13 | IsoFile isoFile = new IsoFile(filename); 14 | double lengthInSeconds = (double) 15 | isoFile.getMovieBox().getMovieHeaderBox().getDuration() / 16 | isoFile.getMovieBox().getMovieHeaderBox().getTimescale(); 17 | System.err.println(lengthInSeconds); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/RemoveSomeSamplesExample.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.Track; 6 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 7 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; 8 | import com.googlecode.mp4parser.authoring.tracks.AppendTrack; 9 | import com.googlecode.mp4parser.authoring.tracks.CroppedTrack; 10 | 11 | import java.io.File; 12 | import java.io.FileInputStream; 13 | import java.io.FileOutputStream; 14 | import java.io.IOException; 15 | 16 | /** 17 | * Removes some samples in the middle 18 | */ 19 | public class RemoveSomeSamplesExample { 20 | public static void main(String[] args) throws IOException { 21 | String audioEnglish = RemoveSomeSamplesExample.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/count-english-audio.mp4"; 22 | Movie originalMovie = MovieCreator.build(new FileInputStream(audioEnglish).getChannel()); 23 | 24 | Track audio = originalMovie.getTracks().get(0); 25 | 26 | Movie nuMovie = new Movie(); 27 | nuMovie.addTrack(new AppendTrack(new CroppedTrack(audio, 0, 10), new CroppedTrack(audio, 100, audio.getSamples().size()))); 28 | 29 | IsoFile out = new DefaultMp4Builder().build(nuMovie); 30 | FileOutputStream fos = new FileOutputStream(new File("output.mp4")); 31 | out.getBox(fos.getChannel()); 32 | fos.close(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/ReplaceSomeSamples.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.Track; 6 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 7 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; 8 | import com.googlecode.mp4parser.authoring.tracks.ReplaceSampleTrack; 9 | 10 | import java.io.File; 11 | import java.io.FileInputStream; 12 | import java.io.FileOutputStream; 13 | import java.io.IOException; 14 | import java.nio.ByteBuffer; 15 | 16 | /** 17 | * Replaces some samples. 18 | */ 19 | public class ReplaceSomeSamples { 20 | public static void main(String[] args) throws IOException { 21 | String audioEnglish = RemoveSomeSamplesExample.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/count-english-audio.mp4"; 22 | Movie originalMovie = MovieCreator.build(new FileInputStream(audioEnglish).getChannel()); 23 | 24 | Track audio = originalMovie.getTracks().get(0); 25 | 26 | Movie nuMovie = new Movie(); 27 | 28 | nuMovie.addTrack(new ReplaceSampleTrack( 29 | new ReplaceSampleTrack( 30 | new ReplaceSampleTrack( 31 | audio, 32 | 25, ByteBuffer.allocate(5)), 33 | 27, ByteBuffer.allocate(5)), 34 | 29, ByteBuffer.allocate(5))); 35 | IsoFile out = new DefaultMp4Builder().build(nuMovie); 36 | FileOutputStream fos = new FileOutputStream(new File("output.mp4")); 37 | out.getBox(fos.getChannel()); 38 | fos.close(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/SilencePrepender.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | 4 | import com.coremedia.iso.IsoFile; 5 | import com.googlecode.mp4parser.authoring.Movie; 6 | import com.googlecode.mp4parser.authoring.Track; 7 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 8 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; 9 | import com.googlecode.mp4parser.authoring.tracks.AppendTrack; 10 | import com.googlecode.mp4parser.authoring.tracks.SilenceTrackImpl; 11 | 12 | import java.io.FileInputStream; 13 | import java.io.IOException; 14 | import java.io.RandomAccessFile; 15 | import java.nio.channels.FileChannel; 16 | 17 | public class SilencePrepender { 18 | public static void main(String[] args) throws IOException { 19 | 20 | Movie audioMovie = MovieCreator.build(new FileInputStream("/home/sannies/scm/svn/mp4parser/silence/sample.mp4").getChannel()); 21 | 22 | 23 | Movie result = new Movie(); 24 | Track audio = audioMovie.getTracks().get(0); 25 | 26 | Track silence = new SilenceTrackImpl(audio, 2000); 27 | 28 | result.addTrack(new AppendTrack(silence, audio)); 29 | 30 | IsoFile isoFile = new DefaultMp4Builder().build(result); 31 | 32 | FileChannel fc = new RandomAccessFile(String.format("output.mp4"), "rw").getChannel(); 33 | fc.position(0); 34 | isoFile.getBox(fc); 35 | fc.close(); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/muxformats/AacExample.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.muxformats; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 6 | import com.googlecode.mp4parser.authoring.tracks.AACTrackImpl; 7 | 8 | import java.io.FileInputStream; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | 12 | /** 13 | * Created with IntelliJ IDEA. 14 | * User: magnus 15 | * Date: 2012-04-20 16 | * Time: 13:22 17 | * To change this template use File | Settings | File Templates. 18 | */ 19 | public class AacExample { 20 | public static void main(String[] args) throws IOException { 21 | // AACTrackImpl aacTrack = new AACTrackImpl(Ac3Example.class.getResourceAsStream("/sample.aac")); 22 | AACTrackImpl aacTrack = new AACTrackImpl(new FileInputStream("/Users/magnus/Projects/castlabs/cff/Solekai015_1920_29_75x75_v2/Solekai_BeautifulTension_15sec_160k.aac").getChannel()); 23 | Movie m = new Movie(); 24 | m.addTrack(aacTrack); 25 | DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); 26 | IsoFile isoFile = mp4Builder.build(m); 27 | FileOutputStream fos = new FileOutputStream("output.mp4"); 28 | isoFile.getBox(fos.getChannel()); 29 | fos.close(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/muxformats/Ac3Example.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.muxformats; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 6 | import com.googlecode.mp4parser.authoring.tracks.AC3TrackImpl; 7 | 8 | import java.io.FileOutputStream; 9 | import java.io.IOException; 10 | 11 | /** 12 | * 13 | */ 14 | public class Ac3Example { 15 | public static void main(String[] args) throws IOException { 16 | AC3TrackImpl ac3Track = new AC3TrackImpl(Ac3Example.class.getResourceAsStream("/count-english.ac3")); 17 | Movie m = new Movie(); 18 | m.addTrack(ac3Track); 19 | DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); 20 | IsoFile isoFile = mp4Builder.build(m); 21 | FileOutputStream fos = new FileOutputStream("output.mp4"); 22 | isoFile.getBox(fos.getChannel()); 23 | fos.close(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/muxformats/Ec3Example.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.muxformats; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 6 | import com.googlecode.mp4parser.authoring.tracks.EC3TrackImpl; 7 | 8 | import java.io.FileInputStream; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | 12 | /** 13 | * 14 | */ 15 | public class Ec3Example { 16 | public static void main(String[] args) throws IOException { 17 | EC3TrackImpl track = new EC3TrackImpl(new FileInputStream("/home/sannies/Solekai020_1920_23_75x1_Dolby_v2/Dolby_Channel-Check_Voice_8-ch_Discrete_24bit_48kHz_dn24_448.ec3")); 18 | Movie m = new Movie(); 19 | m.addTrack(track); 20 | DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); 21 | IsoFile isoFile = mp4Builder.build(m); 22 | FileOutputStream fos = new FileOutputStream("output.mp4"); 23 | isoFile.getBox(fos.getChannel()); 24 | fos.close(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/muxformats/H264Example.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.muxformats; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 6 | import com.googlecode.mp4parser.authoring.tracks.AACTrackImpl; 7 | import com.googlecode.mp4parser.authoring.tracks.H264TrackImpl; 8 | 9 | import java.io.*; 10 | 11 | /** 12 | * Created with IntelliJ IDEA. 13 | * User: magnus 14 | * Date: 2012-04-23 15 | * Time: 12:21 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public class H264Example { 19 | public static void main(String[] args) throws IOException { 20 | H264TrackImpl h264Track = new H264TrackImpl(new BufferedInputStream(new FileInputStream("/home/sannies2/Downloads/lv.h264"))); 21 | AACTrackImpl aacTrack = new AACTrackImpl(new FileInputStream("/home/sannies2/Downloads/lv.aac").getChannel()); 22 | Movie m = new Movie(); 23 | m.addTrack(h264Track); 24 | m.addTrack(aacTrack); 25 | 26 | { 27 | IsoFile out = new DefaultMp4Builder().build(m); 28 | FileOutputStream fos = new FileOutputStream(new File("h264_output.mp4")); 29 | out.getBox(fos.getChannel()); 30 | fos.close(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/stuff/ChangeInplaceExample.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.stuff; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.coremedia.iso.boxes.HandlerBox; 5 | import com.googlecode.mp4parser.util.Path; 6 | import org.apache.commons.lang.RandomStringUtils; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.io.RandomAccessFile; 11 | import java.nio.channels.FileChannel; 12 | import java.util.Arrays; 13 | import java.util.Collections; 14 | 15 | public class ChangeInplaceExample { 16 | public static void main(String[] args) throws IOException { 17 | long start = System.currentTimeMillis(); 18 | FileChannel rChannel = new RandomAccessFile("/media/scratch/CSI.S12E21.HDTV.x264-LOL.mp4", "r").getChannel(); 19 | FileChannel wChannel = new RandomAccessFile("/media/scratch/ThreeHundredFourtyThreeMB_2.mp4", "rw").getChannel(); 20 | IsoFile isoFile = new IsoFile(rChannel); 21 | HandlerBox hdlr = (HandlerBox) Path.getPath(isoFile, "/moov[0]/trak[0]/mdia[0]/hdlr[0]"); 22 | hdlr.setName(RandomStringUtils.random(hdlr.getName().length())); 23 | isoFile.getBox(wChannel); 24 | rChannel.close(); 25 | wChannel.close(); 26 | System.err.println((System.currentTimeMillis() - start) + "ms"); 27 | new File("/media/scratch/ThreeHundredFourtyThreeMB_2.mp4").delete(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/stuff/ReadExample.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.stuff; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.coremedia.iso.boxes.XmlBox; 5 | import com.googlecode.mp4parser.util.Path; 6 | 7 | import java.io.FileInputStream; 8 | import java.io.IOException; 9 | 10 | /** 11 | * 12 | */ 13 | public class ReadExample { 14 | public static void main(String[] args) throws IOException { 15 | FileInputStream fileInputStream = new FileInputStream("/home/sannies2/Mission_Impossible_Ghost_Protocol_Feature_SDUV_480p_16avg192max.uvu"); 16 | IsoFile isoFile = new IsoFile(fileInputStream.getChannel()); 17 | //isoFile = new IsoFile(Channels.newChannel(new FileInputStream(this.filePath))); 18 | //Path path = new Path(isoFile); 19 | XmlBox xmlBox = (XmlBox) Path.getPath(isoFile, "/moov/meta/xml "); 20 | String xml = xmlBox.getXml(); 21 | System.err.println(xml); 22 | 23 | 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /examples/src/main/java/com/googlecode/mp4parser/stuff/VideoAudioChecker.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.stuff; 2 | 3 | 4 | import com.coremedia.iso.IsoFile; 5 | import com.coremedia.iso.boxes.HandlerBox; 6 | import com.googlecode.mp4parser.SubTitleExample; 7 | 8 | import java.io.IOException; 9 | import java.nio.channels.Channels; 10 | import java.util.List; 11 | 12 | public class VideoAudioChecker { 13 | 14 | public static void main(String[] args) throws IOException { 15 | IsoFile isoFile = new IsoFile(Channels.newChannel(SubTitleExample.class.getResourceAsStream("/count-video.mp4"))); 16 | System.err.println(getType(isoFile)); 17 | } 18 | 19 | public static TYPE getType(IsoFile isoFile) { 20 | 21 | List handlerBoxes = 22 | isoFile.getBoxes(HandlerBox.class, true); 23 | for (HandlerBox handlerBox : handlerBoxes) { 24 | if ("vide".equals(handlerBox.getHandlerType())) { 25 | return TYPE.VIDEO; 26 | } else if ("soun".equals(handlerBox.getHandlerType())) { 27 | return TYPE.AUDIO; 28 | } else { 29 | System.err.println("unknown"); 30 | } 31 | 32 | } 33 | return TYPE.AUDIO; 34 | } 35 | 36 | private enum TYPE { 37 | AUDIO, 38 | VIDEO 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/resources/count-deutsch-audio.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/count-deutsch-audio.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/count-english-audio.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/count-english-audio.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/count-english.ac3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/count-english.ac3 -------------------------------------------------------------------------------- /examples/src/main/resources/count-subs-deutsch.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:05,000 --> 00:00:06,000 3 | Fünf 4 | 5 | 2 6 | 00:00:08,000 --> 00:00:09,000 7 | Vier 8 | 9 | 3 10 | 00:00:12,000 --> 00:00:13,000 11 | Drei 12 | 13 | 4 14 | 00:00:16,000 --> 00:00:17,000 15 | Zwei 16 | 17 | 5 18 | 00:00:20,000 --> 00:00:21,000 19 | Eins 20 | -------------------------------------------------------------------------------- /examples/src/main/resources/count-video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/count-video.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/davidappend/v1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/davidappend/v1.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/davidappend/v2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/davidappend/v2.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/davidappend/v3.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/davidappend/v3.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/example-sans-amf0.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/example-sans-amf0.mp4 -------------------------------------------------------------------------------- /examples/src/main/resources/example.f4v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/example.f4v -------------------------------------------------------------------------------- /examples/src/main/resources/sample.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/examples/src/main/resources/sample.aac -------------------------------------------------------------------------------- /isoparser/src/etc/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/etc/keystore.jks -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/Ascii.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.coremedia.iso; 17 | 18 | import java.io.UnsupportedEncodingException; 19 | 20 | /** 21 | * Converts byte[] -> String and vice versa. 22 | */ 23 | public final class Ascii { 24 | public static byte[] convert(String s) { 25 | try { 26 | if (s != null) { 27 | return s.getBytes("us-ascii"); 28 | } else { 29 | return null; 30 | } 31 | } catch (UnsupportedEncodingException e) { 32 | throw new Error(e); 33 | } 34 | } 35 | 36 | public static String convert(byte[] b) { 37 | try { 38 | if (b != null) { 39 | return new String(b, "us-ascii"); 40 | } else { 41 | return null; 42 | } 43 | } catch (UnsupportedEncodingException e) { 44 | throw new Error(e); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/BoxParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.coremedia.iso; 17 | 18 | import com.coremedia.iso.boxes.Box; 19 | import com.coremedia.iso.boxes.ContainerBox; 20 | 21 | import java.io.IOException; 22 | import java.nio.channels.ReadableByteChannel; 23 | 24 | /** 25 | * Basic interface to create boxes from a IsoBufferWrapper and its parent. 26 | */ 27 | public interface BoxParser { 28 | Box parseBox(ReadableByteChannel in, ContainerBox parent) throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/IsoTypeReaderVariable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.coremedia.iso; 17 | 18 | import java.nio.ByteBuffer; 19 | 20 | public final class IsoTypeReaderVariable { 21 | 22 | public static long read(ByteBuffer bb, int bytes) { 23 | switch (bytes) { 24 | case 1: 25 | return IsoTypeReader.readUInt8(bb); 26 | case 2: 27 | return IsoTypeReader.readUInt16(bb); 28 | case 3: 29 | return IsoTypeReader.readUInt24(bb); 30 | case 4: 31 | return IsoTypeReader.readUInt32(bb); 32 | case 8: 33 | return IsoTypeReader.readUInt64(bb); 34 | default: 35 | throw new RuntimeException("I don't know how to read " + bytes + " bytes"); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/IsoTypeWriterVariable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.coremedia.iso; 17 | 18 | import java.io.IOException; 19 | import java.nio.ByteBuffer; 20 | 21 | public final class IsoTypeWriterVariable { 22 | 23 | public static void write(long v, ByteBuffer bb, int bytes) { 24 | switch (bytes) { 25 | case 1: 26 | IsoTypeWriter.writeUInt8(bb, (int) (v & 0xff)); 27 | break; 28 | case 2: 29 | IsoTypeWriter.writeUInt16(bb, (int) (v & 0xffff)); 30 | break; 31 | case 3: 32 | IsoTypeWriter.writeUInt24(bb, (int) (v & 0xffffff)); 33 | break; 34 | case 4: 35 | IsoTypeWriter.writeUInt32(bb, v); 36 | break; 37 | case 8: 38 | IsoTypeWriter.writeUInt64(bb, v); 39 | break; 40 | default: 41 | throw new RuntimeException("I don't know how to read " + bytes + " bytes"); 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/AbstractMediaHeaderBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Sebastian Annies, Hamburg, Germany 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractFullBox; 20 | 21 | /** 22 | * A common superclass for all MediaInformationHeaderBoxes. E.g. 23 | * VideoMediaHeaderBox, SoundMediaHeaderBox & HintMediaHeaderBox 24 | */ 25 | public abstract class AbstractMediaHeaderBox extends AbstractFullBox { 26 | protected AbstractMediaHeaderBox(String type) { 27 | super(type); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/ChunkOffset64BitBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.IsoTypeWriter; 5 | 6 | import java.nio.ByteBuffer; 7 | 8 | import static com.googlecode.mp4parser.util.CastUtils.l2i; 9 | 10 | /** 11 | *

4cc = "{@value #TYPE}"

12 | * Abstract Chunk Offset Box 13 | */ 14 | public class ChunkOffset64BitBox extends ChunkOffsetBox { 15 | public static final String TYPE = "co64"; 16 | private long[] chunkOffsets; 17 | 18 | public ChunkOffset64BitBox() { 19 | super(TYPE); 20 | } 21 | 22 | @Override 23 | public long[] getChunkOffsets() { 24 | return chunkOffsets; 25 | } 26 | 27 | @Override 28 | protected long getContentSize() { 29 | return 8 + 8 * chunkOffsets.length; 30 | } 31 | 32 | @Override 33 | public void _parseDetails(ByteBuffer content) { 34 | parseVersionAndFlags(content); 35 | int entryCount = l2i(IsoTypeReader.readUInt32(content)); 36 | chunkOffsets = new long[entryCount]; 37 | for (int i = 0; i < entryCount; i++) { 38 | chunkOffsets[i] = IsoTypeReader.readUInt64(content); 39 | } 40 | } 41 | 42 | @Override 43 | protected void getContent(ByteBuffer byteBuffer) { 44 | writeVersionAndFlags(byteBuffer); 45 | IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length); 46 | for (long chunkOffset : chunkOffsets) { 47 | IsoTypeWriter.writeUInt64(byteBuffer, chunkOffset); 48 | } 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/ChunkOffsetBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.AbstractFullBox; 4 | 5 | /** 6 | * Abstract Chunk Offset Box 7 | */ 8 | public abstract class ChunkOffsetBox extends AbstractFullBox { 9 | 10 | public ChunkOffsetBox(String type) { 11 | super(type); 12 | } 13 | 14 | public abstract long[] getChunkOffsets(); 15 | 16 | 17 | public String toString() { 18 | return this.getClass().getSimpleName() + "[entryCount=" + getChunkOffsets().length + "]"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/DataEntryUrlBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractFullBox; 20 | 21 | import java.nio.ByteBuffer; 22 | 23 | /** 24 | *

4cc = "{@value #TYPE}"

25 | * Only used within the DataReferenceBox. Find more information there. 26 | * 27 | * @see com.coremedia.iso.boxes.DataReferenceBox 28 | */ 29 | public class DataEntryUrlBox extends AbstractFullBox { 30 | public static final String TYPE = "url "; 31 | 32 | public DataEntryUrlBox() { 33 | super(TYPE); 34 | } 35 | 36 | @Override 37 | public void _parseDetails(ByteBuffer content) { 38 | parseVersionAndFlags(content); 39 | } 40 | 41 | 42 | @Override 43 | protected void getContent(ByteBuffer byteBuffer) { 44 | writeVersionAndFlags(byteBuffer); 45 | } 46 | 47 | protected long getContentSize() { 48 | return 4; 49 | } 50 | 51 | public String toString() { 52 | return "DataEntryUrlBox[]"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/DataInformationBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * 24 | * Box Type: 'dinf'
25 | * Container: {@link com.coremedia.iso.boxes.MediaInformationBox} ('minf')
26 | * Mandatory: Yes
27 | * Quantity: Exactly one

28 | * The data information box contains objects that declare the location of the media information in a track. 29 | */ 30 | public class DataInformationBox extends AbstractContainerBox { 31 | public static final String TYPE = "dinf"; 32 | 33 | public DataInformationBox() { 34 | super(TYPE); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/EditBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * An Edit Box maps the presentation time-line to the media time-line as it is stored in the file. 24 | * The Edit Box is a container fpr the edit lists. Defined in ISO/IEC 14496-12. 25 | * 26 | * @see EditListBox 27 | */ 28 | public class EditBox extends AbstractContainerBox { 29 | public static final String TYPE = "edts"; 30 | 31 | public EditBox() { 32 | super(TYPE); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/FullBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | /** 6 | * The FullBox contains all getters and setters specific 7 | * to a so-called full box according to the ISO/IEC 14496/12 specification. 8 | */ 9 | public interface FullBox extends Box { 10 | int getVersion(); 11 | 12 | void setVersion(int version); 13 | 14 | int getFlags(); 15 | 16 | void setFlags(int flags); 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/ItemDataBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.AbstractBox; 4 | 5 | import java.nio.ByteBuffer; 6 | 7 | /** 8 | *

4cc = "{@value #TYPE}"

9 | */ 10 | public class ItemDataBox extends AbstractBox { 11 | ByteBuffer data = ByteBuffer.allocate(0); 12 | public static final String TYPE = "idat"; 13 | 14 | 15 | public ItemDataBox() { 16 | super(TYPE); 17 | } 18 | 19 | public ByteBuffer getData() { 20 | return data; 21 | } 22 | 23 | public void setData(ByteBuffer data) { 24 | this.data = data; 25 | } 26 | 27 | @Override 28 | protected long getContentSize() { 29 | return data.limit(); 30 | } 31 | 32 | 33 | @Override 34 | public void _parseDetails(ByteBuffer content) { 35 | data = content.slice(); 36 | content.position(content.position() + content.remaining()); 37 | } 38 | 39 | @Override 40 | protected void getContent(ByteBuffer byteBuffer) { 41 | byteBuffer.put(data); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/MediaInformationBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * This box contains all the objects that declare characteristic information of the media in the track. 24 | */ 25 | public class MediaInformationBox extends AbstractContainerBox { 26 | public static final String TYPE = "minf"; 27 | 28 | public MediaInformationBox() { 29 | super(TYPE); 30 | } 31 | 32 | public SampleTableBox getSampleTableBox() { 33 | for (Box box : getBoxes()) { 34 | if (box instanceof SampleTableBox) { 35 | return (SampleTableBox) box; 36 | } 37 | } 38 | return null; 39 | } 40 | 41 | public AbstractMediaHeaderBox getMediaHeaderBox() { 42 | for (Box box : getBoxes()) { 43 | if (box instanceof AbstractMediaHeaderBox) { 44 | return (AbstractMediaHeaderBox) box; 45 | } 46 | } 47 | return null; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/NullMediaHeaderBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Sebastian Annies, Hamburg, Germany 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.coremedia.iso.boxes; 17 | 18 | import java.nio.ByteBuffer; 19 | 20 | /** 21 | *

4cc = "{@value #TYPE}"

22 | * Streams other than visual and audio (e.g., timed metadata streams) may use a 23 | * Null Media Header Box. 24 | */ 25 | public class NullMediaHeaderBox extends AbstractMediaHeaderBox { 26 | public static String TYPE = "nmhd"; 27 | 28 | public NullMediaHeaderBox() { 29 | super(TYPE); 30 | } 31 | 32 | @Override 33 | protected long getContentSize() { 34 | return 4; 35 | } 36 | 37 | @Override 38 | public void _parseDetails(ByteBuffer content) { 39 | parseVersionAndFlags(content); 40 | } 41 | 42 | @Override 43 | protected void getContent(ByteBuffer byteBuffer) { 44 | writeVersionAndFlags(byteBuffer); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/ObjectDescriptorBox.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/coremedia/iso/boxes/ObjectDescriptorBox.java -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/ProtectionSchemeInformationBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * The ProtectionSchemeInformationBox contains all the information required both 24 | * to understand the encryption transform applied and its parameters, and also to find other 25 | * information such as the kind and location of the key management system. It also documents the 26 | * the original (unencrypted) format of the media. The ProtectionSchemeInformationBox 27 | * is a container box. It is mandatory in a sample entry that uses a code idicating a 28 | * protected stream. 29 | * 30 | * @see com.coremedia.iso.boxes.odf.OmaDrmKeyManagenentSystemBox 31 | * @see com.coremedia.iso.boxes.sampleentry.AudioSampleEntry#TYPE_ENCRYPTED 32 | * @see com.coremedia.iso.boxes.sampleentry.VisualSampleEntry#TYPE_ENCRYPTED 33 | */ 34 | public class ProtectionSchemeInformationBox extends AbstractContainerBox { 35 | public static final String TYPE = "sinf"; 36 | 37 | public ProtectionSchemeInformationBox() { 38 | super(TYPE); 39 | 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/SchemeInformationBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * The Scheme Information Box is a container box that is only interpreted by the scheme beeing used. 24 | * Any information the encryption system needs is stored here. The content of this box is a series of 25 | * boxexes whose type annd format are defined by the scheme declared in the {@link com.coremedia.iso.boxes.SchemeTypeBox}. 26 | */ 27 | public class SchemeInformationBox extends AbstractContainerBox { 28 | public static final String TYPE = "schi"; 29 | 30 | public SchemeInformationBox() { 31 | super(TYPE); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/SubtitleMediaHeaderBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | */ 8 | public class SubtitleMediaHeaderBox extends AbstractMediaHeaderBox { 9 | 10 | public static final String TYPE = "sthd"; 11 | 12 | public SubtitleMediaHeaderBox() { 13 | super(TYPE); 14 | } 15 | 16 | protected long getContentSize() { 17 | return 4; 18 | } 19 | 20 | @Override 21 | public void _parseDetails(ByteBuffer content) { 22 | parseVersionAndFlags(content); 23 | } 24 | 25 | @Override 26 | protected void getContent(ByteBuffer byteBuffer) { 27 | writeVersionAndFlags(byteBuffer); 28 | } 29 | 30 | public String toString() { 31 | return "SubtitleMediaHeaderBox"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/TrackReferenceBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * 24 | * Box Type: 'tref'
25 | * Container: {@link TrackBox} ('trak')
26 | * Mandatory: No
27 | * Quantity: Zero or one

28 | *
29 | * This box provides a reference from the containing track to another track in the presentation. These references 30 | * are typed. A 'hint' reference links from the containing hint track to the media data that it hints. A content 31 | * description reference 'cdsc' links a descriptive or metadata track to the content which it describes. 32 | * Exactly one Track Reference Box can be contained within the Track Box. 33 | * If this box is not present, the track is not referencing any other track in any way. The reference array is sized 34 | * to fill the reference type box. 35 | */ 36 | public class TrackReferenceBox extends AbstractContainerBox { 37 | public static final String TYPE = "tref"; 38 | 39 | public TrackReferenceBox() { 40 | super(TYPE); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/UnknownBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 CoreMedia AG, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes; 18 | 19 | 20 | import com.googlecode.mp4parser.AbstractBox; 21 | 22 | import java.nio.ByteBuffer; 23 | 24 | /** 25 | * A box unknown to the ISO Parser. If there is no specific Box implementation for a Box this UnknownBox 26 | * will just hold the box's data. 27 | */ 28 | public class UnknownBox extends AbstractBox { 29 | ByteBuffer data; 30 | 31 | public UnknownBox(String type) { 32 | super(type); 33 | } 34 | 35 | @Override 36 | protected long getContentSize() { 37 | return data.limit(); 38 | } 39 | 40 | @Override 41 | public void _parseDetails(ByteBuffer content) { 42 | data = content; 43 | content.position(content.position() + content.remaining()); 44 | } 45 | 46 | @Override 47 | protected void getContent(ByteBuffer byteBuffer) { 48 | data.rewind(); 49 | byteBuffer.put(data); 50 | } 51 | 52 | public ByteBuffer getData() { 53 | return data; 54 | } 55 | 56 | public void setData(ByteBuffer data) { 57 | this.data = data; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/XmlBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.Utf8; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | */ 12 | public class XmlBox extends AbstractFullBox { 13 | String xml = ""; 14 | public static final String TYPE = "xml "; 15 | 16 | public XmlBox() { 17 | super(TYPE); 18 | } 19 | 20 | public String getXml() { 21 | return xml; 22 | } 23 | 24 | public void setXml(String xml) { 25 | this.xml = xml; 26 | } 27 | 28 | @Override 29 | protected long getContentSize() { 30 | return 4 + Utf8.utf8StringLengthInBytes(xml); 31 | } 32 | 33 | @Override 34 | public void _parseDetails(ByteBuffer content) { 35 | parseVersionAndFlags(content); 36 | xml = IsoTypeReader.readString(content, content.remaining()); 37 | } 38 | 39 | @Override 40 | protected void getContent(ByteBuffer byteBuffer) { 41 | writeVersionAndFlags(byteBuffer); 42 | byteBuffer.put(Utf8.convert(xml)); 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "XmlBox{" + 48 | "xml='" + xml + '\'' + 49 | '}'; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleAlbumArtistBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public class AppleAlbumArtistBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "aART"; 9 | 10 | 11 | public AppleAlbumArtistBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | 17 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleAlbumBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleAlbumBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "\u00a9alb"; 8 | 9 | 10 | public AppleAlbumBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleArtistBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * iTunes Artist box. 6 | */ 7 | public final class AppleArtistBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "\u00a9ART"; 9 | 10 | 11 | public AppleArtistBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleCommentBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public final class AppleCommentBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "\u00a9cmt"; 9 | 10 | 11 | public AppleCommentBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleCompilationBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Compilation. 6 | */ 7 | public final class AppleCompilationBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "cpil"; 9 | 10 | 11 | public AppleCompilationBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint8AppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleCopyrightBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public final class AppleCopyrightBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "cprt"; 9 | 10 | 11 | public AppleCopyrightBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleCoverBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import java.util.logging.Logger; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | */ 8 | public final class AppleCoverBox extends AbstractAppleMetaDataBox { 9 | private static Logger LOG = Logger.getLogger(AppleCoverBox.class.getName()); 10 | public static final String TYPE = "covr"; 11 | 12 | 13 | public AppleCoverBox() { 14 | super(TYPE); 15 | } 16 | 17 | 18 | public void setPng(byte[] pngData) { 19 | appleDataBox = new AppleDataBox(); 20 | appleDataBox.setVersion(0); 21 | appleDataBox.setFlags(0xe); 22 | appleDataBox.setFourBytes(new byte[4]); 23 | appleDataBox.setData(pngData); 24 | } 25 | 26 | 27 | public void setJpg(byte[] jpgData) { 28 | appleDataBox = new AppleDataBox(); 29 | appleDataBox.setVersion(0); 30 | appleDataBox.setFlags(0xd); 31 | appleDataBox.setFourBytes(new byte[4]); 32 | appleDataBox.setData(jpgData); 33 | } 34 | 35 | @Override 36 | public void setValue(String value) { 37 | LOG.warning("---"); 38 | } 39 | 40 | @Override 41 | public String getValue() { 42 | return "---"; 43 | } 44 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleCustomGenreBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.coremedia.iso.Utf8; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | */ 8 | public final class AppleCustomGenreBox extends AbstractAppleMetaDataBox { 9 | public static final String TYPE = "\u00a9gen"; 10 | 11 | 12 | public AppleCustomGenreBox() { 13 | super(TYPE); 14 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 15 | } 16 | 17 | public void setGenre(String genre) { 18 | appleDataBox = new AppleDataBox(); 19 | appleDataBox.setVersion(0); 20 | appleDataBox.setFlags(1); 21 | appleDataBox.setFourBytes(new byte[4]); 22 | appleDataBox.setData(Utf8.convert(genre)); 23 | } 24 | 25 | public String getGenre() { 26 | return Utf8.convert(appleDataBox.getData()); 27 | } 28 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleDataRateBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.apple; 18 | 19 | import com.coremedia.iso.IsoTypeReader; 20 | import com.coremedia.iso.IsoTypeWriter; 21 | import com.googlecode.mp4parser.AbstractFullBox; 22 | 23 | import java.nio.ByteBuffer; 24 | 25 | /** 26 | *

4cc = "{@value #TYPE}"

27 | */ 28 | public class AppleDataRateBox extends AbstractFullBox { 29 | public static final String TYPE = "rmdr"; 30 | private long dataRate; 31 | 32 | public AppleDataRateBox() { 33 | super(TYPE); 34 | } 35 | 36 | protected long getContentSize() { 37 | return 8; 38 | } 39 | 40 | @Override 41 | public void _parseDetails(ByteBuffer content) { 42 | parseVersionAndFlags(content); 43 | dataRate = IsoTypeReader.readUInt32(content); 44 | } 45 | 46 | @Override 47 | protected void getContent(ByteBuffer byteBuffer) { 48 | writeVersionAndFlags(byteBuffer); 49 | IsoTypeWriter.writeUInt32(byteBuffer, dataRate); 50 | } 51 | 52 | 53 | public long getDataRate() { 54 | return dataRate; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleDescriptionBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleDescriptionBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "desc"; 8 | 9 | 10 | public AppleDescriptionBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleEncoderBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public final class AppleEncoderBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "\u00a9too"; 9 | 10 | 11 | public AppleEncoderBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleGaplessPlaybackBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Gapless Playback. 6 | */ 7 | public final class AppleGaplessPlaybackBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "pgap"; 9 | 10 | 11 | public AppleGaplessPlaybackBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint8AppleDataBox(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleGenericBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.AbstractContainerBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | */ 8 | public final class AppleGenericBox extends AbstractContainerBox { 9 | public static final String TYPE = "----"; 10 | 11 | public AppleGenericBox() { 12 | super(TYPE); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleGroupingBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public final class AppleGroupingBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "\u00a9grp"; 9 | 10 | 11 | public AppleGroupingBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleIdBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleIdBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "apID"; 8 | 9 | 10 | public AppleIdBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleItemListBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.AbstractContainerBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | * undocumented iTunes MetaData Box. 8 | */ 9 | public class AppleItemListBox extends AbstractContainerBox { 10 | public static final String TYPE = "ilst"; 11 | 12 | public AppleItemListBox() { 13 | super(TYPE); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleMeanBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.Utf8; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | * Apple Meaning box. Allowed as subbox of "----" box. 12 | * 13 | * @see com.coremedia.iso.boxes.apple.AppleGenericBox 14 | */ 15 | public final class AppleMeanBox extends AbstractFullBox { 16 | public static final String TYPE = "mean"; 17 | private String meaning; 18 | 19 | public AppleMeanBox() { 20 | super(TYPE); 21 | } 22 | 23 | protected long getContentSize() { 24 | return 4 + Utf8.utf8StringLengthInBytes(meaning); 25 | } 26 | 27 | @Override 28 | public void _parseDetails(ByteBuffer content) { 29 | parseVersionAndFlags(content); 30 | meaning = IsoTypeReader.readString(content, content.remaining()); 31 | } 32 | 33 | @Override 34 | protected void getContent(ByteBuffer byteBuffer) { 35 | writeVersionAndFlags(byteBuffer); 36 | byteBuffer.put(Utf8.convert(meaning)); 37 | } 38 | 39 | public String getMeaning() { 40 | return meaning; 41 | } 42 | 43 | public void setMeaning(String meaning) { 44 | this.meaning = meaning; 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleMediaTypeBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | *

4cc = "{@value #TYPE}"

8 | * itunes MetaData comment box. 9 | */ 10 | public class AppleMediaTypeBox extends AbstractAppleMetaDataBox { 11 | private static Map mediaTypes = new HashMap(); 12 | 13 | static { 14 | mediaTypes.put("0", "Movie (is now 9)"); 15 | mediaTypes.put("1", "Normal (Music)"); 16 | mediaTypes.put("2", "Audiobook"); 17 | mediaTypes.put("6", "Music Video"); 18 | mediaTypes.put("9", "Movie"); 19 | mediaTypes.put("10", "TV Show"); 20 | mediaTypes.put("11", "Booklet"); 21 | mediaTypes.put("14", "Ringtone"); 22 | } 23 | 24 | public static final String TYPE = "stik"; 25 | 26 | 27 | public AppleMediaTypeBox() { 28 | super(TYPE); 29 | appleDataBox = AppleDataBox.getUint8AppleDataBox(); 30 | } 31 | 32 | public String getReadableValue() { 33 | if (mediaTypes.containsKey(getValue())) { 34 | return mediaTypes.get(getValue()); 35 | } else { 36 | return "unknown media type " + getValue(); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleNameBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.Utf8; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | * Apple Name box. Allowed as subbox of "----" box. 12 | * 13 | * @see AppleGenericBox 14 | */ 15 | public final class AppleNameBox extends AbstractFullBox { 16 | public static final String TYPE = "name"; 17 | private String name; 18 | 19 | public AppleNameBox() { 20 | super(TYPE); 21 | } 22 | 23 | protected long getContentSize() { 24 | return 4 + Utf8.convert(name).length; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | @Override 36 | public void _parseDetails(ByteBuffer content) { 37 | parseVersionAndFlags(content); 38 | name = IsoTypeReader.readString(content, content.remaining()); 39 | } 40 | 41 | @Override 42 | protected void getContent(ByteBuffer byteBuffer) { 43 | writeVersionAndFlags(byteBuffer); 44 | byteBuffer.put(Utf8.convert(name)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleNetworkBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleNetworkBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "tvnn"; 8 | 9 | 10 | public AppleNetworkBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/ApplePurchaseDateBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class ApplePurchaseDateBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "purd"; 8 | 9 | 10 | public ApplePurchaseDateBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleRatingBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * iTunes Rating Box. 6 | */ 7 | public final class AppleRatingBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "rtng"; 9 | 10 | 11 | public AppleRatingBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint8AppleDataBox(); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleRecordingYearBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public class AppleRecordingYearBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "\u00a9day"; 8 | 9 | 10 | public AppleRecordingYearBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleReferenceMovieBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.apple; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | public class AppleReferenceMovieBox extends AbstractContainerBox { 22 | public static final String TYPE = "rmra"; 23 | 24 | public AppleReferenceMovieBox() { 25 | super(TYPE); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleReferenceMovieDescriptorBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.apple; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | public class AppleReferenceMovieDescriptorBox extends AbstractContainerBox { 22 | public static final String TYPE = "rmda"; 23 | 24 | public AppleReferenceMovieDescriptorBox() { 25 | super(TYPE); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleShowBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleShowBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "tvsh"; 8 | 9 | 10 | public AppleShowBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleSortAlbumBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleSortAlbumBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "soal"; 8 | 9 | 10 | public AppleSortAlbumBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleStandardGenreBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleStandardGenreBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "gnre"; 8 | 9 | 10 | public AppleStandardGenreBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getUint16AppleDataBox(); 13 | } 14 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleStoreAccountTypeBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * itunes MetaData comment box. 6 | */ 7 | public class AppleStoreAccountTypeBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "akID"; 9 | 10 | 11 | public AppleStoreAccountTypeBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint8AppleDataBox(); 14 | } 15 | 16 | public String getReadableValue() { 17 | byte value = this.appleDataBox.getData()[0]; 18 | switch (value) { 19 | case 0: 20 | return "iTunes Account"; 21 | case 1: 22 | return "AOL Account"; 23 | default: 24 | return "unknown Account"; 25 | } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleSynopsisBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleSynopsisBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "ldes"; 8 | 9 | 10 | public AppleSynopsisBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTempBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Beats per minute. 6 | */ 7 | public final class AppleTempBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "tmpo"; 9 | 10 | 11 | public AppleTempBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint16AppleDataBox(); 14 | } 15 | 16 | 17 | public int getTempo() { 18 | return appleDataBox.getData()[1]; 19 | } 20 | 21 | public void setTempo(int tempo) { 22 | appleDataBox = new AppleDataBox(); 23 | appleDataBox.setVersion(0); 24 | appleDataBox.setFlags(21); 25 | appleDataBox.setFourBytes(new byte[4]); 26 | appleDataBox.setData(new byte[]{0, (byte) (tempo & 0xFF)}); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackAuthorBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleTrackAuthorBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "\u00a9wrt"; 8 | 9 | 10 | public AppleTrackAuthorBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackNumberBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleTrackNumberBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "trkn"; 8 | 9 | 10 | public AppleTrackNumberBox() { 11 | super(TYPE); 12 | } 13 | 14 | 15 | /** 16 | * @param track the actual track number 17 | * @param of number of tracks overall 18 | */ 19 | public void setTrackNumber(byte track, byte of) { 20 | appleDataBox = new AppleDataBox(); 21 | appleDataBox.setVersion(0); 22 | appleDataBox.setFlags(0); 23 | appleDataBox.setFourBytes(new byte[4]); 24 | appleDataBox.setData(new byte[]{0, 0, 0, track, 0, of, 0, 0}); 25 | } 26 | 27 | public byte getTrackNumber() { 28 | return appleDataBox.getData()[3]; 29 | } 30 | 31 | public byte getNumberOfTracks() { 32 | return appleDataBox.getData()[5]; 33 | } 34 | 35 | public void setNumberOfTracks(byte numberOfTracks) { 36 | byte[] content = appleDataBox.getData(); 37 | content[5] = numberOfTracks; 38 | appleDataBox.setData(content); 39 | } 40 | 41 | public void setTrackNumber(byte trackNumber) { 42 | byte[] content = appleDataBox.getData(); 43 | content[3] = trackNumber; 44 | appleDataBox.setData(content); 45 | } 46 | 47 | 48 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackTitleBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | */ 6 | public final class AppleTrackTitleBox extends AbstractAppleMetaDataBox { 7 | public static final String TYPE = "\u00a9nam"; 8 | 9 | 10 | public AppleTrackTitleBox() { 11 | super(TYPE); 12 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvEpisodeBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Tv Episode. 6 | */ 7 | public class AppleTvEpisodeBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "tves"; 9 | 10 | 11 | public AppleTvEpisodeBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint32AppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvEpisodeNumberBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Tv Episode. 6 | */ 7 | public class AppleTvEpisodeNumberBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "tven"; 9 | 10 | 11 | public AppleTvEpisodeNumberBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getStringAppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvSeasonBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | /** 4 | *

4cc = "{@value #TYPE}"

5 | * Tv Season. 6 | */ 7 | public final class AppleTvSeasonBox extends AbstractAppleMetaDataBox { 8 | public static final String TYPE = "tvsn"; 9 | 10 | 11 | public AppleTvSeasonBox() { 12 | super(TYPE); 13 | appleDataBox = AppleDataBox.getUint32AppleDataBox(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleWaveBox.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.AbstractContainerBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | * siDecompressionParam Atom ('wave') 8 | *

The siDecompressionParam atom provides the ability to store data specific to a given audio decompressor in the 9 | * SoundDescription record. As example, some audio decompression algorithms, such as Microsoft’s ADPCM, require a 10 | * set of out-of-band values to configure the decompressor. These are stored in an atom of this type.

11 | *

This atom contains other atoms with audio decompressor settings and is a required extension to the sound sample 12 | * description for MPEG-4 audio. A 'wave' chunk for 'mp4a' typically contains (in order) at least a 'frma' atom, an 13 | * 'mp4a' atom, an 'esds' atom, and a “Terminator Atom (0x00000000)” atom.

14 | *

The contents of other siDecompressionParam atoms are dependent on the audio decompressor. 15 | *

    16 | *
  • Size - An unsigned 32-bit integer holding the size of the decompression parameters atom
  • 17 | *
  • Type - An unsigned 32-bit field containing the four-character code 'wave'
  • 18 | *
  • Extension atoms - Atoms containing the necessary out-of-band decompression parameters for the sound decompressor. 19 | * For MPEG-4 audio ('mp4a'), this includes elementary stream descriptor ('esds'), format ('frma'), and terminator atoms.
  • 20 | *
21 | *

Possible paths: /moov/trak/mdia/minf/stbl/stsd/mp4a/wave/esds or /moov/trak/mdia/minf/stbl/stsd/mp4a/wave/mp4a/esds

22 | * 23 | * @author Paul Gregoire (mondain@gmail.com) 24 | */ 25 | public final class AppleWaveBox extends AbstractContainerBox { 26 | public static final String TYPE = "wave"; 27 | 28 | public AppleWaveBox() { 29 | super(TYPE); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/fragment/MovieExtendsBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.fragment; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * aligned(8) class MovieExtendsBox extends Box('mvex'){ 24 | * } 25 | */ 26 | public class MovieExtendsBox extends AbstractContainerBox { 27 | public static final String TYPE = "mvex"; 28 | 29 | public MovieExtendsBox() { 30 | super(TYPE); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/fragment/MovieFragmentRandomAccessBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.fragment; 18 | 19 | import com.googlecode.mp4parser.AbstractContainerBox; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * aligned(8) class MovieFragmentRandomAccessBox 24 | * extends Box('mfra') 25 | * { 26 | * } 27 | */ 28 | public class MovieFragmentRandomAccessBox extends AbstractContainerBox { 29 | public static final String TYPE = "mfra"; 30 | 31 | public MovieFragmentRandomAccessBox() { 32 | super(TYPE); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/fragment/TrackFragmentBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 castLabs GmbH, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.coremedia.iso.boxes.fragment; 18 | 19 | import com.coremedia.iso.boxes.Box; 20 | import com.googlecode.mp4parser.AbstractContainerBox; 21 | import com.googlecode.mp4parser.annotations.DoNotParseDetail; 22 | 23 | /** 24 | *

4cc = "{@value #TYPE}"

25 | * aligned(8) class TrackFragmentBox extends Box('traf'){ 26 | * } 27 | */ 28 | public class TrackFragmentBox extends AbstractContainerBox { 29 | public static final String TYPE = "traf"; 30 | 31 | public TrackFragmentBox() { 32 | super(TYPE); 33 | } 34 | 35 | @DoNotParseDetail 36 | public TrackFragmentHeaderBox getTrackFragmentHeaderBox() { 37 | for (Box box : getBoxes()) { 38 | if (box instanceof TrackFragmentHeaderBox) { 39 | return (TrackFragmentHeaderBox) box; 40 | } 41 | } 42 | return null; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/odf-boxes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/coremedia/iso/boxes/odf-boxes.zip -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/rtp-boxes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/coremedia/iso/boxes/rtp-boxes.zip -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/sampleentry/MpegSampleEntry.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.sampleentry; 2 | 3 | import com.coremedia.iso.BoxParser; 4 | import com.coremedia.iso.boxes.Box; 5 | import com.coremedia.iso.boxes.ContainerBox; 6 | 7 | import java.nio.ByteBuffer; 8 | import java.util.Arrays; 9 | 10 | public class MpegSampleEntry extends SampleEntry implements ContainerBox { 11 | 12 | private BoxParser boxParser; 13 | 14 | public MpegSampleEntry(String type) { 15 | super(type); 16 | } 17 | 18 | @Override 19 | public void _parseDetails(ByteBuffer content) { 20 | _parseReservedAndDataReferenceIndex(content); 21 | _parseChildBoxes(content); 22 | 23 | } 24 | 25 | @Override 26 | protected long getContentSize() { 27 | long contentSize = 8; 28 | for (Box boxe : boxes) { 29 | contentSize += boxe.getSize(); 30 | } 31 | return contentSize; 32 | } 33 | 34 | public String toString() { 35 | return "MpegSampleEntry" + Arrays.asList(getBoxes()); 36 | } 37 | 38 | @Override 39 | protected void getContent(ByteBuffer byteBuffer) { 40 | _writeReservedAndDataReferenceIndex(byteBuffer); 41 | _writeChildBoxes(byteBuffer); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/coremedia/iso/boxes/sampleentry/Ovc1VisualSampleEntryImpl.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.sampleentry; 2 | 3 | import com.coremedia.iso.IsoTypeWriter; 4 | import com.coremedia.iso.boxes.Box; 5 | 6 | import java.nio.ByteBuffer; 7 | 8 | /** 9 | *

4cc = "{@value #TYPE}"

10 | */ 11 | public class Ovc1VisualSampleEntryImpl extends SampleEntry { 12 | private byte[] vc1Content; 13 | public static final String TYPE = "ovc1"; 14 | 15 | 16 | @Override 17 | protected long getContentSize() { 18 | long size = 8; 19 | 20 | for (Box box : boxes) { 21 | size += box.getSize(); 22 | } 23 | size += vc1Content.length; 24 | return size; 25 | } 26 | 27 | @Override 28 | public void _parseDetails(ByteBuffer content) { 29 | _parseReservedAndDataReferenceIndex(content); 30 | vc1Content = new byte[content.remaining()]; 31 | content.get(vc1Content); 32 | 33 | } 34 | 35 | @Override 36 | protected void getContent(ByteBuffer byteBuffer) { 37 | byteBuffer.put(new byte[6]); 38 | IsoTypeWriter.writeUInt16(byteBuffer, getDataReferenceIndex()); 39 | byteBuffer.put(vc1Content); 40 | } 41 | 42 | 43 | protected Ovc1VisualSampleEntryImpl() { 44 | super(TYPE); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/Version.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStreamReader; 5 | import java.io.LineNumberReader; 6 | import java.util.logging.Logger; 7 | 8 | /** 9 | * The classic version object. 10 | */ 11 | public class Version { 12 | private static final Logger LOG = Logger.getLogger(Version.class.getName()); 13 | public static final String VERSION; 14 | 15 | static { 16 | LineNumberReader lnr = new LineNumberReader(new InputStreamReader(Version.class.getResourceAsStream("/version.txt"))); 17 | String version; 18 | try { 19 | version = lnr.readLine(); 20 | } catch (IOException e) { 21 | LOG.warning(e.getMessage()); 22 | version = "unknown"; 23 | } 24 | VERSION = version; 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/annotations/DoNotParseDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.annotations; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 23 | */ 24 | 25 | @Target({ElementType.METHOD, ElementType.TYPE}) 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Inherited 28 | @Documented 29 | /** 30 | * Mark a method with this annotation to prevent triggering the call of 31 | * AbstractBox#parseDetails() before actually executing the 32 | * method. 33 | * @see com.googlecode.mp4parser.RequiresParseDetailAspect 34 | */ 35 | public @interface DoNotParseDetail { 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/annotations/ParseDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Inherited; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | 26 | @Target({ElementType.METHOD, ElementType.TYPE}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Inherited 29 | @Documented 30 | public @interface ParseDetail { 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/AbstractTrack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.authoring; 18 | 19 | /** 20 | * 21 | */ 22 | public abstract class AbstractTrack implements Track { 23 | private boolean enabled = true; 24 | private boolean inMovie = true; 25 | private boolean inPreview = true; 26 | private boolean inPoster = true; 27 | 28 | public boolean isEnabled() { 29 | return enabled; 30 | } 31 | 32 | public boolean isInMovie() { 33 | return inMovie; 34 | } 35 | 36 | public boolean isInPreview() { 37 | return inPreview; 38 | } 39 | 40 | public boolean isInPoster() { 41 | return inPoster; 42 | } 43 | 44 | public void setEnabled(boolean enabled) { 45 | this.enabled = enabled; 46 | } 47 | 48 | public void setInMovie(boolean inMovie) { 49 | this.inMovie = inMovie; 50 | } 51 | 52 | public void setInPreview(boolean inPreview) { 53 | this.inPreview = inPreview; 54 | } 55 | 56 | public void setInPoster(boolean inPoster) { 57 | this.inPoster = inPoster; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/DateHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring; 17 | 18 | import java.util.Date; 19 | 20 | /** 21 | * Converts ISO Dates (seconds since 1/1/1904) to Date and vice versa. 22 | */ 23 | public class DateHelper { 24 | /** 25 | * Converts a long value with seconds since 1/1/1904 to Date. 26 | * 27 | * @param secondsSince seconds since 1/1/1904 28 | * @return date the corresponding Date 29 | */ 30 | static public Date convert(long secondsSince) { 31 | return new Date((secondsSince - 2082844800L) * 1000L); 32 | } 33 | 34 | 35 | /** 36 | * Converts a date as long to a mac date as long 37 | * 38 | * @param date date to convert 39 | * @return date in mac format 40 | */ 41 | static public long convert(Date date) { 42 | return (date.getTime() / 1000L) + 2082844800L; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/Track.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring; 17 | 18 | import com.coremedia.iso.boxes.*; 19 | 20 | import java.nio.ByteBuffer; 21 | import java.util.List; 22 | 23 | /** 24 | * Represents a Track. A track is a timed sequence of related samples. 25 | *

26 | * NOTE:
getDecodingTimeEntries(); 35 | 36 | List getCompositionTimeEntries(); 37 | 38 | long[] getSyncSamples(); 39 | 40 | List getSampleDependencies(); 41 | 42 | TrackMetaData getTrackMetaData(); 43 | 44 | String getHandler(); 45 | 46 | boolean isEnabled(); 47 | 48 | boolean isInMovie(); 49 | 50 | boolean isInPreview(); 51 | 52 | boolean isInPoster(); 53 | 54 | List getSamples(); 55 | 56 | public Box getMediaHeaderBox(); 57 | 58 | public SubSampleInformationBox getSubsampleInformationBox(); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/AudioQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.adaptivestreaming; 17 | 18 | 19 | public class AudioQuality { 20 | String fourCC; 21 | long bitrate; 22 | int audioTag; 23 | long samplingRate; 24 | int channels; 25 | int bitPerSample; 26 | int packetSize; 27 | String language; 28 | String codecPrivateData; 29 | } 30 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/ManifestWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.adaptivestreaming; 17 | 18 | 19 | import com.googlecode.mp4parser.authoring.Movie; 20 | import com.googlecode.mp4parser.authoring.Track; 21 | 22 | import java.io.IOException; 23 | 24 | public interface ManifestWriter { 25 | String getManifest(Movie inputs) throws IOException; 26 | 27 | long getBitrate(Track track); 28 | 29 | long[] calculateFragmentDurations(Track track, Movie movie); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/PackageWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.adaptivestreaming; 17 | 18 | import com.googlecode.mp4parser.authoring.Movie; 19 | 20 | import java.io.IOException; 21 | 22 | /** 23 | * Writes the whole package. 24 | */ 25 | public interface PackageWriter { 26 | public void write(Movie qualities) throws IOException; 27 | } 28 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/VideoQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.adaptivestreaming; 17 | 18 | class VideoQuality { 19 | long bitrate; 20 | String fourCC; 21 | int width; 22 | int height; 23 | String codecPrivateData; 24 | int nalLength; 25 | } 26 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/builder/FragmentIntersectionFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.builder; 17 | 18 | import com.googlecode.mp4parser.authoring.Movie; 19 | import com.googlecode.mp4parser.authoring.Track; 20 | 21 | /** 22 | * 23 | */ 24 | public interface FragmentIntersectionFinder { 25 | /** 26 | * Gets the ordinal number of the samples which will be the first sample 27 | * in each fragment. 28 | * 29 | * @param track concerned track 30 | * @param movie the context of the track 31 | * @return an array containing the ordinal of each fragment's first sample 32 | */ 33 | public long[] sampleNumbers(Track track, Movie movie); 34 | } 35 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/authoring/builder/Mp4Builder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.authoring.builder; 17 | 18 | import com.coremedia.iso.IsoFile; 19 | import com.googlecode.mp4parser.authoring.Movie; 20 | 21 | /** 22 | * Transforms a Movie object to an IsoFile. Implementations can 23 | * determine the specific format: Fragmented MP4, MP4, MP4 with Apple Metadata, 24 | * MP4 with 3GPP Metadata, MOV. 25 | */ 26 | public interface Mp4Builder { 27 | /** 28 | * Builds the actual IsoFile from the Movie. 29 | * 30 | * @param movie data source 31 | * @return the freshly built IsoFile 32 | */ 33 | public IsoFile build(Movie movie); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/adobe/ActionMessageFormat0SampleEntryBox.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.adobe; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | import com.coremedia.iso.boxes.sampleentry.SampleEntry; 5 | 6 | import java.nio.ByteBuffer; 7 | 8 | /** 9 | *

4cc = "{@value #TYPE}"

10 | * Sample Entry as used for Action Message Format tracks. 11 | */ 12 | public class ActionMessageFormat0SampleEntryBox extends SampleEntry { 13 | public static final String TYPE = "amf0"; 14 | 15 | public ActionMessageFormat0SampleEntryBox() { 16 | super(TYPE); 17 | } 18 | 19 | @Override 20 | protected long getContentSize() { 21 | long size = 8; 22 | for (Box box : boxes) { 23 | size += box.getSize(); 24 | } 25 | 26 | return size; 27 | } 28 | 29 | 30 | @Override 31 | public void _parseDetails(ByteBuffer content) { 32 | _parseReservedAndDataReferenceIndex(content); 33 | _parseChildBoxes(content); 34 | } 35 | 36 | @Override 37 | protected void getContent(ByteBuffer byteBuffer) { 38 | _writeReservedAndDataReferenceIndex(byteBuffer); 39 | _writeChildBoxes(byteBuffer); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/CleanApertureAtom.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.IsoTypeWriter; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | * A container atom that stores information for video correction in the form of three required atoms. 12 | * This atom is optionally included in the track atom. The type of the track aperture mode dimensions 13 | * atom is 'tapt'. 14 | */ 15 | public class CleanApertureAtom extends AbstractFullBox { 16 | public static final String TYPE = "clef"; 17 | 18 | double width; 19 | double height; 20 | 21 | public CleanApertureAtom() { 22 | super(TYPE); 23 | } 24 | 25 | 26 | @Override 27 | protected long getContentSize() { 28 | return 12; 29 | } 30 | 31 | @Override 32 | protected void getContent(ByteBuffer byteBuffer) { 33 | writeVersionAndFlags(byteBuffer); 34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width); 35 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height); 36 | } 37 | 38 | @Override 39 | protected void _parseDetails(ByteBuffer content) { 40 | parseVersionAndFlags(content); 41 | width = IsoTypeReader.readFixedPoint1616(content); 42 | height = IsoTypeReader.readFixedPoint1616(content); 43 | } 44 | 45 | public double getWidth() { 46 | return width; 47 | } 48 | 49 | public void setWidth(double width) { 50 | this.width = width; 51 | } 52 | 53 | public double getHeight() { 54 | return height; 55 | } 56 | 57 | public void setHeight(double height) { 58 | this.height = height; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/GenericMediaHeaderAtom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.boxes.apple; 17 | 18 | import com.googlecode.mp4parser.AbstractContainerBox; 19 | 20 | /** 21 | *

4cc = "{@value #TYPE}"

22 | */ 23 | public class GenericMediaHeaderAtom extends AbstractContainerBox { 24 | 25 | public static final String TYPE = "gmhd"; 26 | 27 | public GenericMediaHeaderAtom() { 28 | super(TYPE); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TimeCodeBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.boxes.apple; 17 | 18 | import com.coremedia.iso.boxes.Box; 19 | import com.coremedia.iso.boxes.sampleentry.SampleEntry; 20 | 21 | import java.nio.ByteBuffer; 22 | 23 | /** 24 | *

4cc = "{@value #TYPE}"

25 | */ 26 | public class TimeCodeBox extends SampleEntry { 27 | public static final String TYPE = "tmcd"; 28 | 29 | byte[] data; 30 | 31 | 32 | public TimeCodeBox() { 33 | super(TYPE); 34 | } 35 | 36 | @Override 37 | protected long getContentSize() { 38 | long size = 26; 39 | for (Box box : boxes) { 40 | size += box.getSize(); 41 | } 42 | return size; 43 | } 44 | 45 | @Override 46 | public void _parseDetails(ByteBuffer content) { 47 | _parseReservedAndDataReferenceIndex(content); 48 | data = new byte[18]; 49 | content.get(data); 50 | _parseChildBoxes(content); 51 | } 52 | 53 | @Override 54 | protected void getContent(ByteBuffer byteBuffer) { 55 | _writeReservedAndDataReferenceIndex(byteBuffer); 56 | byteBuffer.put(data); 57 | _writeChildBoxes(byteBuffer); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackApertureModeDimensionAtom.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.AbstractContainerBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | * Don't know what it is but it is obviously a container box. 8 | */ 9 | public class TrackApertureModeDimensionAtom extends AbstractContainerBox { 10 | public static final String TYPE = "tapt"; 11 | 12 | public TrackApertureModeDimensionAtom() { 13 | super(TYPE); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackEncodedPixelsDimensionsAtom.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.IsoTypeWriter; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | * This atom carries the pixel dimensions of the track’s encoded pixels. 12 | * The type of the track encoded pixels dimensions atom is 'enof'. 13 | */ 14 | public class TrackEncodedPixelsDimensionsAtom extends AbstractFullBox { 15 | public static final String TYPE = "enof"; 16 | 17 | double width; 18 | double height; 19 | 20 | public TrackEncodedPixelsDimensionsAtom() { 21 | super(TYPE); 22 | } 23 | 24 | 25 | @Override 26 | protected long getContentSize() { 27 | return 12; 28 | } 29 | 30 | @Override 31 | protected void getContent(ByteBuffer byteBuffer) { 32 | writeVersionAndFlags(byteBuffer); 33 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width); 34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height); 35 | } 36 | 37 | @Override 38 | protected void _parseDetails(ByteBuffer content) { 39 | parseVersionAndFlags(content); 40 | width = IsoTypeReader.readFixedPoint1616(content); 41 | height = IsoTypeReader.readFixedPoint1616(content); 42 | } 43 | 44 | public double getWidth() { 45 | return width; 46 | } 47 | 48 | public void setWidth(double width) { 49 | this.width = width; 50 | } 51 | 52 | public double getHeight() { 53 | return height; 54 | } 55 | 56 | public void setHeight(double height) { 57 | this.height = height; 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackProductionApertureDimensionsAtom.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoTypeReader; 4 | import com.coremedia.iso.IsoTypeWriter; 5 | import com.googlecode.mp4parser.AbstractFullBox; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | /** 10 | *

4cc = "{@value #TYPE}"

11 | * This atom carries the pixel dimensions of the track’s production aperture. The type of 12 | * the track production aperture dimensions atom is 'prof'. 13 | */ 14 | public class TrackProductionApertureDimensionsAtom extends AbstractFullBox { 15 | public static final String TYPE = "prof"; 16 | 17 | double width; 18 | double height; 19 | 20 | public TrackProductionApertureDimensionsAtom() { 21 | super(TYPE); 22 | } 23 | 24 | 25 | @Override 26 | protected long getContentSize() { 27 | return 12; 28 | } 29 | 30 | @Override 31 | protected void getContent(ByteBuffer byteBuffer) { 32 | writeVersionAndFlags(byteBuffer); 33 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width); 34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height); 35 | } 36 | 37 | @Override 38 | protected void _parseDetails(ByteBuffer content) { 39 | parseVersionAndFlags(content); 40 | width = IsoTypeReader.readFixedPoint1616(content); 41 | height = IsoTypeReader.readFixedPoint1616(content); 42 | } 43 | 44 | public double getWidth() { 45 | return width; 46 | } 47 | 48 | public void setWidth(double width) { 49 | this.width = width; 50 | } 51 | 52 | public double getHeight() { 53 | return height; 54 | } 55 | 56 | public void setHeight(double height) { 57 | this.height = height; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/basemediaformat/SampleEncryptionBox.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.basemediaformat; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | * aligned(8) class AbstractSampleEncryptionBox extends FullBox(‘uuid’, extended_type= 0xA2394F52-5A9B-4f14-A244-6C427C648DF4, version=0, flags=0) 8 | * { 9 | *

10 | * unsigned int (32) sample_count; 11 | * { 12 | * unsigned int(16) InitializationVector; 13 | * }[ sample_count ] 14 | * } 15 | */ 16 | public class SampleEncryptionBox extends AbstractSampleEncryptionBox { 17 | public static final String TYPE = "senc"; 18 | 19 | /** 20 | * Creates a SampleEncryptionBox for non-h264 tracks. 21 | */ 22 | public SampleEncryptionBox() { 23 | super(TYPE); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/basemediaformat/TrackEncryptionBox.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.basemediaformat; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBox; 4 | 5 | /** 6 | *

4cc = "{@value #TYPE}"

7 | */ 8 | public class TrackEncryptionBox extends AbstractTrackEncryptionBox { 9 | public static final String TYPE = "tenc"; 10 | 11 | public TrackEncryptionBox() { 12 | super(TYPE); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4-boxes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4-boxes.zip -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/ESDescriptorBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 castLabs, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.boxes.mp4; 18 | 19 | import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.ESDescriptor; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * ES Descriptor Box. 24 | */ 25 | public class ESDescriptorBox extends AbstractDescriptorBox { 26 | public static final String TYPE = "esds"; 27 | 28 | public ESDescriptorBox() { 29 | super(TYPE); 30 | } 31 | 32 | public ESDescriptor getEsDescriptor() { 33 | return (ESDescriptor) super.getDescriptor(); 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/BitReaderBuffer.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | public class BitReaderBuffer { 6 | 7 | private ByteBuffer buffer; 8 | int initialPos; 9 | int position; 10 | 11 | public BitReaderBuffer(ByteBuffer buffer) { 12 | this.buffer = buffer; 13 | initialPos = buffer.position(); 14 | } 15 | 16 | public int readBits(int i) { 17 | byte b = buffer.get(initialPos + position / 8); 18 | int v = b < 0 ? b + 256 : b; 19 | int left = 8 - position % 8; 20 | int rc; 21 | if (i <= left) { 22 | rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); 23 | position += i; 24 | } else { 25 | int now = left; 26 | int then = i - left; 27 | rc = readBits(now); 28 | rc = rc << then; 29 | rc += readBits(then); 30 | } 31 | buffer.position(initialPos + (int) Math.ceil((double) position / 8)); 32 | return rc; 33 | } 34 | 35 | public int getPosition() { 36 | return position; 37 | } 38 | 39 | public int byteSync() { 40 | int left = 8 - position % 8; 41 | if (left == 8) { 42 | left = 0; 43 | } 44 | readBits(left); 45 | return left; 46 | } 47 | 48 | public int remainingBits() { 49 | return buffer.limit() * 8 - position; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/BitWriterBuffer.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | public class BitWriterBuffer { 6 | 7 | private ByteBuffer buffer; 8 | int initialPos; 9 | int position = 0; 10 | 11 | public BitWriterBuffer(ByteBuffer buffer) { 12 | this.buffer = buffer; 13 | this.initialPos = buffer.position(); 14 | } 15 | 16 | public void writeBits(int i, int numBits) { 17 | assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + 18 | "Please mask the value before writing it and make your code is really working as intended.", i, (1< 127 ? current - 256 : current)); 26 | position += numBits; 27 | } else { 28 | int bitsSecondWrite = numBits - left; 29 | writeBits(i >> bitsSecondWrite, left); 30 | writeBits(i & (1 << bitsSecondWrite) - 1, bitsSecondWrite); 31 | } 32 | buffer.position(initialPos + position / 8 + ((position % 8 > 0) ? 1 : 0)); 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/Descriptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 castLabs, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | *

4cc = "{@value #TYPE}"

23 | * Created by IntelliJ IDEA. 24 | * User: mstattma 25 | * Date: 06.08.2010 26 | * Time: 06:54:58 27 | * To change this template use File | Settings | File Templates. 28 | */ 29 | @Documented 30 | @Target(ElementType.TYPE) 31 | @Retention(RetentionPolicy.RUNTIME) 32 | public @interface Descriptor { 33 | int[] tags(); 34 | 35 | int objectTypeIndication() default -1; 36 | } 37 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/ObjectDescriptorBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 castLabs, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors; 18 | 19 | /* 20 | abstract class ObjectDescriptorBase extends BaseDescriptor : bit(8) 21 | tag=[ObjectDescrTag..InitialObjectDescrTag] { 22 | // empty. To be filled by classes extending this class. 23 | } 24 | */ 25 | @Descriptor(tags = 0x00) 26 | public abstract class ObjectDescriptorBase extends BaseDescriptor { 27 | } 28 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/UnknownDescriptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 castLabs, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors; 18 | 19 | import java.io.IOException; 20 | import java.nio.ByteBuffer; 21 | import java.util.logging.Logger; 22 | 23 | public class UnknownDescriptor extends BaseDescriptor { 24 | private ByteBuffer data; 25 | private static Logger log = Logger.getLogger(UnknownDescriptor.class.getName()); 26 | 27 | @Override 28 | public void parseDetail(ByteBuffer bb) throws IOException { 29 | data = (ByteBuffer) bb.slice().limit(this.getSizeOfInstance()); 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | final StringBuilder sb = new StringBuilder(); 35 | sb.append("UnknownDescriptor"); 36 | sb.append("{tag=").append(tag); 37 | sb.append(", sizeOfInstance=").append(sizeOfInstance); 38 | sb.append(", data=").append(data); 39 | sb.append('}'); 40 | return sb.toString(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/samplegrouping/GroupEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 castLabs, Berlin 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.mp4parser.boxes.mp4.samplegrouping; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | public abstract class GroupEntry { 22 | public abstract void parse(ByteBuffer byteBuffer); 23 | public abstract ByteBuffer get(); 24 | 25 | public int size() { 26 | return get().limit(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/piff/PiffSampleEncryptionBox.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.piff; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBox; 4 | 5 | /** 6 | *
 7 |  * aligned(8) class SampleEncryptionBox extends FullBox(‘uuid’, extended_type= 0xA2394F52-5A9B-4f14-A244-6C427C648DF4, version=0, flags=0)
 8 |  * {
 9 |  *  if (flags & 0x000001)
10 |  *  {
11 |  *   unsigned int(24) AlgorithmID;
12 |  *   unsigned int(8) IV_size;
13 |  *   unsigned int(8)[16] KID;
14 |  *  }
15 |  *  unsigned int (32) sample_count;
16 |  *  {
17 |  *   unsigned int(IV_size) InitializationVector;
18 |  *   if (flags & 0x000002)
19 |  *   {
20 |  *    unsigned int(16) NumberOfEntries;
21 |  *    {
22 |  *     unsigned int(16) BytesOfClearData;
23 |  *     unsigned int(32) BytesOfEncryptedData;
24 |  *    } [ NumberOfEntries]
25 |  *   }
26 |  *  }[ sample_count ]
27 |  * }
28 |  * 
29 | */ 30 | public class PiffSampleEncryptionBox extends AbstractSampleEncryptionBox { 31 | 32 | /** 33 | * Creates a AbstractSampleEncryptionBox for non-h264 tracks. 34 | */ 35 | public PiffSampleEncryptionBox() { 36 | super("uuid"); 37 | 38 | } 39 | 40 | @Override 41 | public byte[] getUserType() { 42 | return new byte[]{(byte) 0xA2, 0x39, 0x4F, 0x52, 0x5A, (byte) 0x9B, 0x4f, 0x14, (byte) 0xA2, 0x44, 0x6C, 0x42, 0x7C, 0x64, (byte) 0x8D, (byte) 0xF4}; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/boxes/piff/PiffTrackEncryptionBox.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.piff; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBox; 4 | 5 | /** 6 | * aligned(8) class TrackEncryptionBox extends FullBox(‘uuid’, 7 | * extended_type=0x8974dbce-7be7-4c51-84f9-7148f9882554, version=0, 8 | * flags=0) 9 | * { 10 | * unsigned int(24) default_AlgorithmID; 11 | * unsigned int(8) default_IV_size; 12 | * unsigned int(8)[16] default_KID; 13 | * } 14 | */ 15 | public class PiffTrackEncryptionBox extends AbstractTrackEncryptionBox { 16 | 17 | 18 | public PiffTrackEncryptionBox() { 19 | super("uuid"); 20 | } 21 | 22 | @Override 23 | public byte[] getUserType() { 24 | return new byte[]{(byte) 0x89, 0x74, (byte) 0xdb, (byte) 0xce, 0x7b, (byte) 0xe7, 0x4c, 0x51, 25 | (byte) 0x84, (byte) 0xf9, 0x71, 0x48, (byte) 0xf9, (byte) 0x88, 0x25, 0x54}; 26 | } 27 | 28 | @Override 29 | public int getFlags() { 30 | return 0; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/h264/model/AspectRatio.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Stanislav Vitvitskiy 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. 20 | */ 21 | package com.googlecode.mp4parser.h264.model; 22 | 23 | /** 24 | * Aspect ratio 25 | *

26 | * dynamic enum 27 | * 28 | * @author Stanislav Vitvitskiy 29 | */ 30 | public class AspectRatio { 31 | 32 | public static final AspectRatio Extended_SAR = new AspectRatio(255); 33 | 34 | private int value; 35 | 36 | private AspectRatio(int value) { 37 | this.value = value; 38 | } 39 | 40 | public static AspectRatio fromValue(int value) { 41 | if (value == Extended_SAR.value) { 42 | return Extended_SAR; 43 | } 44 | return new AspectRatio(value); 45 | } 46 | 47 | public int getValue() { 48 | return value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/h264/model/BitstreamElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Stanislav Vitvitskiy 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. 20 | */ 21 | package com.googlecode.mp4parser.h264.model; 22 | 23 | import java.io.IOException; 24 | import java.io.OutputStream; 25 | 26 | public abstract class BitstreamElement { 27 | 28 | public abstract void write(OutputStream out) throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/h264/model/ScalingMatrix.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Stanislav Vitvitskiy 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. 20 | */ 21 | package com.googlecode.mp4parser.h264.model; 22 | 23 | import java.util.Arrays; 24 | 25 | public class ScalingMatrix { 26 | 27 | public ScalingList[] ScalingList4x4; 28 | public ScalingList[] ScalingList8x8; 29 | 30 | @Override 31 | public String toString() { 32 | return "ScalingMatrix{" + 33 | "ScalingList4x4=" + (ScalingList4x4 == null ? null : Arrays.asList(ScalingList4x4)) + "\n" + 34 | ", ScalingList8x8=" + (ScalingList8x8 == null ? null : Arrays.asList(ScalingList8x8)) + "\n" + 35 | '}'; 36 | } 37 | } -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/AndroidLogger.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.util; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Logs on Android. 7 | */ 8 | public class AndroidLogger extends Logger { 9 | String name; 10 | private static final String TAG = "isoparser"; 11 | 12 | public AndroidLogger(String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public void logDebug(String message) { 18 | Log.d(TAG, name + ":" + message); 19 | } 20 | 21 | @Override 22 | public void logWarn(String message) { 23 | Log.w(TAG, name + ":" + message); 24 | } 25 | 26 | @Override 27 | public void logError(String message) { 28 | Log.e(TAG, name + ":" + message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/CastUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.util; 17 | 18 | 19 | public class CastUtils { 20 | /** 21 | * Casts a long to an int. In many cases I use a long for a UInt32 but this cannot be used to allocate 22 | * ByteBuffers or arrays since they restricted to Integer.MAX_VALUE this cast-method will throw 23 | * a RuntimeException if the cast would cause a loss of information. 24 | * 25 | * @param l the long value 26 | * @return the long value as int 27 | */ 28 | public static int l2i(long l) { 29 | if (l > Integer.MAX_VALUE || l < Integer.MIN_VALUE) { 30 | throw new RuntimeException("A cast to int has gone wrong. Please contact the mp4parser discussion group (" + l + ")"); 31 | } 32 | return (int) l; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/JuliLogger.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.util; 2 | 3 | import java.util.logging.Level; 4 | 5 | public class JuliLogger extends Logger { 6 | java.util.logging.Logger logger; 7 | 8 | public JuliLogger(String name) { 9 | logger = java.util.logging.Logger.getLogger(name); 10 | } 11 | 12 | @Override 13 | public void logDebug(String message) { 14 | logger.log(Level.FINE, message); 15 | } 16 | 17 | @Override 18 | public void logWarn(String message) { 19 | logger.log(Level.WARNING, message); 20 | } 21 | 22 | @Override 23 | public void logError(String message) { 24 | logger.log(Level.SEVERE, message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/Logger.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.util; 2 | 3 | public abstract class Logger { 4 | 5 | public static Logger getLogger(Class clz) { 6 | 7 | if (System.getProperty("java.vm.name").equalsIgnoreCase("Dalvik")) { 8 | return new AndroidLogger(clz.getSimpleName()); 9 | } else { 10 | return new JuliLogger(clz.getSimpleName()); 11 | } 12 | } 13 | 14 | public abstract void logDebug(String message); 15 | 16 | public abstract void logWarn(String message); 17 | 18 | public abstract void logError(String message); 19 | } 20 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/Math.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.util; 2 | 3 | public class Math { 4 | public static long gcd(long a, long b) { 5 | while (b > 0) { 6 | long temp = b; 7 | b = a % b; // % is remainder 8 | a = temp; 9 | } 10 | return a; 11 | } 12 | 13 | public static int gcd(int a, int b) { 14 | while (b > 0) { 15 | int temp = b; 16 | b = a % b; // % is remainder 17 | a = temp; 18 | } 19 | return a; 20 | } 21 | 22 | public static long lcm(long a, long b) { 23 | return a * (b / gcd(a, b)); 24 | } 25 | 26 | public static int lcm(int a, int b) { 27 | return a * (b / gcd(a, b)); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /isoparser/src/main/java/com/googlecode/mp4parser/util/UUIDConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Sebastian Annies, Hamburg 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an AS IS BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.mp4parser.util; 17 | 18 | import java.nio.ByteBuffer; 19 | import java.nio.ByteOrder; 20 | import java.util.UUID; 21 | 22 | /** 23 | * UUID from/to byte array. 24 | */ 25 | public class UUIDConverter { 26 | public static byte[] convert(UUID uuid) { 27 | 28 | long msb = uuid.getMostSignificantBits(); 29 | long lsb = uuid.getLeastSignificantBits(); 30 | byte[] buffer = new byte[16]; 31 | 32 | for (int i = 0; i < 8; i++) { 33 | buffer[i] = (byte) (msb >>> 8 * (7 - i)); 34 | } 35 | for (int i = 8; i < 16; i++) { 36 | buffer[i] = (byte) (lsb >>> 8 * (7 - i)); 37 | } 38 | 39 | return buffer; 40 | 41 | } 42 | 43 | public static UUID convert(byte[] uuidBytes) { 44 | ByteBuffer b = ByteBuffer.wrap(uuidBytes); 45 | b.order(ByteOrder.BIG_ENDIAN); 46 | return new UUID(b.getLong(), b.getLong()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /isoparser/src/main/resources/NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Apache Maven distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | CoreMedia AG (http://www.coremedia.com/). 9 | 10 | This product includes software developed by 11 | castLabs GmbH (http://www.castlabs.com/). 12 | 13 | This product includes software developed by 14 | Sebastian Annies (Sebastian.Annies@gmail.com) 15 | 16 | This product includes software (Hex Encoder extracted from commons-codec) developed by 17 | The Apache Software Foundation (http://www.apache.org/). 18 | 19 | This product includes software (package com.googlecode.mp4parser.h264) developed by 20 | Stanislav Vitvitskiy and originally licensed under MIT license (http://www.opensource.org/licenses/mit-license.php) 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /isoparser/src/main/resources/version.txt: -------------------------------------------------------------------------------- 1 | ${project.artifactId}-${project.version} -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/IsoFileTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso; 2 | 3 | import junit.framework.TestCase; 4 | 5 | /** 6 | * 7 | */ 8 | public class IsoFileTest extends TestCase { 9 | public void testFourCC() { 10 | assertEquals("AA\0\0", IsoFile.bytesToFourCC(new byte[]{65, 65})); 11 | assertEquals("AAAA", IsoFile.bytesToFourCC(new byte[]{65, 65, 65, 65, 65, 65})); 12 | assertEquals("AAAA", new String(IsoFile.fourCCtoBytes("AAAAAAA"))); 13 | assertEquals("AA\0\0", new String(IsoFile.fourCCtoBytes("AA"))); 14 | assertEquals("\0\0\0\0", new String(IsoFile.fourCCtoBytes(null))); 15 | assertEquals("\0\0\0\0", new String(IsoFile.fourCCtoBytes(""))); 16 | assertEquals("\0\0\0\0", IsoFile.bytesToFourCC(null)); 17 | assertEquals("\0\0\0\0", IsoFile.bytesToFourCC(new byte[0])); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/PropertyBoxParserImplTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class PropertyBoxParserImplTest { 7 | 8 | 9 | @Test 10 | public void test_isoparser_custom_properties() { 11 | PropertyBoxParserImpl bp = new PropertyBoxParserImpl(); 12 | Assert.assertEquals("b", bp.mapping.get("a")); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/EditListBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created with IntelliJ IDEA. 10 | * User: sannies 11 | * Date: 11/18/12 12 | * Time: 10:42 PM 13 | * To change this template use File | Settings | File Templates. 14 | */ 15 | public class EditListBoxTest extends BoxWriteReadBase { 16 | @Override 17 | public Class getBoxUnderTest() { 18 | return EditListBox.class; 19 | } 20 | 21 | @Override 22 | public void setupProperties(Map addPropsHere, EditListBox box) { 23 | addPropsHere.put("entries", Arrays.asList(new EditListBox.Entry(box, 12423, 0, 1), new EditListBox.Entry(box, 12423, 0, 0.5))); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/MovieHeaderBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | 8 | public class MovieHeaderBoxTest extends BoxWriteReadBase { 9 | @Override 10 | public Class getBoxUnderTest() { 11 | return MovieHeaderBox.class; 12 | } 13 | 14 | @Override 15 | public void setupProperties(Map addPropsHere, MovieHeaderBox box) { 16 | addPropsHere.put("creationTime", (long) 3453453345l); 17 | addPropsHere.put("currentTime", (int) 2342); 18 | addPropsHere.put("duration", (long) 243423); 19 | addPropsHere.put("matrix", (long[]) new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9}); 20 | addPropsHere.put("modificationTime", (long) 423); 21 | addPropsHere.put("nextTrackId", (long) 5543); 22 | addPropsHere.put("posterTime", (int) 5433); 23 | addPropsHere.put("previewDuration", (int) 5343); 24 | addPropsHere.put("previewTime", (int) 666); 25 | addPropsHere.put("rate", (double) 1); 26 | addPropsHere.put("selectionDuration", (int) 32); 27 | addPropsHere.put("selectionTime", (int) 4456); 28 | addPropsHere.put("timescale", (long) 7565); 29 | addPropsHere.put("volume", (float) 1.0); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/SampleDependencyTypeBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.util.ByteBufferByteChannel; 4 | import junit.framework.Assert; 5 | import org.junit.Test; 6 | 7 | import java.io.ByteArrayOutputStream; 8 | import java.nio.ByteBuffer; 9 | import java.nio.channels.Channels; 10 | import java.util.LinkedList; 11 | import java.util.List; 12 | 13 | /** 14 | * 15 | */ 16 | public class SampleDependencyTypeBoxTest { 17 | 18 | @Test 19 | public void testParse() throws Exception { 20 | SampleDependencyTypeBox stsc = new SampleDependencyTypeBox(); 21 | List l = new LinkedList(); 22 | for (int i = 0; i < 0xcf; i++) { 23 | SampleDependencyTypeBox.Entry e = new SampleDependencyTypeBox.Entry(i); 24 | l.add(e); 25 | } 26 | stsc.setEntries(l); 27 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 28 | stsc.getBox(Channels.newChannel(baos)); 29 | byte[] content = baos.toByteArray(); 30 | 31 | SampleDependencyTypeBox stsc2 = new SampleDependencyTypeBox(); 32 | stsc2.parse(new ByteBufferByteChannel(ByteBuffer.wrap(content, 8, content.length - 8)), null, content.length - 8, null); 33 | Assert.assertEquals(content.length, stsc2.getSize()); 34 | 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/SampleToChunkBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.googlecode.mp4parser.util.ByteBufferByteChannel; 4 | import junit.framework.Assert; 5 | import junit.framework.TestCase; 6 | 7 | import java.io.ByteArrayOutputStream; 8 | import java.nio.ByteBuffer; 9 | import java.nio.channels.Channels; 10 | import java.util.LinkedList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * User: sannies 16 | * Date: 24.02.11 17 | * Time: 12:41 18 | * To change this template use File | Settings | File Templates. 19 | */ 20 | public class SampleToChunkBoxTest extends TestCase { 21 | 22 | 23 | public void testParse() throws Exception { 24 | SampleToChunkBox stsc = new SampleToChunkBox(); 25 | List l = new LinkedList(); 26 | for (int i = 0; i < 5; i++) { 27 | SampleToChunkBox.Entry e = new SampleToChunkBox.Entry(i, 1, i * i); 28 | l.add(e); 29 | } 30 | stsc.setEntries(l); 31 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 32 | stsc.getBox(Channels.newChannel(baos)); 33 | byte[] content = baos.toByteArray(); 34 | 35 | SampleToChunkBox stsc2 = new SampleToChunkBox(); 36 | stsc2.parse(new ByteBufferByteChannel(ByteBuffer.wrap(content, 8, content.length - 8)), null, content.length - 8, null); 37 | Assert.assertEquals(content.length, stsc2.getSize()); 38 | 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/XmlBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.coremedia.iso.PropertyBoxParserImpl; 5 | import com.googlecode.mp4parser.util.ByteBufferByteChannel; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import java.io.ByteArrayOutputStream; 10 | import java.io.IOException; 11 | import java.nio.ByteBuffer; 12 | import java.nio.channels.Channels; 13 | import java.util.Properties; 14 | 15 | /** 16 | * 17 | */ 18 | public class XmlBoxTest { 19 | 20 | @Test 21 | public void simpleRoundTrip() throws IOException { 22 | XmlBox xmlBox = new XmlBox(); 23 | xmlBox.setXml(""); // but the box doesnt care if well-formed 24 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 25 | xmlBox.getBox(Channels.newChannel(baos)); 26 | 27 | Properties props = new Properties(); 28 | props.put("xml ", XmlBox.class.getName()); 29 | PropertyBoxParserImpl parser = new PropertyBoxParserImpl(props); 30 | IsoFile isoFile = new IsoFile(new ByteBufferByteChannel((ByteBuffer) ByteBuffer.wrap(baos.toByteArray()).rewind()), parser); 31 | 32 | Assert.assertTrue(!isoFile.getBoxes().isEmpty()); 33 | XmlBox xmlBox2 = (XmlBox) isoFile.getBoxes().get(0); 34 | Assert.assertEquals(xmlBox.getXml(), xmlBox2.getXml()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/apple/AbstractAppleMetaDataBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.apple; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import java.io.ByteArrayOutputStream; 7 | import java.io.IOException; 8 | import java.nio.channels.Channels; 9 | 10 | public class AbstractAppleMetaDataBoxTest { 11 | @Test 12 | public void testSetValue_9() throws IOException { 13 | class MyConcreteAppleMetaDataBox extends AbstractAppleMetaDataBox { 14 | 15 | public MyConcreteAppleMetaDataBox() { 16 | super("test"); 17 | this.appleDataBox = new AppleDataBox(); 18 | this.appleDataBox.setFlags(21); 19 | this.appleDataBox.setData(new byte[4]); 20 | } 21 | 22 | } 23 | 24 | MyConcreteAppleMetaDataBox myConcreteAppleMetaDataBox = new MyConcreteAppleMetaDataBox(); 25 | myConcreteAppleMetaDataBox.setValue("9"); 26 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 27 | myConcreteAppleMetaDataBox.getBox(Channels.newChannel(baos)); 28 | Assert.assertEquals("9", myConcreteAppleMetaDataBox.getValue()); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/coremedia/iso/boxes/sampleentry/TextSampleEntryTest.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.boxes.sampleentry; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class TextSampleEntryTest { 7 | 8 | @Test 9 | public void testBitSetters() { 10 | TextSampleEntry tx3g = new TextSampleEntry("tx3g"); 11 | tx3g.setContinuousKaraoke(true); 12 | Assert.assertTrue(tx3g.isContinuousKaraoke()); 13 | tx3g.setContinuousKaraoke(false); 14 | Assert.assertFalse(tx3g.isContinuousKaraoke()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/authoring/InTestMovieCreator.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.authoring; 2 | 3 | import com.googlecode.mp4parser.authoring.builder.SyncSampleIntersectFinderImpl; 4 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; 5 | 6 | import java.io.IOException; 7 | import java.nio.channels.Channels; 8 | 9 | 10 | public class InTestMovieCreator { 11 | public static Movie createMovieOnlyVideo(String... names) throws IOException { 12 | Movie m = new Movie(); 13 | for (String name : names) { 14 | Movie m1 = MovieCreator.build(Channels.newChannel(SyncSampleIntersectFinderImpl.class.getResourceAsStream(name))); 15 | for (Track track : m1.getTracks()) { 16 | if ("vide".equals(track.getHandler())) { 17 | m.addTrack(track); 18 | } 19 | } 20 | 21 | } 22 | return m; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/authoring/builder/TwoSecondIntersectionFinderTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.authoring.builder; 2 | 3 | import com.googlecode.mp4parser.authoring.Movie; 4 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import java.nio.channels.Channels; 9 | 10 | /** 11 | * Just check it works. 12 | */ 13 | public class TwoSecondIntersectionFinderTest { 14 | long[] samples = new long[] {1, 87, 173, 259, 345, 431, 517, 603, 690, 776, 862, 948, 1034, 1120, 1206, 1292, 1379, 1465, 1551, 1637, 1723, 1809, 1895, 1982, 2068, 2154, 2240, 2326, 2412, 2498, 2584, 2671, 2757, 2843, 2929, 3015, 3101, 3187, 3274, 3360, 3446, 3532, 3618, 3704, 3790, 3876, 3963, 4049, 4135, 4221, 4307, 4393, 4479, 4566, 4652}; 15 | 16 | @Test 17 | public void testSampleNumbers() throws Exception { 18 | Movie m = MovieCreator.build(Channels.newChannel(TwoSecondIntersectionFinderTest.class.getResourceAsStream("/Beethoven - Bagatelle op.119 no.11 i.m4a"))); 19 | TwoSecondIntersectionFinder intersectionFinder = new TwoSecondIntersectionFinder(); 20 | long[] s = intersectionFinder.sampleNumbers(m.getTracks().get(0), m); 21 | Assert.assertArrayEquals(samples, s); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/authoring/subtext/SrtParserTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.authoring.subtext; 2 | 3 | import com.googlecode.mp4parser.authoring.tracks.TextTrackImpl; 4 | import com.googlecode.mp4parser.srt.SrtParser; 5 | import org.junit.Test; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | 10 | 11 | public class SrtParserTest { 12 | @Test 13 | public void test() throws IOException { 14 | InputStream is = SrtParserTest.class.getResourceAsStream("/subs.srt"); 15 | TextTrackImpl track = SrtParser.parse(is); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/authoring/tracks/AC3TrackImplTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.authoring.tracks; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.Track; 6 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 7 | import org.junit.Test; 8 | 9 | import java.io.BufferedInputStream; 10 | import java.io.IOException; 11 | 12 | public class AC3TrackImplTest { 13 | @Test 14 | public void freeze() throws IOException { 15 | Track t = new AC3TrackImpl(new BufferedInputStream(AC3TrackImpl.class.getResourceAsStream("/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3"))); 16 | Movie m = new Movie(); 17 | m.addTrack(t); 18 | 19 | DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); 20 | IsoFile isoFile = mp4Builder.build(m); 21 | 22 | // FileChannel fc = new FileOutputStream("/home/sannies/scm/svn/mp4parser/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4").getChannel(); 23 | // isoFile.getBox(fc); 24 | // fc.close(); 25 | IsoFile isoFileReference = new IsoFile(this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile() + "/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4"); 26 | BoxComparator.check(isoFile, isoFileReference, "/moov[0]/mvhd[0]", "/moov[0]/trak[0]/tkhd[0]", "/moov[0]/trak[0]/mdia[0]/mdhd[0]"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/AbstractTrackEncryptionBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes; 2 | 3 | 4 | import com.coremedia.iso.IsoFile; 5 | import com.googlecode.mp4parser.util.ByteBufferByteChannel; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import java.io.ByteArrayOutputStream; 10 | import java.io.IOException; 11 | import java.nio.ByteBuffer; 12 | import java.nio.channels.Channels; 13 | 14 | public abstract class AbstractTrackEncryptionBoxTest { 15 | 16 | protected AbstractTrackEncryptionBox tenc; 17 | 18 | @Test 19 | public void testRoundTrip() throws IOException { 20 | tenc.setDefault_KID(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}); 21 | tenc.setDefaultAlgorithmId(0x0a0b0c); 22 | tenc.setDefaultIvSize(8); 23 | 24 | 25 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 26 | long sizeBeforeWrite = tenc.getSize(); 27 | tenc.getBox(Channels.newChannel(baos)); 28 | Assert.assertEquals(baos.size(), tenc.getSize()); 29 | Assert.assertEquals(baos.size(), sizeBeforeWrite); 30 | IsoFile iso = new IsoFile(new ByteBufferByteChannel(ByteBuffer.wrap(baos.toByteArray()))); 31 | 32 | Assert.assertTrue(iso.getBoxes().get(0) instanceof AbstractTrackEncryptionBox); 33 | AbstractTrackEncryptionBox tenc2 = (AbstractTrackEncryptionBox) iso.getBoxes().get(0); 34 | Assert.assertEquals(0, tenc2.getFlags()); 35 | Assert.assertTrue(tenc.equals(tenc2)); 36 | Assert.assertTrue(tenc2.equals(tenc)); 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/BaseMediaInfoAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * Created with IntelliJ IDEA. 9 | * User: sannies 10 | * Date: 6/24/12 11 | * Time: 3:53 PM 12 | * To change this template use File | Settings | File Templates. 13 | */ 14 | public class BaseMediaInfoAtomTest extends BoxWriteReadBase { 15 | @Override 16 | public Class getBoxUnderTest() { 17 | return BaseMediaInfoAtom.class; 18 | } 19 | 20 | @Override 21 | public void setupProperties(Map addPropsHere, BaseMediaInfoAtom box) { 22 | addPropsHere.put("balance", (short) 321); 23 | addPropsHere.put("graphicsMode", (short) 43); 24 | addPropsHere.put("opColorB", (int) 124); 25 | addPropsHere.put("opColorG", (int) 445); 26 | addPropsHere.put("opColorR", (int) 5321); 27 | addPropsHere.put("reserved", (short) 344); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/CleanApertureAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | 8 | public class CleanApertureAtomTest extends BoxWriteReadBase { 9 | @Override 10 | public Class getBoxUnderTest() { 11 | return CleanApertureAtom.class; 12 | } 13 | 14 | @Override 15 | public void setupProperties(Map addPropsHere, CleanApertureAtom box) { 16 | addPropsHere.put("height", 123.0); 17 | addPropsHere.put("width", 321.0); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/GenericMediaHeaderTextAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * Created with IntelliJ IDEA. 9 | * User: sannies 10 | * Date: 6/24/12 11 | * Time: 4:59 PM 12 | * To change this template use File | Settings | File Templates. 13 | */ 14 | public class GenericMediaHeaderTextAtomTest extends BoxWriteReadBase { 15 | public GenericMediaHeaderTextAtomTest() { 16 | super("gmhd"); 17 | } 18 | 19 | @Override 20 | public Class getBoxUnderTest() { 21 | return GenericMediaHeaderTextAtom.class; 22 | } 23 | 24 | @Override 25 | public void setupProperties(Map addPropsHere, GenericMediaHeaderTextAtom box) { 26 | addPropsHere.put("unknown_1", (int) 1); 27 | addPropsHere.put("unknown_2", (int) 2); 28 | addPropsHere.put("unknown_3", (int) 3); 29 | addPropsHere.put("unknown_4", (int) 4); 30 | addPropsHere.put("unknown_5", (int) 5); 31 | addPropsHere.put("unknown_6", (int) 6); 32 | addPropsHere.put("unknown_7", (int) 7); 33 | addPropsHere.put("unknown_8", (int) 8); 34 | addPropsHere.put("unknown_9", (int) 9); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/PixelAspectRationAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | public class PixelAspectRationAtomTest extends BoxWriteReadBase { 8 | @Override 9 | public Class getBoxUnderTest() { 10 | return PixelAspectRationAtom.class; 11 | } 12 | 13 | @Override 14 | public void setupProperties(Map addPropsHere, PixelAspectRationAtom box) { 15 | addPropsHere.put("hSpacing", 25); 16 | addPropsHere.put("vSpacing", 26); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/QuicktimeTextSampleEntryTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Collections; 6 | import java.util.Map; 7 | 8 | public class QuicktimeTextSampleEntryTest extends BoxWriteReadBase { 9 | public QuicktimeTextSampleEntryTest() { 10 | super("stsd"); 11 | } 12 | 13 | @Override 14 | public Class getBoxUnderTest() { 15 | return QuicktimeTextSampleEntry.class; 16 | } 17 | 18 | @Override 19 | public void setupProperties(Map addPropsHere, QuicktimeTextSampleEntry box) { 20 | addPropsHere.put("backgroundB", 5); 21 | addPropsHere.put("backgroundG", 10); 22 | addPropsHere.put("backgroundR", 15); 23 | addPropsHere.put("boxes", Collections.emptyList()); 24 | addPropsHere.put("dataReferenceIndex", 1); 25 | addPropsHere.put("defaultTextBox", 54634562222l); 26 | addPropsHere.put("displayFlags", 324); 27 | addPropsHere.put("reserved1", 0); 28 | addPropsHere.put("textJustification", 1); 29 | addPropsHere.put("fontFace", (short) 0); 30 | addPropsHere.put("fontName", ""); 31 | addPropsHere.put("fontNumber", (short) 0); 32 | addPropsHere.put("foregroundB", 115); 33 | addPropsHere.put("foregroundG", 120); 34 | addPropsHere.put("foregroundR", 125); 35 | addPropsHere.put("reserved2", (byte) 0); 36 | addPropsHere.put("reserved3", (short) 0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TimeCodeBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.util.ByteBufferByteChannel; 5 | import org.apache.commons.codec.DecoderException; 6 | import org.apache.commons.codec.binary.Hex; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | 10 | import java.io.IOException; 11 | import java.nio.ByteBuffer; 12 | 13 | import static com.googlecode.mp4parser.util.CastUtils.l2i; 14 | 15 | /** 16 | * Created with IntelliJ IDEA. 17 | * User: sannies 18 | * Date: 3/28/12 19 | * Time: 10:29 AM 20 | * To change this template use File | Settings | File Templates. 21 | */ 22 | public class TimeCodeBoxTest { 23 | byte[] box; 24 | 25 | public TimeCodeBoxTest() throws DecoderException { 26 | box = Hex.decodeHex(( 27 | "00000031746d63640000000000000001" + 28 | "000000000000000000000bb50000007d" + 29 | "188c0000000f6e616d65000300003030" + 30 | "31").toCharArray()); 31 | } 32 | 33 | @Test 34 | public void testParse() throws IOException { 35 | IsoFile isoFile = new IsoFile(new ByteBufferByteChannel(ByteBuffer.wrap(box))); 36 | TimeCodeBox tmcd = (TimeCodeBox) isoFile.getBoxes().get(0); 37 | ByteBuffer byteBuffer = ByteBuffer.allocate(l2i(tmcd.getSize())); 38 | tmcd.getDataReferenceIndex(); 39 | Assert.assertTrue(tmcd.isParsed()); 40 | tmcd.getBox(new ByteBufferByteChannel(byteBuffer)); 41 | Assert.assertArrayEquals(box, byteBuffer.array()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackEncodedPixelsDimensionsAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * Created with IntelliJ IDEA. 9 | * User: sannies 10 | * Date: 11/18/12 11 | * Time: 11:31 AM 12 | * To change this template use File | Settings | File Templates. 13 | */ 14 | public class TrackEncodedPixelsDimensionsAtomTest extends BoxWriteReadBase { 15 | @Override 16 | public Class getBoxUnderTest() { 17 | return TrackEncodedPixelsDimensionsAtom.class; 18 | } 19 | 20 | @Override 21 | public void setupProperties(Map addPropsHere, TrackEncodedPixelsDimensionsAtom box) { 22 | addPropsHere.put("height", 123.0); 23 | addPropsHere.put("width", 321.0); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackLoadSettingsAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * Created with IntelliJ IDEA. 9 | * User: sannies2 10 | * Date: 2/1/13 11 | * Time: 11:16 AM 12 | * To change this template use File | Settings | File Templates. 13 | */ 14 | public class TrackLoadSettingsAtomTest extends BoxWriteReadBase { 15 | @Override 16 | public Class getBoxUnderTest() { 17 | return TrackLoadSettingsAtom.class; 18 | } 19 | 20 | @Override 21 | public void setupProperties(Map addPropsHere, TrackLoadSettingsAtom box) { 22 | addPropsHere.put("defaultHints", 34); 23 | addPropsHere.put("preloadDuration", 35); 24 | addPropsHere.put("preloadFlags", 36); 25 | addPropsHere.put("preloadStartTime", 37); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackProductionApertureDimensionsAtomTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.apple; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * Created with IntelliJ IDEA. 9 | * User: sannies 10 | * Date: 11/18/12 11 | * Time: 11:32 AM 12 | * To change this template use File | Settings | File Templates. 13 | */ 14 | public class TrackProductionApertureDimensionsAtomTest extends BoxWriteReadBase { 15 | @Override 16 | public Class getBoxUnderTest() { 17 | return TrackProductionApertureDimensionsAtom.class; 18 | } 19 | 20 | @Override 21 | public void setupProperties(Map addPropsHere, TrackProductionApertureDimensionsAtom box) { 22 | addPropsHere.put("height", 123.0); 23 | addPropsHere.put("width", 321.0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/basemediaformat/SampleEncryptionBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.basemediaformat; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBoxTest; 4 | import org.junit.Before; 5 | 6 | 7 | public class SampleEncryptionBoxTest extends AbstractSampleEncryptionBoxTest { 8 | 9 | 10 | @Before 11 | public void setUp() throws Exception { 12 | senc = new SampleEncryptionBox(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/basemediaformat/TrackEncryptionBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.basemediaformat; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBoxTest; 4 | import org.junit.Before; 5 | 6 | 7 | public class TrackEncryptionBoxTest extends AbstractTrackEncryptionBoxTest { 8 | 9 | 10 | @Before 11 | public void setUp() throws Exception { 12 | tenc = new TrackEncryptionBox(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/cenc/ProtectionSystemSpecificHeaderBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.cenc; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | import java.io.ByteArrayInputStream; 8 | import java.io.ByteArrayOutputStream; 9 | import java.io.IOException; 10 | import java.nio.channels.Channels; 11 | 12 | /** 13 | * Created with IntelliJ IDEA. 14 | * User: sannies 15 | * Date: 6/8/12 16 | * Time: 3:34 PM 17 | * To change this template use File | Settings | File Templates. 18 | */ 19 | public class ProtectionSystemSpecificHeaderBoxTest { 20 | @Test 21 | public void testRoundtrip() throws IOException { 22 | ProtectionSystemSpecificHeaderBox pssh = new ProtectionSystemSpecificHeaderBox(); 23 | pssh.setSystemId(ProtectionSystemSpecificHeaderBox.OMA2_SYSTEM_ID); 24 | byte[] content = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; 25 | pssh.setContent(content); 26 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 27 | pssh.getBox(Channels.newChannel(baos)); 28 | IsoFile isoFile = new IsoFile(Channels.newChannel(new ByteArrayInputStream(baos.toByteArray()))); 29 | Assert.assertEquals(1, isoFile.getBoxes().size()); 30 | Assert.assertTrue(isoFile.getBoxes().get(0) instanceof ProtectionSystemSpecificHeaderBox); 31 | 32 | Assert.assertArrayEquals(((ProtectionSystemSpecificHeaderBox) isoFile.getBoxes().get(0)).getContent(), content); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/mp4/samplegrouping/SampleToGroupBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.mp4.samplegrouping; 2 | 3 | 4 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 5 | 6 | import java.util.Arrays; 7 | import java.util.Map; 8 | 9 | public class SampleToGroupBoxTest extends BoxWriteReadBase { 10 | @Override 11 | public Class getBoxUnderTest() { 12 | return SampleToGroupBox.class; 13 | } 14 | 15 | @Override 16 | public void setupProperties(Map addPropsHere, SampleToGroupBox box) { 17 | addPropsHere.put("entries", Arrays.asList(new SampleToGroupBox.Entry(1, 2), new SampleToGroupBox.Entry(2, 3), new SampleToGroupBox.Entry(10, 20))); 18 | addPropsHere.put("groupingType", "grp1"); 19 | addPropsHere.put("groupingTypeParameter", "gtyp"); 20 | addPropsHere.put("version", 1); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/piff/PiffSampleEncryptionBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.piff; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBoxTest; 4 | import org.junit.Before; 5 | 6 | 7 | public class PiffSampleEncryptionBoxTest extends AbstractSampleEncryptionBoxTest { 8 | 9 | 10 | @Before 11 | public void setUp() throws Exception { 12 | senc = new PiffSampleEncryptionBox(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/piff/PiffTrackEncryptionBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.piff; 2 | 3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBoxTest; 4 | import org.junit.Before; 5 | 6 | 7 | public class PiffTrackEncryptionBoxTest extends AbstractTrackEncryptionBoxTest { 8 | 9 | 10 | @Before 11 | public void setUp() throws Exception { 12 | tenc = new PiffTrackEncryptionBox(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/threegpp26244/SegmentIndexBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.threegpp26244; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | 9 | public class SegmentIndexBoxTest extends BoxWriteReadBase { 10 | @Override 11 | public Class getBoxUnderTest() { 12 | return SegmentIndexBox.class; 13 | } 14 | 15 | @Override 16 | public void setupProperties(Map values, SegmentIndexBox box) { 17 | values.put("referenceId", 726); 18 | values.put("timeScale", 725); 19 | values.put("earliestPresentationTime", 724); 20 | values.put("firstOffset", 34567); 21 | values.put("reserved", 0); 22 | values.put("entries", Arrays.asList(new SegmentIndexBox.Entry((byte) 1, 2, 3, (byte) 1, (byte) 5, 6))); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/boxes/ultraviolet/AssetInformationBoxTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.boxes.ultraviolet; 2 | 3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase; 4 | 5 | import java.util.Map; 6 | 7 | 8 | public class AssetInformationBoxTest extends BoxWriteReadBase { 9 | 10 | @Override 11 | public Class getBoxUnderTest() { 12 | return AssetInformationBox.class; 13 | } 14 | 15 | @Override 16 | public void setupProperties(Map values, AssetInformationBox box) { 17 | values.put("apid", "urn:dece:apid:com:drmtoday:beta:12345abcdef"); 18 | values.put("profileVersion", "hdv1"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /isoparser/src/test/java/com/googlecode/mp4parser/util/PathTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.util; 2 | 3 | 4 | import com.coremedia.iso.IsoFile; 5 | import com.coremedia.iso.boxes.Box; 6 | import com.coremedia.iso.boxes.TrackBox; 7 | import junit.framework.Assert; 8 | import org.junit.Before; 9 | import org.junit.Test; 10 | 11 | import java.io.IOException; 12 | import java.nio.channels.Channels; 13 | 14 | public class PathTest { 15 | IsoFile isoFile; 16 | 17 | @Before 18 | public void setup() throws IOException { 19 | isoFile = new IsoFile(Channels.newChannel(PathTest.class.getResourceAsStream("/multiTrack.3gp"))); 20 | } 21 | 22 | @Test 23 | public void testRoundTrip() throws IOException { 24 | Box b1 = isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox().getTimeToSampleBox(); 25 | String p = Path.createPath(b1); 26 | Box b2 = Path.getPath(isoFile, p); 27 | Assert.assertSame(b1, b2); 28 | } 29 | 30 | @Test 31 | public void testGetParent() throws Exception { 32 | Box b1 = isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox().getTimeToSampleBox(); 33 | Assert.assertEquals(isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox(), Path.getPath(b1, "..")); 34 | 35 | } 36 | 37 | @Test 38 | public void testComponentMatcher() { 39 | Assert.assertTrue(Path.component.matcher("abcd").matches()); 40 | Assert.assertTrue(Path.component.matcher("xml ").matches()); 41 | Assert.assertTrue(Path.component.matcher("xml [1]").matches()); 42 | Assert.assertTrue(Path.component.matcher("..").matches()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_100.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_100.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_120.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_120.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_150.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_150.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_200.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_200.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_80.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_80.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/Beethoven - Bagatelle op.119 no.11 i.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Beethoven - Bagatelle op.119 no.11 i.m4a -------------------------------------------------------------------------------- /isoparser/src/test/resources/MOV00006.3gp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/MOV00006.3gp -------------------------------------------------------------------------------- /isoparser/src/test/resources/Tiny Sample - NEW - Metaxed.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - NEW - Metaxed.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/Tiny Sample - NEW - Untouched.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - NEW - Untouched.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/Tiny Sample - OLD.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - OLD.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.aac -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3 -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.h264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.h264 -------------------------------------------------------------------------------- /isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.mp4 -------------------------------------------------------------------------------- /isoparser/src/test/resources/count-english.ac3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/count-english.ac3 -------------------------------------------------------------------------------- /isoparser/src/test/resources/count.h264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/count.h264 -------------------------------------------------------------------------------- /isoparser/src/test/resources/file6141.odf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/file6141.odf -------------------------------------------------------------------------------- /isoparser/src/test/resources/isoparser-custom.properties: -------------------------------------------------------------------------------- 1 | a=b -------------------------------------------------------------------------------- /isoparser/src/test/resources/multiTrack.3gp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/multiTrack.3gp -------------------------------------------------------------------------------- /isoparser/src/test/resources/test-pod.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/test-pod.m4a -------------------------------------------------------------------------------- /isoparser/src/test/resources/test.m4p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/test.m4p -------------------------------------------------------------------------------- /tools/isoviewer/src/etc/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/isoviewer/src/etc/keystore.jks -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/Iso8859_1.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | 5 | /** 6 | * 7 | */ 8 | public final class Iso8859_1 { 9 | 10 | 11 | public static String convert(byte[] b) { 12 | try { 13 | return new String(b, "ISO-8859-1"); 14 | } catch (UnsupportedEncodingException e) { 15 | throw new Error(e); 16 | } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/MultiLineCellRenderer.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui; 2 | 3 | import javax.swing.JList; 4 | import javax.swing.JPanel; 5 | import javax.swing.JTextArea; 6 | import javax.swing.ListCellRenderer; 7 | import java.awt.BorderLayout; 8 | import java.awt.Component; 9 | 10 | public class MultiLineCellRenderer implements ListCellRenderer { 11 | 12 | private JPanel p; 13 | private JTextArea ta; 14 | 15 | public MultiLineCellRenderer() { 16 | p = new JPanel(); 17 | p.setLayout(new BorderLayout()); 18 | 19 | 20 | // text 21 | ta = new JTextArea(); 22 | ta.setLineWrap(false); 23 | ta.setWrapStyleWord(true); 24 | p.add(ta, BorderLayout.CENTER); 25 | } 26 | 27 | 28 | public Component getListCellRendererComponent(final JList list, 29 | final Object value, final int index, final boolean isSelected, 30 | final boolean hasFocus) { 31 | 32 | ta.setText((String) value); 33 | int width = list.getWidth(); 34 | // this is just to lure the ta's internal sizing mechanism into action 35 | if (width > 0) 36 | ta.setSize(width, Short.MAX_VALUE); 37 | return p; 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/NonEditableJTextField.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui; 2 | 3 | import javax.swing.JTextField; 4 | import javax.swing.text.Document; 5 | 6 | /** 7 | * Simple convenience class for non-editable textfield 8 | */ 9 | public class NonEditableJTextField extends JTextField { 10 | public NonEditableJTextField() { 11 | } 12 | 13 | public NonEditableJTextField(String text) { 14 | this(null, text, 0); 15 | } 16 | 17 | public NonEditableJTextField(int columns) { 18 | this(null, null, columns); 19 | } 20 | 21 | public NonEditableJTextField(String text, int columns) { 22 | this(null, text, columns); 23 | } 24 | 25 | public NonEditableJTextField(Document doc, String text, int columns) { 26 | super(doc, text, columns); 27 | this.setEditable(false); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/SampleListModel.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui; 2 | 3 | import com.coremedia.iso.boxes.h264.AvcConfigurationBox; 4 | import com.coremedia.iso.boxes.mdat.SampleList; 5 | import com.coremedia.iso.boxes.sampleentry.SampleEntry; 6 | 7 | import javax.swing.AbstractListModel; 8 | import java.nio.ByteBuffer; 9 | 10 | /** 11 | * 12 | */ 13 | public class SampleListModel extends AbstractListModel { 14 | SampleList list; 15 | long trackId; 16 | SampleEntry se; 17 | private AvcConfigurationBox.AVCDecoderConfigurationRecord avcD; 18 | 19 | 20 | public SampleListModel(SampleList list, long trackId, SampleEntry se, AvcConfigurationBox.AVCDecoderConfigurationRecord avcD) { 21 | this.list = list; 22 | this.trackId = trackId; 23 | this.se = se; 24 | this.avcD = avcD; 25 | } 26 | 27 | public long getTrackId() { 28 | return trackId; 29 | } 30 | 31 | public int getSize() { 32 | return list.size(); 33 | } 34 | 35 | public Object getElementAt(int index) { 36 | ByteBuffer bb = list.get(index); 37 | long offset = list.getOffsetKeys()[index]; 38 | return new Entry(bb, offset, trackId, se, avcD); 39 | } 40 | 41 | public static class Entry { 42 | public Entry(ByteBuffer sample, long offset, long trackId, SampleEntry se, AvcConfigurationBox.AVCDecoderConfigurationRecord avcD) { 43 | this.sample = sample; 44 | this.offset = offset; 45 | this.trackId = trackId; 46 | this.se = se; 47 | this.avcD = avcD; 48 | } 49 | 50 | ByteBuffer sample; 51 | long offset; 52 | long trackId; 53 | SampleEntry se; 54 | AvcConfigurationBox.AVCDecoderConfigurationRecord avcD; 55 | } 56 | } -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/TrackListRenderer.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui; 2 | 3 | import com.coremedia.iso.boxes.TrackBox; 4 | import com.coremedia.iso.boxes.fragment.TrackFragmentBox; 5 | 6 | import javax.swing.*; 7 | import java.awt.*; 8 | 9 | /** 10 | * 11 | */ 12 | public class TrackListRenderer extends DefaultListCellRenderer { 13 | public Component getListCellRendererComponent(JList list, 14 | Object value, 15 | int index, 16 | boolean isSelected, 17 | boolean cellHasFocus) { 18 | final long trackId; 19 | if (value instanceof TrackBox) { 20 | TrackBox trackBox = ((TrackBox) value); 21 | trackId = trackBox.getTrackHeaderBox().getTrackId(); 22 | } else { 23 | TrackFragmentBox traf = ((TrackFragmentBox) value); 24 | trackId = traf.getTrackFragmentHeaderBox().getTrackId(); 25 | } 26 | value = "Track " + trackId; 27 | super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 28 | return this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/hex/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The classes in this package have been written by German Laullon and have been extracted from 2 | his SourceForge project JHeComponent (http://sourceforge.net/projects/jhecomponent/). The 3 | classes in this package (com.coremedia.iso.gui.hex) have been released by German Laullon under 4 | the GPL. -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/ByteTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:13:14 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class ByteTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | Box box; 21 | 22 | public ByteTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).byteValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/DoubleTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:12:24 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class DoubleTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | Box box; 21 | 22 | public DoubleTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).doubleValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/FloatTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:12:33 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class FloatTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | Box box; 21 | 22 | public FloatTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).floatValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/IntegerTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:12:52 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class IntegerTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | com.coremedia.iso.boxes.Box box; 21 | 22 | public IntegerTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).intValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/LongTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:12:43 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class LongTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | Box box; 21 | 22 | public LongTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).longValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/ShortTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | import java.text.ParseException; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: sannies 13 | * Date: 11.11.2008 14 | * Time: 23:12:52 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public class ShortTransferValue implements TransferValue { 18 | JFormattedTextField source; 19 | Method writeMethod; 20 | Box box; 21 | 22 | public ShortTransferValue(JFormattedTextField source, Box box, Method writeMethod) { 23 | this.source = source; 24 | this.writeMethod = writeMethod; 25 | this.box = box; 26 | } 27 | 28 | public void go() { 29 | try { 30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).shortValue()); 31 | } catch (ParseException e) { 32 | throw new RuntimeException(e); 33 | } catch (InvocationTargetException e) { 34 | throw new RuntimeException(e); 35 | } catch (IllegalAccessException e) { 36 | throw new RuntimeException(e); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/StringTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | 9 | /** 10 | * Created by IntelliJ IDEA. 11 | * User: sannies 12 | * Date: 11.11.2008 13 | * Time: 23:12:10 14 | * To change this template use File | Settings | File Templates. 15 | */ 16 | public class StringTransferValue implements TransferValue { 17 | JTextField source; 18 | Method writeMethod; 19 | Box box; 20 | 21 | public StringTransferValue(JTextField source, Box box, Method writeMethod) { 22 | this.source = source; 23 | this.writeMethod = writeMethod; 24 | this.box = box; 25 | } 26 | 27 | public void go() { 28 | try { 29 | writeMethod.invoke(box, source.getText()); 30 | } catch (InvocationTargetException e) { 31 | throw new RuntimeException(e); 32 | } catch (IllegalAccessException e) { 33 | throw new RuntimeException(e); 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/TransferHelperFactory.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | import com.coremedia.iso.boxes.Box; 4 | 5 | import javax.swing.*; 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * User: sannies 11 | * Date: 11.11.2008 12 | * Time: 23:13:45 13 | * To change this template use File | Settings | File Templates. 14 | */ 15 | public final class TransferHelperFactory { 16 | public static TransferValue getNumberTransferHelper(Class aClass, 17 | Box box, Method writeMethod, JFormattedTextField jftf) { 18 | if (Byte.class == aClass || byte.class == aClass) { 19 | return new ByteTransferValue(jftf, box, writeMethod); 20 | } else if (Double.class == aClass || double.class == aClass) { 21 | return new DoubleTransferValue(jftf, box, writeMethod); 22 | } else if (Float.class == aClass || float.class == aClass) { 23 | return new FloatTransferValue(jftf, box, writeMethod); 24 | } else if (Integer.class == aClass || int.class == aClass) { 25 | return new IntegerTransferValue(jftf, box, writeMethod); 26 | } else if (Short.class == aClass || short.class == aClass) { 27 | return new ShortTransferValue(jftf, box, writeMethod); 28 | } else if (Long.class == aClass || long.class == aClass) { 29 | return new LongTransferValue(jftf, box, writeMethod); 30 | } else { 31 | throw new RuntimeException("unknown number class " + aClass); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/TransferValue.java: -------------------------------------------------------------------------------- 1 | package com.coremedia.iso.gui.transferhelper; 2 | 3 | /** 4 | * Created by IntelliJ IDEA. 5 | * User: sannies 6 | * Date: 11.11.2008 7 | * Time: 23:11:54 8 | * To change this template use File | Settings | File Templates. 9 | */ 10 | public interface TransferValue { 11 | void go(); 12 | } 13 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/jnlp/isoviewer.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IsoViewer 6 | sebastian annies 7 | Analyzes MP4 files in an ugly UI 8 | Analyzes MP4 files 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/resources/NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Apache Maven distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | CoreMedia AG (http://www.coremedia.com/). 9 | 10 | This product includes software developed by 11 | castLabs GmbH (http://www.castlabs.com/). 12 | 13 | This product includes software (Base64 Encoder extracted from commons-codec) developed by 14 | The Apache Software Foundation (http://www.apache.org/). 15 | 16 | This product includes software (JHexEditor) developed by 17 | Germán Laullón (http://www.apache.org/). 18 | 19 | The icon is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported 20 | http://www.softicons.com/free-icons/system-icons/senary-system-icons-by-arrioch/video-mp4-icon 21 | 22 | 23 | -------------------------------------------------------------------------------- /tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/IsoViewer.properties: -------------------------------------------------------------------------------- 1 | # resources/ConverterApp.properties 2 | Application.id = IsoViewer 3 | Application.title = ISO File Format Viewer 4 | Application.icon=icon.png 5 | 6 | open-iso-file.Action.text=Open... 7 | 8 | IsoViewerPanel.trackViewDetailPaneHeader = Track %s 9 | IsoViewerPanel.tabbedPaneHeaderTrack =Tracks & Samples 10 | IsoViewerPanel.tabbedPaneHeaderBox=Box Structure -------------------------------------------------------------------------------- /tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/icon.png -------------------------------------------------------------------------------- /tools/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | mp4parser-project 5 | com.googlecode.mp4parser 6 | 1.0-RC-23-SNAPSHOT 7 | 8 | 4.0.0 9 | pom 10 | tools 11 | Tools 12 | 13 | smooth-streaming-fragmenter 14 | isoviewer 15 | smooth-streaming-downloader 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | org.apache.maven.plugins 24 | maven-deploy-plugin 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-deploy-plugin 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/main/java/testdata/Anchor.java: -------------------------------------------------------------------------------- 1 | package testdata; 2 | 3 | /** 4 | * Just makes sure I find the testdata. 5 | */ 6 | public final class Anchor { 7 | } 8 | -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/java/com/googlecode/mp4parser/tools/smoothstreamingdownloader/SmoothStreamingTrackTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.mp4parser.tools.smoothstreamingdownloader; 2 | 3 | import com.coremedia.iso.IsoFile; 4 | import com.googlecode.mp4parser.authoring.Movie; 5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; 6 | import nu.xom.ParsingException; 7 | import org.junit.Test; 8 | 9 | import java.io.File; 10 | import java.io.IOException; 11 | import java.io.RandomAccessFile; 12 | import java.net.URL; 13 | 14 | /** 15 | * Created with IntelliJ IDEA. 16 | * User: sannies 17 | * Date: 8/11/12 18 | * Time: 5:29 AM 19 | * To change this template use File | Settings | File Templates. 20 | */ 21 | public class SmoothStreamingTrackTest { 22 | public static void main(String[] args) throws IOException, ParsingException { 23 | URL anchor = SmoothStreamingTrackTest.class.getProtectionDomain().getCodeSource().getLocation(); 24 | Movie m = new Movie(); 25 | m.addTrack(new SmoothStreamingTrack(new File(anchor.getFile(), "testdata/Manifest").toURI(), "video", "70090")); 26 | DefaultMp4Builder builder = new DefaultMp4Builder(); 27 | IsoFile isoFile = builder.build(m); 28 | RandomAccessFile raf = new RandomAccessFile("output.mp4", "rw"); 29 | isoFile.getBox(raf.getChannel()); 30 | raf.close(); 31 | } 32 | 33 | @Test 34 | public void test() { 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/Manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/0 -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/24000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/24000000 -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/48000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/48000000 -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/72000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/72000000 -------------------------------------------------------------------------------- /tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/96000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/96000000 -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/main/resources/NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Apache Maven distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | CoreMedia AG (http://www.coremedia.com/). 9 | 10 | This product includes software developed by 11 | castLabs GmbH (http://www.castlabs.com/). 12 | 13 | This product includes software (Base64 Encoder extracted from commons-codec) developed by 14 | The Apache Software Foundation (http://www.apache.org/). 15 | 16 | This product includes software (JHexEditor) developed by 17 | Germán Laullón (http://www.apache.org/). 18 | 19 | 20 | -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/README.txt: -------------------------------------------------------------------------------- 1 | The smooth streaming example is a snippet from a film made by my dear colleague Shermin Voshmgir. Visit her at 2 | http://shermin.net/ -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/audio-96000.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/audio-96000.mp4 -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-128h-75kbps.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-128h-75kbps.mp4 -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-192h-155kbps.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-192h-155kbps.mp4 -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-240h-231kbps.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-240h-231kbps.mp4 -------------------------------------------------------------------------------- /tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-320h-388kbps.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-320h-388kbps.mp4 --------------------------------------------------------------------------------