@@ -562,13 +562,13 @@ public static function getAvailableResolutionsInfo()
562562 * Shows only the resolutions that will actually be encoded for the current user
563563 * @return array Array of resolution info considering user restrictions
564564 */
565- public static function getAvailableResolutionsInfoForUser ()
565+ public static function getAvailableResolutionsInfoForUser ($ streamersId )
566566 {
567567 $ resolutions = [];
568568 $ availableResolutions = Format::getAvailableResolutions ();
569569
570570 // Get the final resolutions that will be used for encoding (with user restrictions)
571- $ finalResolutions = self ::getSelectedResolutionsWithUserRestrictions ();
571+ $ finalResolutions = self ::getSelectedResolutionsWithUserRestrictions ($ streamersId );
572572
573573 foreach ($ availableResolutions as $ key => $ resolution ) {
574574 // Check if this resolution will actually be encoded for the current user
@@ -582,7 +582,7 @@ public static function getAvailableResolutionsInfoForUser()
582582
583583 // Different color based on user permissions
584584 require_once __DIR__ . '/Login.php ' ;
585- $ userAllowedResolutions = Login::getAllowedResolutions ();
585+ $ userAllowedResolutions = Login::getAllowedResolutions ($ streamersId );
586586
587587 if (empty ($ userAllowedResolutions ) || in_array ($ resolution , $ userAllowedResolutions )) {
588588 $ label .= "success " ; // Green for allowed resolutions
@@ -703,14 +703,14 @@ private static function getFinalResolutions($userAllowedResolutions, $encoderEna
703703 * Get selected resolutions with user group restrictions applied
704704 * @return array Final resolutions to use for encoding
705705 */
706- private static function getSelectedResolutionsWithUserRestrictions ()
706+ private static function getSelectedResolutionsWithUserRestrictions ($ streamersId )
707707 {
708708 // Get encoder configured resolutions
709709 $ encoderResolutions = self ::getSelectedResolutions ();
710710
711711 // Get user allowed resolutions from login session
712712 require_once __DIR__ . '/Login.php ' ;
713- $ userAllowedResolutions = Login::getAllowedResolutions ();
713+ $ userAllowedResolutions = Login::getAllowedResolutions ($ streamersId );
714714
715715 // Apply user restrictions
716716 $ finalResolutions = self ::getFinalResolutions ($ userAllowedResolutions , $ encoderResolutions );
@@ -720,7 +720,7 @@ private static function getSelectedResolutionsWithUserRestrictions()
720720 return $ finalResolutions ;
721721 }
722722
723- static function loadEncoderConfiguration ()
723+ static function loadEncoderConfiguration ($ streamersId )
724724 {
725725 $ availableConfiguration = self ::getAvailableConfigurations ();
726726
@@ -730,7 +730,7 @@ static function loadEncoderConfiguration()
730730 $ videoFramerate = [];
731731
732732 // Use the new method that applies user group restrictions
733- $ selectedResolutions = self ::getSelectedResolutionsWithUserRestrictions ();
733+ $ selectedResolutions = self ::getSelectedResolutionsWithUserRestrictions ($ streamersId );
734734
735735 sort ($ selectedResolutions );
736736
@@ -764,7 +764,10 @@ private static function getDynamicCommandFromFormat($pathFileName, $encoder_queu
764764 //$audioTracks = self::getAudioTracks($pathFileName);
765765 $ advancedCustom = getAdvancedCustomizedObjectData ();
766766
767- $ encoderConfig = self ::loadEncoderConfiguration ();
767+ $ encoder = new Encoder ($ encoder_queue_id );
768+ $ streamersId = $ encoder ->getStreamers_id ();
769+
770+ $ encoderConfig = self ::loadEncoderConfiguration ($ streamersId );
768771 $ resolutions = $ encoderConfig ['resolutions ' ];
769772 $ bandwidth = $ encoderConfig ['bandwidth ' ];
770773 $ videoFramerate = $ encoderConfig ['videoFramerate ' ];
@@ -833,12 +836,14 @@ private static function getDynamicCommandFromFormat($pathFileName, $encoder_queu
833836 return $ command ;
834837 }
835838
836- private static function preProcessDynamicHLS ($ pathFileName , $ destinationFile )
839+ private static function preProcessDynamicHLS ($ pathFileName , $ destinationFile, $ encoder_queue_id )
837840 {
841+ $ encoder = new Encoder ($ encoder_queue_id );
842+ $ streamersId = $ encoder ->getStreamers_id ();
838843 $ height = self ::getResolution ($ pathFileName );
839844 //$audioTracks = self::getAudioTracks($pathFileName);
840845 // TODO: This method should be refactored to use loadEncoderConfiguration instead of getAvailableConfigurations...
841- $ encoderConfig = self ::loadEncoderConfiguration ();
846+ $ encoderConfig = self ::loadEncoderConfiguration ($ streamersId );
842847 $ resolutions = $ encoderConfig ['resolutions ' ];
843848 $ bandwidth = $ encoderConfig ['bandwidth ' ];
844849 $ audioBitrate = $ encoderConfig ['audioBitrate ' ];
@@ -1009,11 +1014,11 @@ private static function exec($format_id, $pathFileName, $destinationFile, $encod
10091014 if (empty ($ fc ) || $ format_id == 30 ) {
10101015 if (empty ($ global ['disableHLSAudioMultitrack ' ])) {
10111016 _error_log ("AVideo-Encoder Format::exec use HLSProcessor " );
1012- $ dynamic = HLSProcessor::createHLSWithAudioTracks ($ pathFileName , $ destinationFile );
1017+ $ dynamic = HLSProcessor::createHLSWithAudioTracks ($ pathFileName , $ destinationFile, $ encoder_queue_id );
10131018 _error_log ("AVideo-Encoder Format::exec use HLSProcessor Complete " );
10141019 } else {
10151020 _error_log ("AVideo-Encoder Format::exec disableHLSAudioMultitrack " );
1016- $ dynamic = self ::preProcessDynamicHLS ($ pathFileName , $ destinationFile );
1021+ $ dynamic = self ::preProcessDynamicHLS ($ pathFileName , $ destinationFile, $ encoder_queue_id );
10171022 }
10181023 $ destinationFile = $ dynamic [0 ];
10191024 $ fc = $ dynamic [1 ];
0 commit comments