media

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Media services for golang, including bindings for ffmpeg, command line application

and backend REST API for extraction, multiplexing and transcoding.

Index

Constants

View Source
const (
	MMAL_COMPONENT_DEFAULT_VIDEO_DECODER   = "vc.ril.video_decode"
	MMAL_COMPONENT_DEFAULT_VIDEO_ENCODER   = "vc.ril.video_encode"
	MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER  = "vc.ril.video_render"
	MMAL_COMPONENT_DEFAULT_IMAGE_DECODER   = "vc.ril.image_decode"
	MMAL_COMPONENT_DEFAULT_IMAGE_ENCODER   = "vc.ril.image_encode"
	MMAL_COMPONENT_DEFAULT_CAMERA          = "vc.ril.camera"
	MMAL_COMPONENT_DEFAULT_VIDEO_CONVERTER = "vc.video_convert"
	MMAL_COMPONENT_DEFAULT_SPLITTER        = "vc.splitter"
	MMAL_COMPONENT_DEFAULT_SCHEDULER       = "vc.scheduler"
	MMAL_COMPONENT_DEFAULT_VIDEO_INJECTER  = "vc.video_inject"
	MMAL_COMPONENT_DEFAULT_VIDEO_SPLITTER  = "vc.ril.video_splitter"
	MMAL_COMPONENT_DEFAULT_AUDIO_DECODER   = "none"
	MMAL_COMPONENT_DEFAULT_AUDIO_RENDERER  = "vc.ril.audio_render"
	MMAL_COMPONENT_DEFAULT_MIRACAST        = "vc.miracast"
	MMAL_COMPONENT_DEFAULT_CLOCK           = "vc.clock"
	MMAL_COMPONENT_DEFAULT_CAMERA_INFO     = "vc.camera_info"
)

Variables

View Source
var (
	AudioLayoutMono   = AudioChannelLayout{1}
	AudioLayoutStereo = AudioChannelLayout{2}
)

Functions

This section is empty.

Types

type AudioChannelLayout

type AudioChannelLayout struct {
	Channels uint
}

AudioChannelLayout represents number of channels and layout of those channels

type AudioFormat

type AudioFormat int

AudioFormat represents how the samples are stored

const (
	AUDIO_FMT_NONE AudioFormat = iota
	AUDIO_FMT_U8               // unsigned 8 bits
	AUDIO_FMT_U8P              // unsigned 8 bits, planar
	AUDIO_FMT_S16              // signed 16 bits
	AUDIO_FMT_S16P             // signed 16 bits, planar
	AUDIO_FMT_S32              // signed 32 bits
	AUDIO_FMT_S32P             // signed 32 bits, planar
	AUDIO_FMT_F32              // float32
	AUDIO_FMT_F32P             // float32, planar
	AUDIO_FMT_F64              // float64
	AUDIO_FMT_F64P             // float64, planar
	AUDIO_FMT_S64              // signed 64 bits
	AUDIO_FMT_S64P             // signed 64 bits, planar
)

func (AudioFormat) String

func (f AudioFormat) String() string

type CommonParameters

type CommonParameters interface {

	// Get Parameters
	SupportedEncodings() ([]EncodingType, error)
	ZeroCopy() (bool, error)
	PowerMonEnable() (bool, error)
	NoImagePadding() (bool, error)
	LockstepEnable() (bool, error)

	// Set Parameters
	SetZeroCopy(bool) error
	SetPowerMonEnable(bool) error
	SetNoImagePadding(bool) error
	SetLockstepEnable(bool) error
}

type Component

type Component interface {
	gopi.Driver

	// Return component name and ID
	Name() string
	Id() uint32

	// Enable component
	Enabled() bool
	SetEnabled(bool) error

	// Return port information
	NumPort() uint
	Control() Port
	Input() []Port
	Output() []Port
	Clock() []Port
}

type DecodeIteratorFunc

type DecodeIteratorFunc func(context.Context, MediaPacket) error

type EncodingType

type EncodingType uint32

func (EncodingType) String

func (e EncodingType) String() string

type Media

type Media interface {
	URL() *url.URL    // Return URL for the media location
	Flags() MediaFlag // Return flags
}

Media represents either input or output media

type MediaCodec

type MediaCodec interface {
	// Name returns the unique name for the codec
	Name() string

	// Description returns the long description for the codec
	Description() string

	// Flags for the codec (Audio, Video, Encoder, Decoder)
	Flags() MediaFlag
}

MediaCodec is the codec and parameters

type MediaFlag

type MediaFlag uint64
const (
	MEDIA_FLAG_ALBUM             MediaFlag = (1 << iota) // Is part of an album
	MEDIA_FLAG_ALBUM_TRACK                               // Is an album track
	MEDIA_FLAG_ALBUM_COMPILATION                         // Album is a compliation
	MEDIA_FLAG_TVSHOW                                    // Is part of a TV Show
	MEDIA_FLAG_TVSHOW_EPISODE                            // Is a TV Show episode
	MEDIA_FLAG_FILE                                      // Is a file
	MEDIA_FLAG_VIDEO                                     // Contains video
	MEDIA_FLAG_AUDIO                                     // Contains audio
	MEDIA_FLAG_SUBTITLE                                  // Contains subtitles
	MEDIA_FLAG_DATA                                      // Contains data stream
	MEDIA_FLAG_ATTACHMENT                                // Contains attachment
	MEDIA_FLAG_ARTWORK                                   // Contains artwork
	MEDIA_FLAG_CAPTIONS                                  // Contains captions
	MEDIA_FLAG_ENCODER                                   // Is an encoder
	MEDIA_FLAG_DECODER                                   // Is an decoder
	MEDIA_FLAG_NONE              MediaFlag = 0
	MEDIA_FLAG_MIN                         = MEDIA_FLAG_ALBUM
	MEDIA_FLAG_MAX                         = MEDIA_FLAG_DECODER
)

func (MediaFlag) FlagString

func (f MediaFlag) FlagString() string

func (MediaFlag) Is

func (f MediaFlag) Is(v MediaFlag) bool

func (MediaFlag) String

func (f MediaFlag) String() string

type MediaKey

type MediaKey string
const (
	MEDIA_KEY_BRAND_MAJOR      MediaKey = "major_brand"       // string
	MEDIA_KEY_BRAND_COMPATIBLE MediaKey = "compatible_brands" // string
	MEDIA_KEY_CREATED          MediaKey = "creation_time"     // time.Time
	MEDIA_KEY_ENCODER          MediaKey = "encoder"           // string
	MEDIA_KEY_ALBUM            MediaKey = "album"             // string
	MEDIA_KEY_ALBUM_ARTIST     MediaKey = "artist"            // string
	MEDIA_KEY_COMMENT          MediaKey = "comment"           // string
	MEDIA_KEY_COMPOSER         MediaKey = "composer"          // string
	MEDIA_KEY_COPYRIGHT        MediaKey = "copyright"         // string
	MEDIA_KEY_YEAR             MediaKey = "date"              // uint
	MEDIA_KEY_DISC             MediaKey = "disc"              // uint
	MEDIA_KEY_ENCODED_BY       MediaKey = "encoded_by"        // string
	MEDIA_KEY_FILENAME         MediaKey = "filename"          // string
	MEDIA_KEY_GENRE            MediaKey = "genre"             // string
	MEDIA_KEY_LANGUAGE         MediaKey = "language"          // string
	MEDIA_KEY_PERFORMER        MediaKey = "performer"         // string
	MEDIA_KEY_PUBLISHER        MediaKey = "publisher"         // string
	MEDIA_KEY_SERVICE_NAME     MediaKey = "service_name"      // string
	MEDIA_KEY_SERVICE_PROVIDER MediaKey = "service_provider"  // string
	MEDIA_KEY_TITLE            MediaKey = "title"             // string
	MEDIA_KEY_TRACK            MediaKey = "track"             // uint
	MEDIA_KEY_VERSION_MAJOR    MediaKey = "major_version"     // string
	MEDIA_KEY_VERSION_MINOR    MediaKey = "minor_version"     // string
	MEDIA_KEY_SHOW             MediaKey = "show"              // string
	MEDIA_KEY_SEASON           MediaKey = "season_number"     // uint
	MEDIA_KEY_EPISODE_SORT     MediaKey = "episode_sort"      // string
	MEDIA_KEY_EPISODE_ID       MediaKey = "episode_id"        // uint
	MEDIA_KEY_COMPILATION      MediaKey = "compilation"       // bool
	MEDIA_KEY_GAPLESS_PLAYBACK MediaKey = "gapless_playback"  // bool
	MEDIA_KEY_ACCOUNT_ID       MediaKey = "account_id"        // string
	MEDIA_KEY_DESCRIPTION      MediaKey = "description"       // string
	MEDIA_KEY_MEDIA_TYPE       MediaKey = "media_type"        // string
	MEDIA_KEY_PURCHASED        MediaKey = "purchase_date"     // time.Time
	MEDIA_KEY_ALBUM_SORT       MediaKey = "sort_album"        // string
	MEDIA_KEY_ARTIST_SORT      MediaKey = "sort_artist"       // string
	MEDIA_KEY_TITLE_SORT       MediaKey = "sort_name"         // string
	MEDIA_KEY_SYNOPSIS         MediaKey = "synopsis"          // string
	MEDIA_KEY_GROUPING         MediaKey = "grouping"          // string
)

type MediaPacket

type MediaPacket interface {
	Size() int
	Bytes() []byte
	Stream() int
}

MediaPacket is a packet of data from a stream

type Port

type Port interface {
	// Return port information
	Name() string
	Type() PortType
	Index() uint
	Capabilities() PortCapabilityType

	// Enable & Disable port
	Enabled() bool
	SetEnabled(bool) error

	// Connect and disconnect this port to another
	Connect(Port) error
	Disconnect() error

	// Flush port, commit format changes
	Flush() error
	Commit() error

	// Implements common parameters
	CommonParameters
}

type PortCapabilityType

type PortCapabilityType uint32
const (
	MMAL_PORT_CAPABILITY_NONE                         PortCapabilityType = 0x00
	MMAL_PORT_CAPABILITY_PASSTHROUGH                  PortCapabilityType = 0x01
	MMAL_PORT_CAPABILITY_ALLOCATION                   PortCapabilityType = 0x02
	MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE PortCapabilityType = 0x04
	MMAL_PORT_CAPABILITY_MIN                          PortCapabilityType = MMAL_PORT_CAPABILITY_PASSTHROUGH
	MMAL_PORT_CAPABILITY_MAX                          PortCapabilityType = MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE
)

func (PortCapabilityType) String

func (t PortCapabilityType) String() string

type PortType

type PortType uint32
const (
	MMAL_PORT_NONE    PortType = 0x0000
	MMAL_PORT_CONTROL PortType = 0x0001
	MMAL_PORT_INPUT   PortType = 0x0002
	MMAL_PORT_OUTPUT  PortType = 0x0003
	MMAL_PORT_CLOCK   PortType = 0x0004
)

func (PortType) String

func (t PortType) String() string

type StreamType

type StreamType uint32
const (
	MMAL_ES_TYPE_NONE       StreamType = 0x0000
	MMAL_ES_TYPE_CONTROL    StreamType = 0x0001
	MMAL_ES_TYPE_AUDIO      StreamType = 0x0002
	MMAL_ES_TYPE_VIDEO      StreamType = 0x0003
	MMAL_ES_TYPE_SUBPICTURE StreamType = 0x0004
)

func (StreamType) String

func (s StreamType) String() string

Directories

Path Synopsis
cmd
hw
pkg
_old/_media
Package media provides high-level media services for multiplexing, extracting and transcoding audio and video.
Package media provides high-level media services for multiplexing, extracting and transcoding audio and video.
plugin
sys
_ffmpeg
Package ffmpeg provides low-level ffmpeg for go
Package ffmpeg provides low-level ffmpeg for go

Jump to

Keyboard shortcuts

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