Esempio n. 1
0
static void *aac_open (const char *file)
{
	struct aac_data *data;

	data = aac_open_internal (NULL, file);

	if (data->ok) {
		int duration = -1;
		int avg_bitrate = -1;
		off_t file_size;

		duration = aac_count_time (data);
		file_size = io_file_size (data->stream);
		if (duration > 0 && file_size != -1)
			avg_bitrate = file_size / duration * 8;
		aac_close (data);
		data = aac_open_internal (NULL, file);
		data->duration = duration;
		data->avg_bitrate = avg_bitrate;
	}

	return data;
}
Esempio n. 2
0
/* Fill info structure with data from aac comments */
static void aac_info (const char *file_name,
		struct file_tags *info,
		const int tags_sel)
{
	if (tags_sel & TAGS_COMMENTS) {
		struct id3_tag *tag;
		struct id3_file *id3file;
		char *track = NULL;

		id3file = id3_file_open (file_name, ID3_FILE_MODE_READONLY);
		if (!id3file)
			return;
		tag = id3_file_tag (id3file);
		if (tag) {
			info->artist = get_tag (tag, ID3_FRAME_ARTIST);
			info->title = get_tag (tag, ID3_FRAME_TITLE);
			info->album = get_tag (tag, ID3_FRAME_ALBUM);
			track = get_tag (tag, ID3_FRAME_TRACK);

			if (track) {
				char *end;

				info->track = strtol (track, &end, 10);
				if (end == track)
					info->track = -1;
				free (track);
			}
		}
		id3_file_close (id3file);
	}

	if (tags_sel & TAGS_TIME) {
		struct aac_data *data;

		data = aac_open_internal (NULL, file_name);

		if (data->ok)
			info->time = aac_count_time (data);
		else
			logit ("%s", decoder_error_text (&data->error));

		aac_close (data);
	}
}
Esempio n. 3
0
static void *aac_open_stream (struct io_stream *stream)
{
	assert (stream != NULL);

	return aac_open_internal (stream, NULL);
}
Esempio n. 4
0
File: aac.c Progetto: gitkaste/moc
static void *aac_open (const char *file)
{
	return aac_open_internal (NULL, file);
}