Skip to content

Commit

Permalink
Fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
djthorpe committed Jul 5, 2024
1 parent 5a38897 commit 03b9947
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 32 deletions.
1 change: 1 addition & 0 deletions pkg/ffmpeg/channellayout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
media "github.com/mutablelogic/go-media"
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
Expand Down
1 change: 0 additions & 1 deletion pkg/ffmpeg/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"syscall"

// Packages

ff "github.com/mutablelogic/go-media/sys/ffmpeg61"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"

Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
imagex "github.com/mutablelogic/go-media/pkg/image"
assert "github.com/stretchr/testify/assert"
Expand Down
6 changes: 2 additions & 4 deletions pkg/ffmpeg/manager.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package ffmpeg

import (

// Packages

"slices"

// Packages
media "github.com/mutablelogic/go-media"
"github.com/mutablelogic/go-media/pkg/version"
version "github.com/mutablelogic/go-media/pkg/version"
ff "github.com/mutablelogic/go-media/sys/ffmpeg61"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/par_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/pixelformat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
5 changes: 5 additions & 0 deletions pkg/ffmpeg/re.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type Re struct {
////////////////////////////////////////////////////////////////////////////////
// LIFECYCLE

// Return a new resampler or rescaler, with the destination parameters. If
// force is true, then the resampler will always resample, even if the
// destination parameters are the same as the source parameters.
func NewRe(par *Par, force bool) (*Re, error) {
re := new(Re)
re.t = par.Type()
Expand All @@ -46,6 +49,7 @@ func NewRe(par *Par, force bool) (*Re, error) {
return re, nil
}

// Release resources
func (re *Re) Close() error {
var result error
if re.audio != nil {
Expand All @@ -63,6 +67,7 @@ func (re *Re) Close() error {
////////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

// Resample or rescale the source frame and return the destination frame
func (re *Re) Frame(src *Frame) (*Frame, error) {
// Check type - if not flush
if src != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/re_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"testing"

// Packages
media "github.com/mutablelogic/go-media"
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

// Packages
media "github.com/mutablelogic/go-media"
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/resampler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
generator "github.com/mutablelogic/go-media/pkg/generator"
assert "github.com/stretchr/testify/assert"
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/rescaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
generator "github.com/mutablelogic/go-media/pkg/generator"
assert "github.com/stretchr/testify/assert"
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/sampleformat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ffmpeg_test
import (
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
assert "github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ffmpeg/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"testing"

// Packages
ffmpeg "github.com/mutablelogic/go-media/pkg/ffmpeg"
generator "github.com/mutablelogic/go-media/pkg/generator"
assert "github.com/stretchr/testify/assert"
Expand Down
3 changes: 2 additions & 1 deletion sys/ffmpeg61/avcodec_packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package ffmpeg_test
import (
"testing"

"github.com/stretchr/testify/assert"

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
"github.com/stretchr/testify/assert"
)

func Test_avcodec_packet_000(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions sys/ffmpeg61/avdevice.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package ffmpeg

import (
"encoding/json"
"unsafe"
)

////////////////////////////////////////////////////////////////////////////////
// CGO

Expand All @@ -8,10 +13,6 @@ package ffmpeg
#include <libavdevice/avdevice.h>
*/
import "C"
import (
"encoding/json"
"unsafe"
)

////////////////////////////////////////////////////////////////////////////////
// TYPES
Expand Down
9 changes: 5 additions & 4 deletions sys/ffmpeg61/avdevice_input.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package ffmpeg

import (
"fmt"
"unsafe"
)

////////////////////////////////////////////////////////////////////////////////
// CGO

Expand All @@ -8,10 +13,6 @@ package ffmpeg
#include <libavdevice/avdevice.h>
*/
import "C"
import (
"fmt"
"unsafe"
)

////////////////////////////////////////////////////////////////////////////////
// BINDINGS
Expand Down
3 changes: 2 additions & 1 deletion sys/ffmpeg61/avformat_dump.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ffmpeg

import "unsafe"

////////////////////////////////////////////////////////////////////////////////
// CGO

Expand All @@ -8,7 +10,6 @@ package ffmpeg
#include <libavformat/avformat.h>
*/
import "C"
import "unsafe"

////////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS
Expand Down
2 changes: 1 addition & 1 deletion sys/ffmpeg61/avformat_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"testing"

// Packages
"github.com/stretchr/testify/assert"

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
"github.com/stretchr/testify/assert"
)

func Test_avformat_input_001(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions sys/ffmpeg61/avformat_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package ffmpeg_test
import (
"testing"

// Packages

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
)
Expand Down
3 changes: 2 additions & 1 deletion sys/ffmpeg61/avutil_channel_layout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package ffmpeg_test
import (
"testing"

"github.com/stretchr/testify/assert"

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
"github.com/stretchr/testify/assert"
)

func Test_avutil_channel_layout_001(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion sys/ffmpeg61/avutil_dict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/assert"

// Namespace imports

. "github.com/mutablelogic/go-media/sys/ffmpeg61"
)

Expand Down
2 changes: 0 additions & 2 deletions sys/ffmpeg61/avutil_pixfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package ffmpeg_test
import (
"testing"

// Packages

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
)
Expand Down
3 changes: 2 additions & 1 deletion sys/ffmpeg61/swscale_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package ffmpeg_test
import (
"testing"

"github.com/stretchr/testify/assert"

// Namespace imports
. "github.com/mutablelogic/go-media/sys/ffmpeg61"
"github.com/stretchr/testify/assert"
)

func Test_swscale_core_000(t *testing.T) {
Expand Down
22 changes: 13 additions & 9 deletions type.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@ package media
///////////////////////////////////////////////////////////////////////////////
// TYPES

// Type of codec, device, format or stream
type Type int

///////////////////////////////////////////////////////////////////////////////
// GLOBALS

const (
NONE Type = 0
VIDEO Type = (1 << iota)
AUDIO
SUBTITLE
DATA
UNKNOWN
ANY = NONE
mintype = VIDEO
maxtype = UNKNOWN
NONE Type = 0 // Type is not defined
VIDEO Type = (1 << iota) // Type is video
AUDIO // Type is audio
SUBTITLE // Type is subtitle
DATA // Type is data
UNKNOWN // Type is unknown
ANY = NONE // Type is any (used for filtering)
mintype = VIDEO
maxtype = UNKNOWN
)

///////////////////////////////////////////////////////////////////////////////
// STINGIFY

// Return the type as a string
func (t Type) String() string {
if t == NONE {
return t.FlagString()
Expand All @@ -36,6 +38,7 @@ func (t Type) String() string {
return str[1:]
}

// Return a flag as a string
func (t Type) FlagString() string {
switch t {
case NONE:
Expand All @@ -56,6 +59,7 @@ func (t Type) FlagString() string {
///////////////////////////////////////////////////////////////////////////////
// METHODS

// Returns true if the type matches a set of flags
func (t Type) Is(u Type) bool {
return t&u == u
}

0 comments on commit 03b9947

Please sign in to comment.