X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Fmedia%2Fmedia-api.c;h=578d0066663ac2847c7786d47faa9d8fa925d789;hb=39c2ebc125fcc694ac349ae196b62729c7f05037;hp=91676d4c621f7a93073521fecbeb80e28870873f;hpb=06382af9092babedbf56aa1c00b3bd7cb0b86cda;p=src%2Fapp-framework-binder.git diff --git a/plugins/media/media-api.c b/plugins/media/media-api.c index 91676d4c..578d0066 100644 --- a/plugins/media/media-api.c +++ b/plugins/media/media-api.c @@ -249,6 +249,7 @@ static void on_uploaded(struct afb_req *prequest, int status) afb_req_fail (request, "failed", "expected file not received"); else afb_req_success_f (request, NULL, "uploaded file %s", argfile.value); + afb_req_unref(request); } static void upload (struct afb_req request) { /* AFB_SESSION_CHECK */ @@ -290,8 +291,9 @@ static void upload (struct afb_req request) { /* AFB_SESSION_CHECK */ afb_req_fail (request, "failed", "out of memory"); } else if (!_rygel_upload (ctx, path, (void*)on_uploaded, prequest)) { + afb_req_unref(afb_req_unstore(prequest)); unlink(path); - afb_req_fail (afb_req_unstore(prequest), "failed", "Error when uploading file to media server... could not complete"); + afb_req_fail (request, "failed", "Error when uploading file to media server... could not complete"); } free(path); } @@ -301,7 +303,7 @@ static void ping (struct afb_req request) { /* AFB_SESSION_NONE */ } -static const struct AFB_restapi pluginApis[]= { +static const struct AFB_verb_desc_v1 verbs[]= { {"init" , AFB_SESSION_CHECK, init , "Media API - init" }, {"list" , AFB_SESSION_CHECK, list , "Media API - list" }, {"select" , AFB_SESSION_CHECK, selecting , "Media API - select" }, @@ -315,13 +317,15 @@ static const struct AFB_restapi pluginApis[]= { }; static const struct AFB_plugin pluginDesc = { - .type = AFB_PLUGIN_JSON, - .info = "Application Framework Binder - Media plugin", - .prefix = "media", - .apis = pluginApis + .type = AFB_PLUGIN_VERSION_1, + .v1 = { + .info = "Application Framework Binder - Media plugin", + .prefix = "media", + .verbs = verbs + } }; -const struct AFB_plugin *pluginRegister (const struct AFB_interface *itf) +const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf) { return &pluginDesc; }