@@ -29,6 +29,10 @@ import (
2929 xfyne "github.com/xaionaro-go/xfyne/widget"
3030)
3131
32+ const (
33+ trackRemove = "<remove>"
34+ )
35+
3236func (p * Panel ) startRestreamPage (
3337 ctx context.Context ,
3438) {
@@ -1089,13 +1093,15 @@ func (p *Panel) openAddOrEditRestreamWindow(
10891093 videoCodecs = append (videoCodecs , videoCodec )
10901094 videoCodecStrs = append (videoCodecStrs , ptr (videoCodec ).String ())
10911095 }
1096+ videoCodecStrs = append (videoCodecStrs , trackRemove )
10921097
10931098 var audioCodecStrs []string
10941099 var audioCodecs []recoder.AudioCodec
10951100 for audioCodec := recoder .AudioCodecCopy ; audioCodec < recoder .EndOfAudioCodec ; audioCodec ++ {
10961101 audioCodecs = append (audioCodecs , audioCodec )
10971102 audioCodecStrs = append (audioCodecStrs , ptr (audioCodec ).String ())
10981103 }
1104+ audioCodecStrs = append (audioCodecStrs , trackRemove )
10991105
11001106 recodingVideoLabel := widget .NewLabel ("Video:" )
11011107 recodingAudioLabel := widget .NewLabel ("Audio:" )
@@ -1113,14 +1119,21 @@ func (p *Panel) openAddOrEditRestreamWindow(
11131119 recodingVideoBitrate .SetText (fmt .Sprintf ("%d" , uint (* q )))
11141120 }
11151121 recodingVideoCodecSelector := widget .NewSelect (videoCodecStrs , func (s string ) {
1116- if s == ptr (recoder .VideoCodecCopy ).String () {
1122+ switch s {
1123+ case ptr (recoder .VideoCodecCopy ).String ():
11171124 recodingVideoBitrate .Disable ()
1118- } else {
1125+ fwd .Encode .OutputVideoTracks = fwd .Encode .OutputVideoTracks [:1 ]
1126+ fwd .Encode .OutputVideoTracks [0 ].Config .Codec = recoder .VideoCodecCopy
1127+ case trackRemove :
1128+ recodingVideoBitrate .Disable ()
1129+ fwd .Encode .OutputVideoTracks = fwd .Encode .OutputVideoTracks [:0 ]
1130+ default :
11191131 recodingVideoBitrate .Enable ()
1120- }
1121- for _ , videoCodec := range videoCodecs {
1122- if ptr (videoCodec ).String () == s {
1123- fwd .Encode .OutputVideoTracks [0 ].Config .Codec = videoCodec
1132+ fwd .Encode .OutputVideoTracks = fwd .Encode .OutputVideoTracks [:1 ]
1133+ for _ , videoCodec := range videoCodecs {
1134+ if ptr (videoCodec ).String () == s {
1135+ fwd .Encode .OutputVideoTracks [0 ].Config .Codec = videoCodec
1136+ }
11241137 }
11251138 }
11261139 })
@@ -1142,14 +1155,21 @@ func (p *Panel) openAddOrEditRestreamWindow(
11421155 recodingAudioBitrate .SetText (fmt .Sprintf ("%d" , uint (* q )))
11431156 }
11441157 recodingAudioCodecSelector := widget .NewSelect (audioCodecStrs , func (s string ) {
1145- if s == ptr (recoder .AudioCodecCopy ).String () {
1158+ switch s {
1159+ case ptr (recoder .AudioCodecCopy ).String ():
11461160 recodingAudioBitrate .Disable ()
1147- } else {
1161+ fwd .Encode .OutputAudioTracks = fwd .Encode .OutputAudioTracks [:1 ]
1162+ fwd .Encode .OutputAudioTracks [0 ].Config .Codec = recoder .AudioCodecCopy
1163+ case trackRemove :
1164+ recodingAudioBitrate .Disable ()
1165+ fwd .Encode .OutputAudioTracks = fwd .Encode .OutputAudioTracks [:0 ]
1166+ default :
11481167 recodingAudioBitrate .Enable ()
1149- }
1150- for _ , audioCodec := range audioCodecs {
1151- if ptr (audioCodec ).String () == s {
1152- fwd .Encode .OutputAudioTracks [0 ].Config .Codec = audioCodec
1168+ fwd .Encode .OutputAudioTracks = fwd .Encode .OutputAudioTracks [:1 ]
1169+ for _ , audioCodec := range audioCodecs {
1170+ if ptr (audioCodec ).String () == s {
1171+ fwd .Encode .OutputAudioTracks [0 ].Config .Codec = audioCodec
1172+ }
11531173 }
11541174 }
11551175 })
@@ -1440,10 +1460,16 @@ func (p *Panel) displayStreamForwards(
14401460 if fwd .Quirks .StartAfterYoutubeRecognizedStream .Enabled {
14411461 quirksStrings = append (quirksStrings , "after-YT" )
14421462 }
1443- if fwd .Encode .Enabled && len (fwd .Encode .OutputVideoTracks ) > 0 && len (fwd .Encode .OutputAudioTracks ) > 0 {
1444- videoTrack := fwd .Encode .OutputVideoTracks [0 ]
1445- audioTrack := fwd .Encode .OutputAudioTracks [0 ]
1446- captionStr += fmt .Sprintf (" [%s/%s]" , videoTrack .Config .Codec .String (), audioTrack .Config .Codec .String ())
1463+ if fwd .Encode .Enabled {
1464+ audioTrackCodecString := "<removed>"
1465+ videoTrackCodecString := "<removed>"
1466+ if len (fwd .Encode .OutputVideoTracks ) > 0 {
1467+ videoTrackCodecString = fwd .Encode .OutputVideoTracks [0 ].Config .Codec .String ()
1468+ }
1469+ if len (fwd .Encode .OutputAudioTracks ) > 0 {
1470+ audioTrackCodecString = fwd .Encode .OutputAudioTracks [0 ].Config .Codec .String ()
1471+ }
1472+ captionStr += fmt .Sprintf (" [%s/%s]" , videoTrackCodecString , audioTrackCodecString )
14471473 }
14481474 if len (quirksStrings ) != 0 {
14491475 captionStr += fmt .Sprintf (" (%s)" , strings .Join (quirksStrings , "," ))
0 commit comments