summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/edje/edje_edit.c')
-rw-r--r--src/lib/edje/edje_edit.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 82f69ab..f51e229 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -1455,6 +1455,53 @@ edje_edit_sound_compression_type_set(Evas_Object *obj, const char *sound, Edje_E
1455 return EINA_TRUE; 1455 return EINA_TRUE;
1456} 1456}
1457 1457
1458EAPI Eina_Binbuf *
1459edje_edit_sound_samplebuffer_get(Evas_Object *obj, const char *sample_name)
1460{
1461 Eet_File *ef;
1462 Edje_Sound_Sample *sample;
1463 char snd_id_str[PATH_MAX];
1464 int i, len;
1465 const void *data;
1466
1467 if (!sample_name)
1468 {
1469 ERR("Given Sample Name is NULL\n");
1470 return NULL;
1471 }
1472
1473 GET_ED_OR_RETURN(NULL);
1474
1475 if ((!ed) || (!ed->file) || (!ed->file->sound_dir))
1476 return NULL;
1477
1478 for(i = 0; i < (int)ed->file->sound_dir->samples_count; i++)
1479 {
1480 sample = &ed->file->sound_dir->samples[i];
1481 if (!strcmp(sample->name, sample_name))
1482 {
1483 ef = eet_mmap(ed->file->f);
1484 if (!ef)
1485 {
1486 ERR("Cannot open edje file '%s' for samples", ed->path);
1487 return NULL;
1488 }
1489 snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id);
1490 data = eet_read_direct(ef, snd_id_str, &len);
1491 if (len <= 0)
1492 {
1493 ERR("Sample from edj file '%s' has 0 length", ed->path);
1494 eet_close(ef);
1495 return NULL;
1496 }
1497 eet_close(ef);
1498 return eina_binbuf_manage_read_only_new_length(data, len);
1499 }
1500 }
1501 return NULL;
1502}
1503
1504
1458/****************/ 1505/****************/
1459/* GROUPS API */ 1506/* GROUPS API */
1460/****************/ 1507/****************/