From: Darren S. <ds...@us...> - 2005-07-06 18:56:01
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7493/src Modified Files: stream_info.c Log Message: Add DVD track, chapter, angle counts to the stream info window. (Availability is determined at compile time.) Tidy up the gathering of other stream info a little. Index: stream_info.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/stream_info.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- stream_info.c 2 Jun 2005 22:16:54 -0000 1.17 +++ stream_info.c 6 Jul 2005 18:55:51 -0000 1.18 @@ -62,68 +62,93 @@ g_utf8_normalize (info, -1, G_NORMALIZE_DEFAULT), -1); } -void update_metadata (void) { - - char str[80]; - int channels, bits, samplerate, w, h, bps; - int ratio; - double fps; +void update_metadata (void) +{ + char str[128]; + int count, w; gtk_list_store_clear (meta_store); + /* Track/stream/file info */ + add_meta_entry (_("Title:"), XINE_META_INFO_TITLE); add_meta_entry (_("Artist:"), XINE_META_INFO_ARTIST); add_meta_entry (_("Album:"), XINE_META_INFO_ALBUM); //TEST add_meta_entry (_("Genre:"), XINE_META_INFO_GENRE); //TEST add_meta_entry (_("Comment:"), XINE_META_INFO_COMMENT); add_meta_entry (_("Date:"), XINE_META_INFO_YEAR); - add_meta_entry (_("Audio codec:"), XINE_META_INFO_AUDIOCODEC); - channels = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_CHANNELS); - bits = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_BITS); - samplerate = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE); - bps = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_BITRATE) ; - - if (channels) { - snprintf (str, 80, _("%d channels, %d bit, %3.1fkHz, %d bps"), - channels, bits, samplerate/1000.0, bps); +#ifdef XINE_STREAM_INFO_DVD_TITLE_NUMBER + count = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_TITLE_COUNT); + if (count) + { + int num = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_TITLE_NUMBER); + snprintf (str, sizeof (str), _("%d of %d"), num, count); + add_string_entry (_("DVD title:"), str); + } + count = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_CHAPTER_COUNT); + if (count) + { + int num = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER); + snprintf (str, sizeof (str), _("%d of %d"), num, count); + add_string_entry (_("Chapter:"), str); + } + count = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_ANGLE_COUNT); + if (count) + { + int num = xine_get_stream_info (stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER); + snprintf (str, sizeof (str), _("%d of %d"), num, count); + add_string_entry (_("Angle:"), str); + } +#endif + + /* Audio info */ + + add_meta_entry (_("Audio codec:"), XINE_META_INFO_AUDIOCODEC); + count = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_CHANNELS); + if (count) { + int bits = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_BITS); + int rate = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE); + int bps = xine_get_stream_info (stream, XINE_STREAM_INFO_AUDIO_BITRATE); + snprintf (str, sizeof (str), _("%d channels, %d bit, %3.1fkHz, %d bps"), + count, bits, rate / 1000.0, bps); add_string_entry (_("Audio format:"), str); } + /* Video info */ + add_meta_entry (_("Video codec:"), XINE_META_INFO_VIDEOCODEC); w = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_WIDTH); - h = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_HEIGHT); - - if (xine_get_stream_info (stream, XINE_STREAM_INFO_FRAME_DURATION) != 0.0) - fps = 90000.0 / xine_get_stream_info (stream, XINE_STREAM_INFO_FRAME_DURATION); - else - fps = 0.0; - - ratio = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_RATIO); - bps = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_BITRATE); if (w) { #ifdef XINE_STREAM_INFO_VIDEO_AFD int afd = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_AFD); #endif - const char *r = NULL; - if (ratio == 13333) - r = "4:3"; - else if (ratio == 17777) - r = "16:9"; + int h = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_HEIGHT); + int ratio = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_RATIO); + int bps = xine_get_stream_info (stream, XINE_STREAM_INFO_VIDEO_BITRATE); + const char *r; + double fps; + + if (xine_get_stream_info (stream, XINE_STREAM_INFO_FRAME_DURATION) != 0.0) + fps = 90000.0 / xine_get_stream_info (stream, XINE_STREAM_INFO_FRAME_DURATION); + else + fps = 0.0; + + r = (ratio == 13333) ? "4:3" : (ratio == 17777) ? "16:9" : NULL; #ifdef XINE_STREAM_INFO_VIDEO_AFD if (r && afd >= 0 && afd < 16) - snprintf (str, 80, _("%dx%d, %2.1f fps, %s (AFD %d), %d bps"), + snprintf (str, sizeof (str), _("%dx%d, %2.1f fps, %s (AFD %d), %d bps"), w, h, fps, r, afd, bps); else #endif if (r) - snprintf (str, 80, _("%dx%d, %2.1f fps, %s, %d bps"), + snprintf (str, sizeof (str), _("%dx%d, %2.1f fps, %s, %d bps"), w, h, fps, r, bps); else - snprintf (str, 80, _("%dx%d, %2.1f fps, %4.2f:1, %d bps"), + snprintf (str, sizeof (str), _("%dx%d, %2.1f fps, %4.2f:1, %d bps"), w, h, fps, ratio / 10000.0, bps); add_string_entry (_("Video format:"), str); |