[Spice-devel] [PATCH spice-server] Rename parse_video_codecs() to parse_next_video_codec()
Jonathon Jongsma
jjongsma at redhat.com
Fri Jun 29 20:52:03 UTC 2018
The new name describes the function more accurately. Also add
documentation for the function.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
server/reds.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index f89e68958..316364f4f 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3637,9 +3637,17 @@ static const int video_codec_caps[] = {
};
-/* Expected string: encoder:codec;encoder:codec */
-static const char* parse_video_codecs(const char *codecs, char **encoder,
- char **codec)
+/* Parses the given codec string and returns newly-allocated strings describing
+ * the next encoder and codec in the list. These strings must be freed by the
+ * caller.
+ *
+ * @codecs: a codec string in the following format: encoder:codec;encoder:codec
+ * @encoder: a location to return the parsed encoder
+ * @codec: a location to return the parsed codec
+ * @return the position of the next codec in the string
+ */
+static const char* parse_next_video_codec(const char *codecs, char **encoder,
+ char **codec)
{
if (!codecs) {
return NULL;
@@ -3673,7 +3681,7 @@ static void reds_set_video_codecs_from_string(RedsState *reds, const char *codec
video_codecs = g_array_new(FALSE, FALSE, sizeof(RedVideoCodec));
const char *c = codecs;
- while ( (c = parse_video_codecs(c, &encoder_name, &codec_name)) ) {
+ while ( (c = parse_next_video_codec(c, &encoder_name, &codec_name)) ) {
uint32_t encoder_index, codec_index;
if (!encoder_name || !codec_name) {
spice_warning("spice: invalid encoder:codec value at %s", codecs);
--
2.14.4
More information about the Spice-devel
mailing list