Package org.opencastproject.mediapackage
Interface MediaPackage
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
MediaPackageImpl
Interface for a media package, which is a data container moving through the system, containing metadata, tracks and
attachments.
-
Method Summary
Modifier and TypeMethodDescriptionAdds an arbitraryURIto this media package, utilizing aMediaPackageBuilderto create a suitable media package element out of the url.add(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor) Adds an arbitraryURIto this media package, utilizing aMediaPackageBuilderto create a suitable media package element out of the url.voidadd(Attachment attachment) Adds an attachment to this media package.voidAdds catalog information to this media package.voidadd(MediaPackageElement element) Adds an arbitraryMediaPackageElementto this media package.voidAdds a track to this media package, actually moving the underlying file in the filesystem.voidaddContributor(String contributor) voidaddCreator(String creator) voidaddDerived(MediaPackageElement derivedElement, MediaPackageElement sourceElement) Adds an element to this media package that represents a derived version ofsourceElement.voidaddSubject(String subject) clone()Creates a deep copy of the media package.booleancontains(MediaPackageElement element) Returnstrueif the given element is part of the media package.elements()Returns an iteration of the media package elements.getAttachment(String attachmentId) Returns the attachment identified byattachmentIdornullif that attachment does not exist.Returns the attachments that are part of this media package.Returns the attachments that are part of this media package and match the specified flavor.getCatalog(String catalogId) Returns the catalog identified bycatalogIdornullif that catalog doesn't exists.Catalog[]Returns the catalogs associated with this media package.Catalog[]getCatalogs(MediaPackageElementFlavor flavor) Returns the catalogs associated with this media package that matches the specified flavor.Catalog[]getCatalogs(MediaPackageElementFlavor flavor, MediaPackageReference reference) Returns the catalogs that are part of this media package and are refering to the element identified byreference.Catalog[]getCatalogs(MediaPackageReference reference) Returns the catalogs that are part of this media package and are refering to the element identified byreference.Catalog[]getCatalogsByTags(Collection<String> tags) Returns the catalogs that are tagged with any of the given tags or an empty array if no such elements are found.String[]Deprecated.This is not guaranteed to be correct.String[]Deprecated.This is not guaranteed to be correct.getDate()Deprecated.This is not guaranteed to be correct.getDerived(MediaPackageElement sourceElement, MediaPackageElementFlavor derivateFlavor) Returns those media package elements that are derivates ofsourceElementand feature the flavorderivateFlavor.Deprecated.This is not guaranteed to be correct.getElementById(String id) Returns the element that is identified by the given identifier ornullif no such element exists.getElementByReference(MediaPackageReference reference) Returns the element that is identified by the given reference ornullif no such element exists.Returns all the elements.Returns all elements of this media package with the given flavor.getElementsByTags(Collection<String> tags) Returns the elements that are tagged with any of the given tags or an empty array if no such elements are found.Returns the media package identifier.Deprecated.This is not guaranteed to be correct.Deprecated.This is not guaranteed to be correct.Returns the presentations that are part of this media package.Returns the series, if any, to which this mediapackage belongsDeprecated.This is not guaranteed to be correct.String[]Deprecated.This is not guaranteed to be correct.getTitle()Deprecated.This is not guaranteed to be correct.Returns the track identified bytrackIdornullif that track doesn't exists.Track[]Returns the tracks that are part of this media package.Track[]getTracks(MediaPackageElementFlavor flavor) Returns the tracks that are part of this media package and match the given flavor as defined inTrack.Track[]getTracksByTag(String tag) Returns the tracks that are tagged with the given tag or an empty array if no such tracks are found.Track[]getTracksByTags(Collection<String> tags) Returns the tracks that are tagged with any of the given tags or an empty array if no such elements are found.Returns media package elements that are neither, attachments, catalogs nor tracks.booleanReturnstrueif the media package contains media tracks of any kind.booleanisLive()Whether the media package contains live tracks.voidremove(Attachment attachment) Removes the attachment from the media package.voidRemoves the catalog from the media package.voidremove(MediaPackageElement element) Removes an arbitrary media package element.voidRemoves the track from the media package.voidremoveContributor(String contributor) voidremoveCreator(String creator) Removes the element with the given identifier from the mediapackage and returns it.voidremoveSubject(String subject) voidvoidsetDuration(Long duration) Sets the duration of the media package in milliseconds.voidsetIdentifier(Id id) voidsetLanguage(String language) voidsetLicense(String license) voidvoidsetSeriesTitle(String seriesTitle) voidvoidverify()Verifies the media package consistency by checking the media package elements for mimetypes and checksums.
-
Method Details
-
getIdentifier
Id getIdentifier()Returns the media package identifier.- Returns:
- the identifier
-
setIdentifier
-
setTitle
-
getSeriesTitle
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the title for the associated series, if any.- Returns:
- The series title
-
setSeriesTitle
-
getTitle
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the title of the episode that this mediapackage represents.- Returns:
- The episode title
-
addCreator
-
removeCreator
-
getCreators
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the names of the institutions or people who created this mediapackage- Returns:
- the creators of this mediapackage
-
setSeries
-
getSeries
String getSeries()Returns the series, if any, to which this mediapackage belongs- Returns:
- the series
-
setLicense
-
getLicense
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.The license for the content in this mediapackage- Returns:
- the license
-
addContributor
-
removeContributor
-
getContributors
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the names of the institutions or people who contributed to the content within this mediapackage- Returns:
- the contributors
-
setLanguage
-
getLanguage
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the language written and/or spoken in the media content of this mediapackage- Returns:
- the language
-
addSubject
-
removeSubject
-
getSubjects
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.The keywords describing the subject(s) or categories describing the content of this mediapackage- Returns:
- the subjects
-
setDate
-
getDate
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the media package start time.- Returns:
- the start time
-
getDuration
Deprecated.This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.Returns the media package duration in milliseconds ornullif no duration is available.- Returns:
- the duration
-
setDuration
Sets the duration of the media package in milliseconds. This method will throw anIllegalStateExceptionif tracks have been added to the mediapackage already. Also note that as soon as the first track is added, the duration will be udpated according to the track's length.- Parameters:
duration- the duration in milliseconds- Throws:
IllegalStateException- if the mediapackage already contains a track
-
contains
Returnstrueif the given element is part of the media package.- Parameters:
element- the element- Returns:
trueif the element belongs to the media package
-
elements
Iterable<MediaPackageElement> elements()Returns an iteration of the media package elements.- Returns:
- the media package elements
-
getElements
MediaPackageElement[] getElements()Returns all the elements.- Returns:
- the elements
-
getElementByReference
Returns the element that is identified by the given reference ornullif no such element exists.- Parameters:
reference- the reference- Returns:
- the element
-
getElementById
Returns the element that is identified by the given identifier ornullif no such element exists.- Parameters:
id- the element identifier- Returns:
- the element
-
getElementsByTags
Returns the elements that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in thetagscollection start with a '-' character, any elements matching the tag will be excluded from the returned MediaPackageElement[]. Iftagsis empty or null, all elements are returned.- Parameters:
tags- the tags- Returns:
- the elements
-
getElementsByFlavor
Returns all elements of this media package with the given flavor.- Returns:
- the media package elements
-
getTrack
Returns the track identified bytrackIdornullif that track doesn't exists.- Parameters:
trackId- the track identifier- Returns:
- the tracks
-
getTracks
Track[] getTracks()Returns the tracks that are part of this media package.- Returns:
- the tracks
-
getTracksByTag
Returns the tracks that are tagged with the given tag or an empty array if no such tracks are found.- Parameters:
tag- the tag- Returns:
- the tracks
-
getTracksByTags
Returns the tracks that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in thetagscollection start with a '-' character, any elements matching the tag will be excluded from the returned Track[]. Iftagsis empty or null, all tracks are returned.- Parameters:
tags- the tags- Returns:
- the tracks
-
getTracks
Returns the tracks that are part of this media package and match the given flavor as defined inTrack.- Parameters:
flavor- the track's flavor- Returns:
- the tracks with the specified flavor
-
hasTracks
boolean hasTracks()Returnstrueif the media package contains media tracks of any kind.- Returns:
trueif the media package contains tracks
-
getAttachment
Returns the attachment identified byattachmentIdornullif that attachment does not exist.- Parameters:
attachmentId- the attachment identifier- Returns:
- the attachments
-
getAttachments
Attachment[] getAttachments()Returns the attachments that are part of this media package.- Returns:
- the attachments
-
getAttachments
Returns the attachments that are part of this media package and match the specified flavor.- Parameters:
flavor- the attachment flavor- Returns:
- the attachments
-
getPublications
Publication[] getPublications()Returns the presentations that are part of this media package.- Returns:
- the attachments
-
getCatalog
Returns the catalog identified bycatalogIdornullif that catalog doesn't exists.- Parameters:
catalogId- the catalog identifier- Returns:
- the catalogs
-
getCatalogs
Catalog[] getCatalogs()Returns the catalogs associated with this media package.- Returns:
- the catalogs
-
getCatalogsByTags
Returns the catalogs that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in thetagscollection start with a '-' character, any elements matching the tag will be excluded from the returned Catalog[]. Iftagsis empty or null, all catalogs are returned.- Parameters:
tags- the tags- Returns:
- the catalogs
-
getCatalogs
Returns the catalogs associated with this media package that matches the specified flavor.- Parameters:
flavor- the catalog type- Returns:
- the media package catalogs
-
getCatalogs
Returns the catalogs that are part of this media package and are refering to the element identified byreference.- Parameters:
reference- the reference- Returns:
- the catalogs with the specified reference
-
getCatalogs
Returns the catalogs that are part of this media package and are refering to the element identified byreference.- Parameters:
flavor- the element flavorreference- the reference- Returns:
- the catalogs with the specified reference
-
getUnclassifiedElements
MediaPackageElement[] getUnclassifiedElements()Returns media package elements that are neither, attachments, catalogs nor tracks.- Returns:
- the other media package elements
-
add
Adds an arbitraryURIto this media package, utilizing aMediaPackageBuilderto create a suitable media package element out of the url. If the content cannot be recognized as being either a metadata catalog or multimedia track, it is added as an attachment.- Parameters:
uri- the element location
-
add
Adds an arbitraryURIto this media package, utilizing aMediaPackageBuilderto create a suitable media package element out of the url. If the content cannot be recognized as being either a metadata catalog or multimedia track, it is added as an attachment.- Parameters:
uri- the element locationtype- the element typeflavor- the element flavor
-
add
Adds an arbitraryMediaPackageElementto this media package.- Parameters:
element- the element
-
add
Adds a track to this media package, actually moving the underlying file in the filesystem. Use this method only if you do not need the track in its originial place anymore.Depending on the implementation, this method may provide significant performance benefits over copying the track.
- Parameters:
track- the track
-
removeElementById
Removes the element with the given identifier from the mediapackage and returns it.- Parameters:
id- the element identifier
-
remove
Removes the track from the media package.- Parameters:
track- the track
-
add
Adds catalog information to this media package.- Parameters:
catalog- the catalog
-
remove
Removes the catalog from the media package.- Parameters:
catalog- the catalog
-
add
Adds an attachment to this media package.- Parameters:
attachment- the attachment
-
remove
Removes an arbitrary media package element.- Parameters:
element- the media package element
-
remove
Removes the attachment from the media package.- Parameters:
attachment- the attachment
-
addDerived
Adds an element to this media package that represents a derived version ofsourceElement. Examples of a derived element could be an encoded version of a track or a converted version of a time text captions file.This method will add
derviedElementto the media package and add a reference to the original elementsourceElement. Make sure thatderivedElementfeatures the right flavor, so that you are later able to look up derived work usinggetDerived(MediaPackageElement, MediaPackageElementFlavor).- Parameters:
derivedElement- the derived elementsourceElement- the source element
-
getDerived
MediaPackageElement[] getDerived(MediaPackageElement sourceElement, MediaPackageElementFlavor derivateFlavor) Returns those media package elements that are derivates ofsourceElementand feature the flavorderivateFlavor. Using this method, you could easily look up e. g. flash-encoded versions of the presenter track or converted versions of a time text captions file.- Parameters:
sourceElement- the original track, catalog or attachmentderivateFlavor- the derivate flavor you are looking for- Returns:
- the derivates
-
verify
Verifies the media package consistency by checking the media package elements for mimetypes and checksums.- Throws:
MediaPackageException- if an error occurs while checking the media package
-
clone
Object clone()Creates a deep copy of the media package.- Returns:
- the cloned media package
-
isLive
boolean isLive()Whether the media package contains live tracks.- Returns:
- if mp is live
-