Merged codec and encoder separation with conflict resolution for fMP4 test expectations.

This commit is contained in:
2026-04-04 19:10:32 -04:00
33 changed files with 1226 additions and 702 deletions
+7 -5
View File
@@ -740,7 +740,9 @@ func SetChatDisabled(w http.ResponseWriter, r *http.Request) {
webutils.WriteSimpleResponse(w, true, "chat disabled status updated")
}
// SetVideoCodec will change the codec used for video encoding.
// SetVideoCodec will change the encoder used for video encoding.
// The endpoint name is kept for backward compatibility but the value
// is now an encoder type (e.g., "software", "nvenc") not an ffmpeg codec name.
func SetVideoCodec(w http.ResponseWriter, r *http.Request) {
if !requirePOST(w, r) {
return
@@ -748,17 +750,17 @@ func SetVideoCodec(w http.ResponseWriter, r *http.Request) {
configValue, success := getValueFromRequest(w, r)
if !success {
webutils.WriteSimpleResponse(w, false, "unable to change video codec")
webutils.WriteSimpleResponse(w, false, "unable to change video encoder")
return
}
configRepository := configrepository.Get()
if err := configRepository.SetVideoCodec(configValue.Value.(string)); err != nil {
webutils.WriteSimpleResponse(w, false, "unable to update codec")
if err := configRepository.SetVideoEncoder(configValue.Value.(string)); err != nil {
webutils.WriteSimpleResponse(w, false, "unable to update video encoder")
return
}
webutils.WriteSimpleResponse(w, true, "video codec updated")
webutils.WriteSimpleResponse(w, true, "video encoder updated")
}
// SetExternalActions will set the 3rd party actions for the web interface.
+38 -34
View File
@@ -34,6 +34,8 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
CPUUsageLevel: variant.CPUUsageLevel,
ScaledWidth: variant.ScaledWidth,
ScaledHeight: variant.ScaledHeight,
VideoCodec: variant.VideoCodec,
AudioCodec: variant.AudioCodec,
})
}
response := serverConfigAdminResponse{
@@ -77,12 +79,13 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
Enabled: configRepository.GetDirectoryEnabled(),
InstanceURL: configRepository.GetServerURL(),
},
S3: configRepository.GetS3Config(),
ExternalActions: configRepository.GetExternalActions(),
SupportedCodecs: transcoder.GetCodecs(ffmpeg),
VideoCodec: configRepository.GetVideoCodec(),
ForbiddenUsernames: usernameBlocklist,
SuggestedUsernames: usernameSuggestions,
S3: configRepository.GetS3Config(),
ExternalActions: configRepository.GetExternalActions(),
SupportedVideoEncoders: transcoder.GetAvailableVideoEncoders(ffmpeg),
SupportedAudioCodecs: transcoder.GetAvailableAudioCodecs(ffmpeg),
VideoEncoder: configRepository.GetVideoEncoder(),
ForbiddenUsernames: usernameBlocklist,
SuggestedUsernames: usernameSuggestions,
Federation: federationConfigResponse{
Enabled: configRepository.GetFederationEnabled(),
IsPrivate: configRepository.GetFederationIsPrivate(),
@@ -106,34 +109,35 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
}
type serverConfigAdminResponse struct {
InstanceDetails webConfigResponse `json:"instanceDetails"`
Notifications notificationsConfigResponse `json:"notifications"`
YP yp `json:"yp"`
FFmpegPath string `json:"ffmpegPath"`
AdminPassword string `json:"adminPassword"`
SocketHostOverride string `json:"socketHostOverride,omitempty"`
WebServerIP string `json:"webServerIP"`
VideoCodec string `json:"videoCodec"`
VideoServingEndpoint string `json:"videoServingEndpoint"`
S3 models.S3 `json:"s3"`
Federation federationConfigResponse `json:"federation"`
SupportedCodecs []string `json:"supportedCodecs"`
ExternalActions []models.ExternalAction `json:"externalActions"`
ForbiddenUsernames []string `json:"forbiddenUsernames"`
SuggestedUsernames []string `json:"suggestedUsernames"`
StreamKeys []generated.StreamKey `json:"streamKeys"`
VideoSettings videoSettings `json:"videoSettings"`
RTMPServerPort int `json:"rtmpServerPort"`
WebServerPort int `json:"webServerPort"`
ChatDisabled bool `json:"chatDisabled"`
ChatJoinMessagesEnabled bool `json:"chatJoinMessagesEnabled"`
ChatEstablishedUserMode bool `json:"chatEstablishedUserMode"`
ChatSpamProtectionEnabled bool `json:"chatSpamProtectionEnabled"`
ChatSlurFilterEnabled bool `json:"chatSlurFilterEnabled"`
ChatRequireAuthentication bool `json:"chatRequireAuthentication"`
DisableSearchIndexing bool `json:"disableSearchIndexing"`
StreamKeyOverridden bool `json:"streamKeyOverridden"`
HideViewerCount bool `json:"hideViewerCount"`
InstanceDetails webConfigResponse `json:"instanceDetails"`
Notifications notificationsConfigResponse `json:"notifications"`
YP yp `json:"yp"`
FFmpegPath string `json:"ffmpegPath"`
AdminPassword string `json:"adminPassword"`
SocketHostOverride string `json:"socketHostOverride,omitempty"`
WebServerIP string `json:"webServerIP"`
VideoEncoder string `json:"videoEncoder"`
VideoServingEndpoint string `json:"videoServingEndpoint"`
S3 models.S3 `json:"s3"`
Federation federationConfigResponse `json:"federation"`
SupportedVideoEncoders []transcoder.EncoderCodecSupport `json:"supportedVideoEncoders"`
SupportedAudioCodecs []string `json:"supportedAudioCodecs"`
ExternalActions []models.ExternalAction `json:"externalActions"`
ForbiddenUsernames []string `json:"forbiddenUsernames"`
SuggestedUsernames []string `json:"suggestedUsernames"`
StreamKeys []generated.StreamKey `json:"streamKeys"`
VideoSettings videoSettings `json:"videoSettings"`
RTMPServerPort int `json:"rtmpServerPort"`
WebServerPort int `json:"webServerPort"`
ChatDisabled bool `json:"chatDisabled"`
ChatJoinMessagesEnabled bool `json:"chatJoinMessagesEnabled"`
ChatEstablishedUserMode bool `json:"chatEstablishedUserMode"`
ChatSpamProtectionEnabled bool `json:"chatSpamProtectionEnabled"`
ChatSlurFilterEnabled bool `json:"chatSlurFilterEnabled"`
ChatRequireAuthentication bool `json:"chatRequireAuthentication"`
DisableSearchIndexing bool `json:"disableSearchIndexing"`
StreamKeyOverridden bool `json:"streamKeyOverridden"`
HideViewerCount bool `json:"hideViewerCount"`
}
type videoSettings struct {
@@ -105,13 +105,20 @@ type AdminServerConfig struct {
StreamKeyOverridden *bool `json:"streamKeyOverridden,omitempty"`
StreamKeys *[]StreamKey `json:"streamKeys,omitempty"`
SuggestedUsernames *[]string `json:"suggestedUsernames,omitempty"`
SupportedCodecs *[]string `json:"supportedCodecs,omitempty"`
VideoCodec *string `json:"videoCodec,omitempty"`
VideoServingEndpoint *string `json:"videoServingEndpoint,omitempty"`
VideoSettings *AdminVideoSettings `json:"videoSettings,omitempty"`
WebServerIP *string `json:"webServerIP,omitempty"`
WebServerPort *int `json:"webServerPort,omitempty"`
Yp *AdminYPInfo `json:"yp,omitempty"`
SupportedAudioCodecs *[]string `json:"supportedAudioCodecs,omitempty"`
SupportedVideoEncoders *[]struct {
EncoderDisplayName *string `json:"encoderDisplayName,omitempty"`
EncoderType *string `json:"encoderType,omitempty"`
SupportedVideoCodecs *[]string `json:"supportedVideoCodecs,omitempty"`
} `json:"supportedVideoEncoders,omitempty"`
// VideoEncoder The global video encoder type (e.g., software, nvenc, vaapi)
VideoEncoder *string `json:"videoEncoder,omitempty"`
VideoServingEndpoint *string `json:"videoServingEndpoint,omitempty"`
VideoSettings *AdminVideoSettings `json:"videoSettings,omitempty"`
WebServerIP *string `json:"webServerIP,omitempty"`
WebServerPort *int `json:"webServerPort,omitempty"`
Yp *AdminYPInfo `json:"yp,omitempty"`
}
// AdminStatus defines model for AdminStatus.
@@ -493,7 +500,10 @@ type StreamKey struct {
// StreamOutputVariant defines model for StreamOutputVariant.
type StreamOutputVariant struct {
AudioBitrate *int `json:"audioBitrate,omitempty"`
AudioBitrate *int `json:"audioBitrate,omitempty"`
// AudioCodec Audio compression format (e.g., aac). Defaults to aac.
AudioCodec *string `json:"audioCodec,omitempty"`
AudioPassthrough *bool `json:"audioPassthrough,omitempty"`
CpuUsageLevel *int `json:"cpuUsageLevel,omitempty"`
Framerate *int `json:"framerate,omitempty"`
@@ -501,6 +511,9 @@ type StreamOutputVariant struct {
ScaledHeight *int `json:"scaledHeight,omitempty"`
ScaledWidth *int `json:"scaledWidth,omitempty"`
VideoBitrate *int `json:"videoBitrate,omitempty"`
// VideoCodec Video compression format (e.g., h264). Defaults to h264.
VideoCodec *string `json:"videoCodec,omitempty"`
VideoPassthrough *bool `json:"videoPassthrough,omitempty"`
}
File diff suppressed because it is too large Load Diff