Here follows a list of often used classes and descriptions for implementing plug-ins
To perform conversion from a media file to a target format you need to implement an interface named IMediaConverter. You can inherit the MediaConverterBase class to get a base implementation of many methods. Only override the necessary methods.
The IMediaConverter defines the following methods:
This method questions the converter if the specified conversion can be made. It is called with the source media and target format as parameters. The converter needs to inspect the source media and target format (including effects) and then return true if the converter can perform the conversion.
This method is called if the converter has returned true on the CanConvert call for the specific conversion. This method should implement the conversion and return a MediaContent instance.
Is used to calculate the name for the specific conversion
Ex. if I convert the file "file.pdf" to a jpeg image, this could return "file.jpg" There is a base implementation that handles image conversions in MediaConverterBase
Is used to calculate the content type for the specific conversion. The utility class ContentTypeUtil can be helpful when implementing this method.
Ex. if I convert the file "file.pdf" to a jpeg image, this could return "image/jpeg" There is a base implementation that handles image conversions in MediaConverterBase
This method is used to calculate the effects a specific format has on a media. It will only calculate the result of the effect (like output width/height) to be able to deliver pre conversion information to the client.
The IMediaInformationGenerator2 is an interface that creates the information details about an original or converted media. This information is created and cached in the database using the methods included in this interface. The interface contains two methods that creates/updates the Media instance of the DbMediaContentReference instance for the item.
The [IMediaStorage] interface can be implemented to store/read data from custom sources.
This can be registered on your [IMediaStorage] implementation to provide a set of meta data when the media is stored.
You can also implement a separate class and register it as a MediaAnalyser to provide meta data analysis before the media item is uploaded to a storage.
The media class contains information about a media conversion. It contains the URL to the content, content type, Id of the MediaItem, id of the format and specific properties depending on the type of media it is. For images and video we get width and height for example. There exists a few subclasses, mainly Image, Video and Thumbnail. It also contains the html needed for displaying the media on a web page.
The MediaConverterBase is a base class for implementing a IMediaConverter. It has a IServiceFactory property for easy access for the core services and provides a base implementation for the CalculateMediaName method.
The MediaContent class defines the content that can be delivered to the client. It inherits the MediaContentBase class and provides all information needed to be able to deliver a response containing the media. It contains the MediaItemId (id of the media), MediaContentReferenceId (unique id for the MediaItem,MediaFormat combination), name of the content and content type.
The concrete implementations of the MediaContent class are StreamedBinaryMediaContent which supplies a binary stream to the content, BufferedBinaryMediaContent which supplies a byte array for the content and ExternalMediaContent which redirects the client to another URL.
The DbMediaContentReference represents a row in the MediaContentReference table in the database.
The MediaFormatBase is the base implementation of an IMediaFormat. A media format represents the way a media should be converted/displayed. Often used subclasses are OriginalFormat that represents the original, unchanged format of the media, ImageFormat used to convert the source to an image, VideoFormat used to convert the source to a video, WebMediaFormat keeps the original format (image, video) but allows specifying resize operations on it.
The IServiceFactory is an interface that allows us to get in contact with the different services that ImageVault core provides.