media

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAudioProbeUnsupported = errors.New("audio probing not implemented")
View Source
var ErrVideoProbeUnsupported = errors.New("video probing not implemented")

Functions

This section is empty.

Types

type Attachment added in v1.2.7

type Attachment struct {
	Type        string                 `json:"type"`
	URL         string                 `json:"url,omitempty"`
	Path        string                 `json:"path,omitempty"`
	ContentType string                 `json:"content_type,omitempty"`
	Name        string                 `json:"name,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Attachment 表示外部媒体资源。

func Normalize added in v1.2.7

func Normalize(input interface{}) ([]Attachment, error)

Normalize 将多种输入形态规范化为 Attachment 列表。 支持以下形式:

  • nil 或空值(返回 nil)
  • []Attachment
  • []*Attachment
  • []map[string]interface{}
  • map[string]interface{},包含 `media` 列表或本身代表单个媒体

type AudioInfo

type AudioInfo struct {
	Format      string  `json:"format"`
	DurationSec float64 `json:"duration_sec"`
	SampleRate  int     `json:"sample_rate"`
	Channels    int     `json:"channels"`
}

AudioInfo contains basic audio metadata

func ProbeAudio

func ProbeAudio([]byte) (AudioInfo, error)

ProbeAudio is a placeholder for audio metadata extraction. Minimal stub to satisfy media processing requirement; extend with formats as needed.

type ImageInfo

type ImageInfo struct {
	Format string `json:"format"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

ImageInfo contains basic image metadata

func AnalyzeImage

func AnalyzeImage(r io.Reader) (ImageInfo, error)

AnalyzeImage reads image metadata (format, dimensions) using image.DecodeConfig

type VideoInfo

type VideoInfo struct {
	Format      string  `json:"format"`
	DurationSec float64 `json:"duration_sec"`
	Width       int     `json:"width"`
	Height      int     `json:"height"`
}

VideoInfo contains basic video metadata

func ProbeVideo

func ProbeVideo([]byte) (VideoInfo, error)

ProbeVideo is a placeholder for video metadata extraction.

Jump to

Keyboard shortcuts

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