- char temp[TDM_PATH_LEN] = {0,}, temp2[TDM_PATH_LEN] = {0,};
- char *path = NULL, *path2;
- char *arg;
- char *end;
-
- snprintf(temp2, TDM_PATH_LEN, "%s", dump_str);
- path2 = strtostr(temp, TDM_PATH_LEN, temp2, "@");
- if (!path2 || path2[0] == '\0')
- path2 = TDM_DUMP_DIR;
- else
- path2++;
-
- tdm_debug_dump = 0;
-
- snprintf(temp, sizeof(temp), "%s", dump_str);
- arg = strtok_r(temp, ",", &end);
- TDM_GOTO_IF_FAIL(arg != NULL, done);
-
- if (!strncmp(arg, "none", 4)) {
- tdm_debug_dump = 0;
- TDM_SNPRINTF(reply, len, "path: %s\n", (tdm_debug_dump_dir) ? : "unknown");
- if (tdm_debug_dump_dir) {
- free(tdm_debug_dump_dir);
- tdm_debug_dump_dir = NULL;
- }
- goto done;
- }
-
- path = tdm_helper_dump_make_directory(path2, reply, len);
- TDM_GOTO_IF_FAIL(path != NULL, done);
-
- if (!strncmp(arg, "current", 7)) {
- tdm_private_output *o = NULL;
- if (!private_display) {
- TDM_WRN("no private_display");
- goto done;
- }
-
- LIST_FOR_EACH_ENTRY(o, &private_display->output_list, link) {
- tdm_private_layer *l = NULL;
- LIST_FOR_EACH_ENTRY(l, &o->layer_list, link) {
- char str[TDM_PATH_LEN];
- if (l->usable || l->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)
- continue;
- if (!l->showing_buffer)
- continue;
- snprintf(str, TDM_PATH_LEN, "layer_%d_%d", o->index, l->index);
- tdm_helper_dump_buffer_str(l->showing_buffer->buffer, path, str);
- }
- }
-
- TDM_SNPRINTF(reply, len, "path: %s\n", path);
- goto done;
- }
-
- TDM_SNPRINTF(reply, len, "dump: %s\n", arg);
-
- while (arg) {
- if (!strncmp(arg, "all", 3)) {
- tdm_debug_dump = 0xFFFFFFFF;
- goto done;
- } else if (!strncmp(arg, "layer", 5)) {
- tdm_debug_dump |= TDM_DUMP_FLAG_LAYER;
- } else if (!strncmp(arg, "pp", 2)) {
- tdm_debug_dump |= TDM_DUMP_FLAG_PP;
- } else if (!strncmp(arg, "capture", 7)) {
- tdm_debug_dump |= TDM_DUMP_FLAG_CAPTURE;
- } else if (!strncmp(arg, "window", 6)) {
- tdm_debug_dump |= TDM_DUMP_FLAG_WINDOW;
- } else
- goto done;
-
- arg = strtok_r(NULL, ",", &end);
- }
-
- if (tdm_debug_dump_dir)
- free(tdm_debug_dump_dir);
-
- tdm_debug_dump_dir = strndup(path, TDM_PATH_LEN);
-
- TDM_INFO("dump... '%s'", dump_str);
-
-done:
- if (path)
- free(path);
-
- return TDM_ERROR_NONE;