- ret = ogg_sync_pageout(sync_in, &page);
- if (ret <= 0) {
- ret = -E_SYNC_PAGEOUT;
- goto err2;
- }
- ogg_stream_pagein(stream_in, &page);
- ogg_stream_packetout(stream_in, &packet);
- ogg_stream_packetin(stream_out, &packet);
+ ret = -E_STREAM_PAGEIN;
+ if (ogg_stream_pagein(&stream, &page) < 0)
+ goto out;
+
+ ret = -E_STREAM_PACKETOUT;
+ if (ogg_stream_packetout(&stream, &packet) != 1)
+ goto out;
+
+ ret = -E_VORBIS;
+ if (vorbis_synthesis_headerin(&vi, &vc, &packet) < 0)
+ goto out;
+ if (vi.rate == 0)
+ goto out;
+ afhi->channels = vi.channels;
+ afhi->frequency = vi.rate;
+ afhi->bitrate = vi.bitrate_nominal / 1000;
+ PARA_DEBUG_LOG("channels: %i, sampling rate: %i, bitrate: %i\n",
+ afhi->channels, afhi->frequency, afhi->bitrate);
+ ret = read_vorbis_comment(oss, &stream, &vi, &vc);
+ if (ret < 0)
+ goto out;
+ taginfo = make_taginfo(
+ vorbis_comment_query(&vc, "title", 0),
+ vorbis_comment_query(&vc, "artist", 0),
+ vorbis_comment_query(&vc, "album", 0),
+ vorbis_comment_query(&vc, "year", 0),
+ vorbis_comment_query(&vc, "comment", 0)
+ );
+ PARA_DEBUG_LOG("tag info: %s\n", taginfo);
+ afhi->info_string = make_message("%s:\n%s",
+ status_item_list[SI_AUDIO_FILE_INFO], taginfo);
+ free(taginfo);