mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 16:12:19 +00:00
Add method to get quality
This commit is contained in:
parent
f825d3d513
commit
bb589a71ce
@ -2,6 +2,7 @@
|
|||||||
package messaging
|
package messaging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ func (s *Stream) CreateQuality(name string) (quality *Quality) {
|
|||||||
return quality
|
return quality
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteQuality removes a quality.
|
// DeleteQuality removes a stream quality.
|
||||||
func (s *Stream) DeleteQuality(name string) {
|
func (s *Stream) DeleteQuality(name string) {
|
||||||
// Make sure we did not already close this output
|
// Make sure we did not already close this output
|
||||||
s.lockQualities.Lock()
|
s.lockQualities.Lock()
|
||||||
@ -44,6 +45,17 @@ func (s *Stream) DeleteQuality(name string) {
|
|||||||
s.lockQualities.Unlock()
|
s.lockQualities.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetQuality gets a specific stream quality.
|
||||||
|
func (s *Stream) GetQuality(name string) (quality *Quality, err error) {
|
||||||
|
s.lockQualities.Lock()
|
||||||
|
quality, ok := s.qualities[name]
|
||||||
|
s.lockQualities.Unlock()
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("quality does not exist")
|
||||||
|
}
|
||||||
|
return quality, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ClientCount returns the number of clients.
|
// ClientCount returns the number of clients.
|
||||||
func (s *Stream) ClientCount() int {
|
func (s *Stream) ClientCount() int {
|
||||||
return s.nbClients
|
return s.nbClients
|
||||||
|
Loading…
Reference in New Issue
Block a user