media

package module
v0.0.0-...-995e4e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 8 Imported by: 0

README

📦 media

Work in Progress Go Report Card GoDoc Release

Overview

media is the central library of the SmartMediaFiles ecosystem. It does not contain any specific file analysis logic but acts as an aggregator and a central registry for all media types defined in the ecosystem.

Features

  • Aggregation: Imports file type and extension definitions from all specialized libraries (media.image, media.raw, etc.).
  • Central Registry: Exposes a Medias variable, which is a complete map of all supported media types, associating each media type with its corresponding file types and extensions.
  • Common Types: Defines the base types (MediaType, FileType, FileExtension) used consistently throughout the ecosystem.

Installation

go get -u github.com/smartmediafiles/media

Usage

By importing this library, you get an overview of all files supported by SmartMediaFiles. You can use it to quickly determine the media type from a file extension before handing it over to a more specialized library for in-depth analysis.

package main

import (
	"fmt"
	"github.com/smartmediafiles/media"
)

func main() {
	// Print all supported media types
	fmt.Println(media.Medias.GetMediaTypes())
}

License

This project is licensed under the MIT License - see the LICENSE.md file for details.


⚠️ Note: This README will be updated regularly as the project progresses. Check back often for the latest information!

Documentation

Overview

Package media is the central point of the SmartMediaFiles ecosystem.

It acts as an aggregator that gathers definitions from all specialized media type libraries (images, videos, RAW, etc.) into a single registry. This package provides a unified overview of all supported file formats, facilitating their identification and handling.

The main components of this package are:

  • Constant definitions for each major media type (Raw, Image, Video, etc.).
  • The `Medias` variable, a comprehensive map that associates each media type with its corresponding file types and extensions.

Using this package is the first step for any application looking to work with multimedia files within the SmartMediaFiles ecosystem.

Index

Constants

View Source
const (
	// Raw represents raw image files from digital cameras.
	// These files contain minimally processed data from the image sensor.
	// Examples: .CR2, .NEF, .ARW.
	Raw types.MediaType = "raw"

	// Image represents standard raster image files.
	// These formats are widely used for display and on the web.
	// Examples: .JPEG, .PNG, .GIF.
	Image types.MediaType = "image"

	// Video represents video files.
	// These formats contain both video and audio tracks.
	// Examples: .MP4, .MOV, .AVI.
	Video types.MediaType = "video"

	// Vector represents vector graphic files.
	// Unlike raster images, they are based on mathematical equations.
	// Examples: .SVG, .AI.
	Vector types.MediaType = "vector"

	// Sidecar represents files that store metadata about other files.
	// They often accompany RAW or video files.
	// Examples: .XMP, .MIE.
	Sidecar types.MediaType = "sidecar"

	// Unknown represents an unidentified or unsupported media type.
	// It is the default value for files with unrecognized extensions.
	Unknown types.MediaType = ""
)

List of the main media types supported by the ecosystem. These constants serve as keys to access specific definitions in the `Medias` map.

Variables

Medias is the central registry of all supported media and file types.

This variable is a map that associates each `MediaType` (defined above) with a `MapFileTypeExtensions`, which in turn maps specific `FileType` to their lists of `FileExtension`.

Example Usage:

To get all file extensions for JPEG images:

jpegExtensions := media.Medias[media.Image][media_image.ImageJpeg]
fmt.Println(jpegExtensions) // Outputs: [.jpg .jpeg .jpe .jif .jfif .jfi]

To get all file types for videos:

videoFileTypes := media.Medias.GetFileTypes(media.Video)
fmt.Println(videoFileTypes)

Functions

func GetMediaTypeByExtension

func GetMediaTypeByExtension(extension types.FileExtension) types.MediaType

GetMediaTypeByExtension iterates through the entire Medias registry to find the corresponding MediaType for a given file extension. The search is case-insensitive. If no match is found, it returns the Unknown type.

Types

This section is empty.

Directories

Path Synopsis
media
maps
Package maps defines the structure of the data mappings used to associate media types, file types, and file extensions within the SmartMediaFiles ecosystem.
Package maps defines the structure of the data mappings used to associate media types, file types, and file extensions within the SmartMediaFiles ecosystem.
types
Package types defines the fundamental data types used across the SmartMediaFiles ecosystem.
Package types defines the fundamental data types used across the SmartMediaFiles ecosystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL