mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 10:22:19 +00:00
Add method to get quality
This commit is contained in:
parent
f825d3d513
commit
bb589a71ce
@ -2,6 +2,7 @@
|
||||
package messaging
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -33,7 +34,7 @@ func (s *Stream) CreateQuality(name string) (quality *Quality) {
|
||||
return quality
|
||||
}
|
||||
|
||||
// DeleteQuality removes a quality.
|
||||
// DeleteQuality removes a stream quality.
|
||||
func (s *Stream) DeleteQuality(name string) {
|
||||
// Make sure we did not already close this output
|
||||
s.lockQualities.Lock()
|
||||
@ -44,6 +45,17 @@ func (s *Stream) DeleteQuality(name string) {
|
||||
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.
|
||||
func (s *Stream) ClientCount() int {
|
||||
return s.nbClients
|
||||
|
Loading…
Reference in New Issue
Block a user