MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / thirdPartyBuffer

Function thirdPartyBuffer

src/buffer.go:1022–1387  ·  view source on GitHub ↗

Buffer with FFMPEG

(streamID int, playlistID string, useBackup bool, backupNumber int)

Source from the content-addressed store, hash-verified

1020
1021// Buffer with FFMPEG
1022func thirdPartyBuffer(streamID int, playlistID string, useBackup bool, backupNumber int) {
1023
1024 if p, ok := BufferInformation.Load(playlistID); ok {
1025
1026 var playlist = p.(Playlist)
1027 var debug, path, options, bufferType string
1028 var tmpSegment = 1
1029 var bufferSize = Settings.BufferSize * 1024
1030 var stream = playlist.Streams[streamID]
1031 var buf bytes.Buffer
1032 var fileSize = 0
1033 var streamStatus = make(chan bool)
1034
1035 var tmpFolder = playlist.Streams[streamID].Folder
1036 var url = playlist.Streams[streamID].URL
1037 if useBackup {
1038 if backupNumber >= 1 && backupNumber <= 3 {
1039 switch backupNumber {
1040 case 1:
1041 if stream.BackupChannel1 != nil {
1042 url = stream.BackupChannel1.URL
1043 showHighlight("START OF BACKUP 1 STREAM")
1044 showInfo("Backup Channel 1 URL: " + url)
1045 }
1046 case 2:
1047 if stream.BackupChannel2 != nil {
1048 url = stream.BackupChannel2.URL
1049 showHighlight("START OF BACKUP 2 STREAM")
1050 showInfo("Backup Channel 2 URL: " + url)
1051 }
1052 case 3:
1053 if stream.BackupChannel3 != nil {
1054 url = stream.BackupChannel3.URL
1055 showHighlight("START OF BACKUP 3 STREAM")
1056 showInfo("Backup Channel 3 URL: " + url)
1057 }
1058 }
1059 }
1060 }
1061
1062 stream.Status = false
1063
1064 bufferType = strings.ToUpper(playlist.Buffer)
1065
1066 switch playlist.Buffer {
1067
1068 case "ffmpeg":
1069
1070 if Settings.FFmpegForceHttp {
1071 url = strings.Replace(url, "https://", "http://", -1)
1072 showInfo("Forcing URL to HTTP for FFMPEG: " + url)
1073 }
1074
1075 path = Settings.FFmpegPath
1076 options = Settings.FFmpegOptions
1077
1078 case "vlc":
1079 path = Settings.VLCPath

Callers 1

bufferingStreamFunction · 0.85

Calls 9

showHighlightFunction · 0.85
showInfoFunction · 0.85
ShowErrorFunction · 0.85
checkVFSFolderFunction · 0.85
killClientConnectionFunction · 0.85
checkFileFunction · 0.85
showDebugFunction · 0.85
clientConnectionFunction · 0.85
getPlatformPathFunction · 0.70

Tested by

no test coverage detected