Skip to content

Commit

Permalink
Fixing auto-builds
Browse files Browse the repository at this point in the history
  • Loading branch information
xaionaro committed Jan 6, 2025
1 parent 47c0315 commit 6dc0a27
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 68 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
with:
go-version: '1.23'
check-latest: true
#- name: add ffmpeg7 repo
# run: sudo add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg7
- name: add ffmpeg7 repo
run: sudo add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg7
- name: install fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: apt install
Expand All @@ -49,6 +49,9 @@ jobs:
libglfw3-dev \
libasound2-dev \
libxxf86vm-dev \
libsrt-gnutls-dev \
libgnutls28-dev \
nettle-dev \
- name: apt install
if: ${{ matrix.target.name == 'streampanel-windows-amd64.zip' }}
run: |
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $(GOPATH)/bin/pkg-config-wrapper:
sh -c 'cd 3rdparty/amd64/windows && wget https://get.videolan.org/vlc/$(WINDOWS_VLC_VERSION)/win64/vlc-$(WINDOWS_VLC_VERSION)-win64.7z && 7z -y x vlc-$(WINDOWS_VLC_VERSION)-win64.7z && rm -f vlc-$(WINDOWS_VLC_VERSION)-win64.7z'
sh -c 'cd 3rdparty/amd64/windows && wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-04-30-12-51/ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip && unzip -o ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip && rm -f ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip'
mkdir 3rdparty/amd64/windows/mpv
sh -c 'cd 3rdparty/amd64/windows/mpv && wget https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20241025/mpv-x86_64-20241025-git-5c59f8a.7z && 7z -y x mpv-x86_64-20241025-git-5c59f8a.7z && rm -f mpv-x86_64-20241025-git-5c59f8a.7z'
sh -c 'cd 3rdparty/amd64/windows/mpv && wget https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20250105/mpv-x86_64-20250105-git-996e58a.7z && 7z -y x mpv-x86_64-20250105-git-996e58a.7z && rm -f mpv-x86_64-20250105-git-996e58a.7z'
touch 3rdparty/amd64/windows/ready

windows-builddir: build/streampanel-windows-amd64
Expand Down Expand Up @@ -283,3 +283,15 @@ subtitleswindow-linux-amd64: builddir
subtitleswindow-windows-amd64: builddir windows-deps
$(eval INSTALL_DEST?=build/subtitleswindow-windows-amd64.exe)
PKG_CONFIG_PATH=$(WINDOWS_PKG_CONFIG_PATH) CGO_ENABLED=1 CGO_LDFLAGS="-static" CGO_CFLAGS="$(WINDOWS_CGO_FLAGS)" CC=x86_64-w64-mingw32-gcc GOOS=windows go build $(GOBUILD_FLAGS) -ldflags "$(LINKER_FLAGS_WINDOWS)" -o "$(INSTALL_DEST)" ./pkg/subtitleswindow/cmd/subtitleswindow

ffstream-linux-amd64: builddir
GOOS=linux GOARCH=amd64 go build -o build/ffstream-linux-amd64 ./cmd/ffstream

ffstream-linux-arm64: builddir
GOOS=linux GOARCH=arm64 go build -o build/ffstream-linux-arm64 ./cmd/ffstream

ffstreamctl-linux-amd64: builddir
GOOS=linux GOARCH=amd64 go build -o build/ffstreamctl-linux-amd64 ./cmd/ffstreamctl

ffstreamctl-linux-arm64: builddir
GOOS=linux GOARCH=arm64 go build -o build/ffstreamctl-linux-arm64 ./cmd/ffstreamctl
4 changes: 2 additions & 2 deletions cmd/ffstreamctl/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/facebookincubator/go-belt/tool/logger"
"github.com/spf13/cobra"
"github.com/xaionaro-go/streamctl/pkg/ffstream"
"github.com/xaionaro-go/streamctl/pkg/ffstream/types"
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/client"
"github.com/xaionaro-go/streamctl/pkg/observability"
)
Expand Down Expand Up @@ -211,7 +211,7 @@ func encoderConfigGet(cmd *cobra.Command, args []string) {
func encoderConfigSet(cmd *cobra.Command, args []string) {
ctx := cmd.Context()

cfg := jsonInput[ffstream.EncoderConfig](ctx, cmd.InOrStdin())
cfg := jsonInput[types.EncoderConfig](ctx, cmd.InOrStdin())

remoteAddr, err := cmd.Flags().GetString("remote-addr")
assertNoError(ctx, err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ replace github.com/rs/zerolog v1.33.0 => github.com/xaionaro-go/zerolog2belt v0.

replace github.com/bluenviron/gortsplib/v4 v4.11.0 => github.com/xaionaro-go/gortsplib/v4 v4.0.0-20241123213409-7279dabb7de6

replace github.com/asticode/go-astiav v0.29.0 => github.com/xaionaro-go/astiav v0.0.0-20250105041745-aec6a5526b2d
replace github.com/asticode/go-astiav v0.29.0 => github.com/xaionaro-go/astiav v0.0.0-20250105042023-71b01c4992c5

require (
github.com/facebookincubator/go-belt v0.0.0-20240804203001-846c4409d41c
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,8 @@ github.com/volatiletech/strmangle v0.0.6/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV
github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/wlynxg/anet v0.0.4 h1:0de1OFQxnNqAu+x2FAKKCVIrnfGKQbs7FQz++tB0+Uw=
github.com/wlynxg/anet v0.0.4/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/xaionaro-go/astiav v0.0.0-20250105041745-aec6a5526b2d h1:9AX5LRq1yvKMnSoz7upy8k1jf+QZ7/nrdkDHOyIUJwo=
github.com/xaionaro-go/astiav v0.0.0-20250105041745-aec6a5526b2d/go.mod h1:K7D8UC6GeQt85FUxk2KVwYxHnotrxuEnp5evkkudc2s=
github.com/xaionaro-go/astiav v0.0.0-20250105042023-71b01c4992c5 h1:Euq/60vGX7es7JSt96EgVgO8EYtemz3F55keyLyAf08=
github.com/xaionaro-go/astiav v0.0.0-20250105042023-71b01c4992c5/go.mod h1:K7D8UC6GeQt85FUxk2KVwYxHnotrxuEnp5evkkudc2s=
github.com/xaionaro-go/datacounter v1.0.4 h1:+QMZLmu73R5WGkQfUPwlXF/JFN+Weo4iuDZkiL2wVm8=
github.com/xaionaro-go/datacounter v1.0.4/go.mod h1:Sf9vBevuV6w5iE6K3qJ9pWVKcyS60clWBUSQLjt5++c=
github.com/xaionaro-go/fyne/v2 v2.0.0-20241020235352-fd61e4920f24 h1:eewdCRMkJmK2ipI9653XL2dE3EFS2I3GTFRadIyyEo4=
Expand Down
14 changes: 3 additions & 11 deletions pkg/ffstream/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/asticode/go-astiav"
"github.com/facebookincubator/go-belt/tool/logger"
"github.com/xaionaro-go/streamctl/pkg/ffstream/types"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder"
)

Expand All @@ -26,17 +27,8 @@ type Encoder struct {

var _ recoder.Encoder = (*Encoder)(nil)

type CodecConfig struct {
CodecName string
AveragingPeriod time.Duration
AverageBitRate uint64
CustomOptions []recoder.CustomOption
}

type EncoderConfig struct {
Audio CodecConfig
Video CodecConfig
}
type CodecConfig = types.CodecConfig
type EncoderConfig = types.EncoderConfig

func NewEncoder() *Encoder {
return &Encoder{
Expand Down
19 changes: 19 additions & 0 deletions pkg/ffstream/types/encoder_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package types

import (
"time"

"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
)

type CodecConfig struct {
CodecName string
AveragingPeriod time.Duration
AverageBitRate uint64
CustomOptions []types.CustomOption
}

type EncoderConfig struct {
Audio CodecConfig
Video CodecConfig
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

"github.com/facebookincubator/go-belt/tool/logger"
"github.com/xaionaro-go/libsrt"
"github.com/xaionaro-go/streamctl/pkg/ffstream"
ffstreamtypes "github.com/xaionaro-go/streamctl/pkg/ffstream/types"
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/grpc/go/ffstream_grpc"
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/grpc/goconv"
"github.com/xaionaro-go/streamctl/pkg/observability"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder"
recodertypes "github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
Expand Down Expand Up @@ -81,8 +81,8 @@ func (c *Client) SetLoggingLevel(
func (c *Client) AddInput(
ctx context.Context,
url string,
customOptions []recoder.CustomOption,
) (_ recoder.InputID, _err error) {
customOptions []recodertypes.CustomOption,
) (_ recodertypes.InputID, _err error) {
client, conn, err := c.grpcClient()
if err != nil {
return 0, err
Expand All @@ -100,14 +100,14 @@ func (c *Client) AddInput(
return 0, fmt.Errorf("query error: %w", err)
}

return recoder.InputID(resp.GetId()), nil
return recodertypes.InputID(resp.GetId()), nil
}

func (c *Client) AddOutput(
ctx context.Context,
url string,
customOptions []recoder.CustomOption,
) (recoder.OutputID, error) {
customOptions []recodertypes.CustomOption,
) (recodertypes.OutputID, error) {
client, conn, err := c.grpcClient()
if err != nil {
return 0, err
Expand All @@ -122,12 +122,12 @@ func (c *Client) AddOutput(
return 0, fmt.Errorf("query error: %w", err)
}

return recoder.OutputID(resp.GetId()), nil
return recodertypes.OutputID(resp.GetId()), nil
}

func (c *Client) RemoveOutput(
ctx context.Context,
outputID recoder.OutputID,
outputID recodertypes.OutputID,
) error {
client, conn, err := c.grpcClient()
if err != nil {
Expand All @@ -147,7 +147,7 @@ func (c *Client) RemoveOutput(

func (c *Client) GetEncoderConfig(
ctx context.Context,
) (*ffstream.EncoderConfig, error) {
) (*ffstreamtypes.EncoderConfig, error) {
client, conn, err := c.grpcClient()
if err != nil {
return nil, err
Expand All @@ -164,7 +164,7 @@ func (c *Client) GetEncoderConfig(

func (c *Client) SetEncoderConfig(
ctx context.Context,
cfg ffstream.EncoderConfig,
cfg ffstreamtypes.EncoderConfig,
) error {
client, conn, err := c.grpcClient()
if err != nil {
Expand Down Expand Up @@ -218,7 +218,7 @@ func (c *Client) End(

func (c *Client) GetEncoderStats(
ctx context.Context,
) (*recoder.EncoderStatistics, error) {
) (*recodertypes.EncoderStatistics, error) {
client, conn, err := c.grpcClient()
if err != nil {
return nil, err
Expand Down
10 changes: 5 additions & 5 deletions pkg/ffstreamserver/grpc/goconv/custom_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package goconv

import (
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/grpc/go/ffstream_grpc"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
)

func CustomOptionsFromGRPC(
opts []*ffstream_grpc.CustomOption,
) []recoder.CustomOption {
result := make([]recoder.CustomOption, 0, len(opts))
) []types.CustomOption {
result := make([]types.CustomOption, 0, len(opts))

for _, opt := range opts {
result = append(result, recoder.CustomOption{
result = append(result, types.CustomOption{
Key: opt.GetKey(),
Value: opt.GetValue(),
})
Expand All @@ -21,7 +21,7 @@ func CustomOptionsFromGRPC(
}

func CustomOptionsToGRPC(
opts []recoder.CustomOption,
opts []types.CustomOption,
) []*ffstream_grpc.CustomOption {
result := make([]*ffstream_grpc.CustomOption, 0, len(opts))

Expand Down
12 changes: 6 additions & 6 deletions pkg/ffstreamserver/grpc/goconv/encoder_config.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package goconv

import (
"github.com/xaionaro-go/streamctl/pkg/ffstream"
"github.com/xaionaro-go/streamctl/pkg/ffstream/types"
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/grpc/go/ffstream_grpc"
)

func EncoderConfigFromGRPC(
req *ffstream_grpc.EncoderConfig,
) ffstream.EncoderConfig {
return ffstream.EncoderConfig{
Audio: ffstream.CodecConfig{
) types.EncoderConfig {
return types.EncoderConfig{
Audio: types.CodecConfig{
CodecName: req.GetAudio().GetCodecName(),
AveragingPeriod: DurationFromGRPC(int64(req.GetAudio().GetAveragingPeriod())),
AverageBitRate: req.GetAudio().GetAverageBitRate(),
CustomOptions: CustomOptionsFromGRPC(req.GetAudio().GetCustomOptions()),
},
Video: ffstream.CodecConfig{
Video: types.CodecConfig{
CodecName: req.GetVideo().GetCodecName(),
AveragingPeriod: DurationFromGRPC(int64(req.GetVideo().GetAveragingPeriod())),
AverageBitRate: req.GetVideo().GetAverageBitRate(),
Expand All @@ -25,7 +25,7 @@ func EncoderConfigFromGRPC(
}

func EncoderConfigToGRPC(
cfg ffstream.EncoderConfig,
cfg types.EncoderConfig,
) *ffstream_grpc.EncoderConfig {
return &ffstream_grpc.EncoderConfig{
Audio: &ffstream_grpc.CodecConfig{
Expand Down
12 changes: 6 additions & 6 deletions pkg/ffstreamserver/grpc/goconv/encoder_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package goconv

import (
"github.com/xaionaro-go/streamctl/pkg/ffstreamserver/grpc/go/ffstream_grpc"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
)

func EncoderStatsToGRPC(
req *recoder.EncoderStatistics,
req *types.EncoderStatistics,
) *ffstream_grpc.GetEncoderStatsReply {
return &ffstream_grpc.GetEncoderStatsReply{
BytesCountRead: req.BytesCountRead,
Expand All @@ -26,18 +26,18 @@ func EncoderStatsToGRPC(

func EncoderStatsFromGRPC(
req *ffstream_grpc.GetEncoderStatsReply,
) *recoder.EncoderStatistics {
result := &recoder.EncoderStatistics{
) *types.EncoderStatistics {
result := &types.EncoderStatistics{
BytesCountRead: req.GetBytesCountRead(),
BytesCountWrote: req.GetBytesCountWrote(),
FramesRead: recoder.EncoderFramesStatistics{
FramesRead: types.EncoderFramesStatistics{
Unparsed: req.GetFramesReadUnparsed(),
VideoUnprocessed: req.GetFramesReadVideoUnprocessed(),
AudioUnprocessed: req.GetFramesReadAudioUnprocessed(),
VideoProcessed: req.GetFramesReadVideoProcessed(),
AudioProcessed: req.GetFramesReadAudioProcessed(),
},
FramesWrote: recoder.EncoderFramesStatistics{
FramesWrote: types.EncoderFramesStatistics{
Unparsed: req.GetFramesWroteUnparsed(),
VideoUnprocessed: req.GetFramesWroteVideoUnprocessed(),
AudioUnprocessed: req.GetFramesWroteAudioUnprocessed(),
Expand Down
7 changes: 3 additions & 4 deletions pkg/recoder/libav/recoder/custom_option.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package recoder

type CustomOption struct {
Key string
Value string
}
import "github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"

type CustomOption = types.CustomOption
17 changes: 3 additions & 14 deletions pkg/recoder/libav/recoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/asticode/go-astiav"
"github.com/xaionaro-go/streamctl/pkg/recoder"
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
)

type EncoderInput struct {
Expand All @@ -32,20 +33,8 @@ func (o *EncoderOutput) UnrefAndFree() {
o.Packet.Free()
}

type EncoderFramesStatistics struct {
Unparsed uint64
VideoUnprocessed uint64
AudioUnprocessed uint64
VideoProcessed uint64
AudioProcessed uint64
}

type EncoderStatistics struct {
BytesCountRead uint64
BytesCountWrote uint64
FramesRead EncoderFramesStatistics
FramesWrote EncoderFramesStatistics
}
type EncoderFramesStatistics = types.EncoderFramesStatistics
type EncoderStatistics = types.EncoderStatistics

type CommonsEncoderFramesStatistics struct {
Unparsed atomic.Uint64
Expand Down
8 changes: 8 additions & 0 deletions pkg/recoder/libav/recoder/id.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package recoder

import (
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/recoder/types"
)

type InputID = types.InputID
type OutputID = types.OutputID
1 change: 0 additions & 1 deletion pkg/recoder/libav/recoder/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type InputConfig struct {
CustomOptions []CustomOption
}

type InputID uint64

type Input struct {
ID InputID
Expand Down
3 changes: 3 additions & 0 deletions pkg/recoder/libav/recoder/input_srt.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !windows
// +build !windows

package recoder

import (
Expand Down
1 change: 0 additions & 1 deletion pkg/recoder/libav/recoder/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type OutputConfig struct {
CustomOptions []CustomOption
}

type OutputID uint64

type Output struct {
ID OutputID
Expand Down
3 changes: 3 additions & 0 deletions pkg/recoder/libav/recoder/output_srt.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !windows
// +build !windows

package recoder

import (
Expand Down
Loading

0 comments on commit 6dc0a27

Please sign in to comment.