Add conversion from string to QosAnalyzerAlg enum

parent a762948d
......@@ -100,6 +100,7 @@ enum _MSQosAnalyzerAlgorithm {
};
typedef enum _MSQosAnalyzerAlgorithm MSQosAnalyzerAlgorithm;
const char* ms_qos_analyzer_algorithm_to_string(MSQosAnalyzerAlgorithm alg);
const MSQosAnalyzerAlgorithm ms_qos_analyzer_algorithm_from_string(const char* alg);
/**
* A MSQosAnalyzer is responsible to analyze RTCP feedback and suggest
......
......@@ -422,7 +422,7 @@ static int ms_opus_enc_get_bitrate(MSFilter *f, void *arg) {
}
/* ptime can be set using this function only at first call (between init and preprocess) */
/* other calls will return -1 to force the adaptative bit rate to use the set bitrate function */
/* other calls will return -1 to force the adaptive bit rate to use the set bitrate function */
/* the ptime is managed by the set bitrate function which increase ptime only at low bitrate */
static int ms_opus_enc_set_ptime(MSFilter *f, void *arg) {
OpusEncData *d = (OpusEncData *)f->data;
......
......@@ -83,6 +83,15 @@ const char* ms_qos_analyzer_algorithm_to_string(MSQosAnalyzerAlgorithm alg) {
default: return NULL;
}
}
const MSQosAnalyzerAlgorithm ms_qos_analyzer_algorithm_from_string(const char* alg) {
if (alg == NULL || strcmp(alg, "Simple")==0)
return MSQosAnalyzerAlgorithmSimple;
else if (strcmp(alg, "Stateful")==0)
return MSQosAnalyzerAlgorithmStateful;
ms_error("Invalid qos analyzer: %s", alg);
return MSQosAnalyzerAlgorithmSimple;
}
const char* ms_qos_analyzer_get_name(MSQosAnalyzer *obj){
return ms_qos_analyzer_algorithm_to_string(obj->type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment