comparison src/vorbis/vorbis.c @ 2212:a13b8f308dce

vorbis: mimetype field added. also little fix
author Eugene Zagidullin <e.asphyx@gmail.com>
date Thu, 06 Dec 2007 04:39:14 +0300
parents 2a13a038987c
children 7b38e28464ee
comparison
equal deleted inserted replaced
2211:2a13a038987c 2212:a13b8f308dce
618 get_aud_tuple_for_vorbisfile(OggVorbis_File * vorbisfile, gchar *filename) 618 get_aud_tuple_for_vorbisfile(OggVorbis_File * vorbisfile, gchar *filename)
619 { 619 {
620 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; 620 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource;
621 Tuple *tuple = NULL; 621 Tuple *tuple = NULL;
622 gint length; 622 gint length;
623 vorbis_comment *comment; 623 vorbis_comment *comment = NULL;
624 624
625 tuple = aud_tuple_new_from_filename(filename); 625 tuple = aud_tuple_new_from_filename(filename);
626 626
627 if (aud_vfs_is_streaming(vfd->fd)) 627 if (aud_vfs_is_streaming(vfd->fd))
628 length = -1; 628 length = -1;
643 _aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, vorbis_comment_query(comment, "genre", 0)); 643 _aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, vorbis_comment_query(comment, "genre", 0));
644 _aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, vorbis_comment_query(comment, "comment", 0)); 644 _aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, vorbis_comment_query(comment, "comment", 0));
645 645
646 if ((tmps = vorbis_comment_query(comment, "tracknumber", 0)) != NULL) 646 if ((tmps = vorbis_comment_query(comment, "tracknumber", 0)) != NULL)
647 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(tmps)); 647 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(tmps));
648 648 }
649 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); 649
650 650 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy");
651 if (comment && comment->vendor) 651
652 { 652 if (comment && comment->vendor)
653 gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor); 653 {
654 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec); 654 gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor);
655 g_free(codec); 655 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec);
656 } 656 g_free(codec);
657 else 657 }
658 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis"); 658 else
659 } 659 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis");
660
661 aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "application/ogg");
660 662
661 return tuple; 663 return tuple;
662 } 664 }
663 665
664 static Tuple * 666 static Tuple *