コード例 #1
0
static bool_t psf2_play(const char * filename, VFSFile * file)
{
	void *buffer;
	int64_t size;
	PSFEngine eng;
	bool_t error = FALSE;

	const char * slash = strrchr (filename, '/');
	if (! slash)
		return FALSE;

	SNCOPY (dirbuf, filename, slash + 1 - filename);
	dirpath = dirbuf;

	vfs_file_get_contents (filename, & buffer, & size);

	eng = psf_probe(buffer);
	if (eng == ENG_NONE || eng == ENG_COUNT)
	{
		free(buffer);
		return FALSE;
	}

	f = &psf_functor_map[eng];
	if (f->start(buffer, size) != AO_SUCCESS)
	{
		free(buffer);
		return FALSE;
	}

	aud_input_open_audio(FMT_S16_NE, 44100, 2);

	aud_input_set_bitrate(44100*2*2*8);

	stop_flag = FALSE;

	f->execute();
	f->stop();

	f = NULL;
	dirpath = NULL;
	free(buffer);

	return ! error;
}
コード例 #2
0
ファイル: ui_albumart.c プロジェクト: Geotto/audacious
char * get_associated_image_file (const char * filename)
{
    char * image_uri = NULL;

    char * local = uri_to_filename (filename);
    char * base = local ? last_path_element (local) : NULL;

    if (local && base)
    {
        char * include = get_str (NULL, "cover_name_include");
        char * exclude = get_str (NULL, "cover_name_exclude");

        SearchParams params = {
            .basename = base,
            .include = str_list_to_index (include, ", "),
            .exclude = str_list_to_index (exclude, ", ")
        };

        str_unref (include);
        str_unref (exclude);

        SNCOPY (path, local, base - 1 - local);

        char * image_local = fileinfo_recursive_get_image (path, & params, 0);
        if (image_local)
            image_uri = filename_to_uri (image_local);

        str_unref (image_local);

        index_free_full (params.include, (IndexFreeFunc) str_unref);
        index_free_full (params.exclude, (IndexFreeFunc) str_unref);
    }

    str_unref (local);

    return image_uri;
}
コード例 #3
0
static void receive_data (void * user, int row, const void * data, int length)
{
    SNCOPY (text, data, length);
    audgui_urilist_insert (((PlaylistWidgetData *) user)->list, row, text);
}