+
+static void handle_json_rpc_msg(Player *player, JSONValue *v) {
+ if(v->type != JSON_OBJECT) return;
+
+ JSONValue *request_id_v = json_obj_get(&v->value.object, "request_id");
+ if(request_id_v && request_id_v->type == JSON_STRING) {
+ int request_id = 0;
+ if(request_id_v->value.string.length == 2) {
+ request_id = 10 * (request_id_v->value.string.string[0] - '0') + (request_id_v->value.string.string[1] - '0');
+ handle_json_rpc_reqid(player, v, request_id);
+ return;
+ }
+ }
+
+ json_print(v, NULL, 0);
+}
+
+static void handle_json_rpc_reqid(Player *player, JSONValue *v, int reqid) {
+ JSONValue *data = json_obj_get(&v->value.object, "data");
+ if(!data) return;
+
+ switch(reqid) {
+ case REQ_ID_PLAYBACK_TIME_INT: {
+ if(data->type == JSON_NUMBER) {
+ player->playback_time = data->value.number.value;
+ }
+ break;
+ }
+ }
+}
+