Source

libtaginfo / bindings / vala / libtaginfo_c.vapi

Full commit
/* taginfo_c.vapi
 *
 * Copyright (C) 2012 - 2013 Jörn Magens
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; see the file LICENSE.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth 
 * Floor, Boston, MA  02110-1301  USA
 *
 * Author:
 * 	Jörn Magens <shuerhaaken@googlemail.com>
 */

[CCode (cprefix = "TagInfo_", lower_case_cprefix = "taginfo_", cheader_filename = "taginfo_c.h")]
namespace TagInfo
{
	[CCode (cname = "TagInfo_ImageType", cprefix = "TagInfo_IMAGE_TYPE_")]
	public enum ImageType
	{
		UNKNOWN,
		JPEG,
		PNG
	}
	
	[CCode (cname = "TagInfo_MediaFileType", cprefix = "MEDIA_FILE_TYPE_")]
	public enum MediaFileType
	{
		UNKNOWN,
		AAC,
		AIF,
		APE,
		ASF,
		FLAC,
		M4A,
		M4B,
		M4P,
		MP3,
		MP4,
		MPC,
		OGA,
		OGG,
		TTA,
		WAV,
		WMA,
		WV,
		SPEEX,
		WMV
	}
	
	[CCode (free_function = "taginfo_info_free")]
	[Compact]
	public class Info
	{
		public Info (string filename);
		
		//creation method using filename extension
		public static Info factory_make (string filename);
		
		//creation method for known formats/mimetypes
		public static Info factory_make_with_format (string filename, MediaFileType media_file_type);
		
		//creation method using mimetype
		public static Info factory_make_from_mime (string filename, string mimetype);
		
		public bool read ();
		
		public bool write ();
		
		public string artist {
			[CCode (cname = "taginfo_info_get_artist")]
			owned get;
			[CCode (cname = "taginfo_info_set_artist")]
			set;
		}
		public string albumartist {
			[CCode (cname = "taginfo_info_get_albumartist")]
			owned get;
			[CCode (cname = "taginfo_info_set_albumartist")]
			set;
		}
		public string album {
			[CCode (cname = "taginfo_info_get_album")]
			owned get;
			[CCode (cname = "taginfo_info_set_album")]
			set;
		}
		public string title {
			[CCode (cname = "taginfo_info_get_title")]
			owned get;
			[CCode (cname = "taginfo_info_set_title")]
			set;
		}
		public string genre {
			[CCode (cname = "taginfo_info_get_genre")]
			owned get;
			[CCode (cname = "taginfo_info_set_genre")]
			set;
		}
		public int tracknumber {
			[CCode (cname = "taginfo_info_get_tracknumber")]
			get;
			[CCode (cname = "taginfo_info_set_tracknumber")]
			set;
		}
		public int year {
			[CCode (cname = "taginfo_info_get_year")]
			get;
			[CCode (cname = "taginfo_info_set_year")]
			set;
		}
		public string comment {
			[CCode (cname = "taginfo_info_get_comment")]
			owned get;
			[CCode (cname = "taginfo_info_set_comment")]
			set;
		}
		public string composer {
			[CCode (cname = "taginfo_info_get_composer")]
			owned get;
			[CCode (cname = "taginfo_info_set_composer")]
			set;
		}
		public bool is_compilation {
			[CCode (cname = "taginfo_info_get_is_compilation")]
			get;
			[CCode (cname = "taginfo_info_set_is_compilation")]
			set;
		}
		public int rating {
			[CCode (cname = "taginfo_info_get_rating")]
			get;
			[CCode (cname = "taginfo_info_set_rating")]
			set;
		}
		public int playcount {
			[CCode (cname = "taginfo_info_get_playcount")]
			get;
			[CCode (cname = "taginfo_info_set_playcount")]
			set;
		}
		public int disk_number {
			[CCode (cname = "taginfo_info_get_disk_number")]
			owned get;
			[CCode (cname = "taginfo_info_set_disk_number")]
			set;
		}
		public int length {
			[CCode (cname = "taginfo_info_get_length")]
			get;
		}
		public int bitrate {
			[CCode (cname = "taginfo_info_get_bitrate")]
			get;
		}
		public int samplerate {
			[CCode (cname = "taginfo_info_get_samplerate")]
			get;
		}
		public int channels {
			[CCode (cname = "taginfo_info_get_channels")]
			get;
		}
		// A quick lookup sais that there is something. 
		//   But this is not guaranteed! Available after read
		//   This is much faster than actually extracting the image
		public bool has_image {
			[CCode (cname = "taginfo_info_get_has_image")]
			get;
		}
		
		// USER LABELS
		public string[] get_artist_labels ();
		public void set_artist_labels (string[] labels);
		
		public string[] get_album_labels ();
		public void set_album_labels (string[] labels);
		
		public string[] get_track_labels ();
		public void set_track_labels (string[] labels);
		
		// IMAGE ACCESS
		bool can_handle_image();
		public bool get_image (out uint8[] data, out ImageType image_type);
		public bool set_image (uint8[] data, ImageType image_type);
		
		// LYRICS ACCESS
		bool can_handle_lyrics();
		string get_lyrics();
		bool set_lyrics(string lyrics);
	}
}