Exemplo n.º 1
0
        void getVideoProperties(ObservableCollection <Tuple <String, String> > p, VideoMetadata video)
        {
            p.Add(new Tuple <string, string>("", "VIDEO"));
            p.Add(new Tuple <string, string>("Video Codec", video.VideoCodec));

            foreach (Tuple <string, string> item in FormatMetaData.formatProperties(video))
            {
                p.Add(item);
            }

            p.Add(new Tuple <string, string>("Resolution", video.Width.ToString() + " x " + video.Height.ToString()));
            p.Add(new Tuple <string, string>("Pixel Format", video.PixelFormat));
            p.Add(new Tuple <string, string>("Bits Per Pixel", video.BitsPerPixel.ToString()));
            p.Add(new Tuple <string, string>("Frames Per Second", video.FramesPerSecond.ToString("0.##")));

            if (video.VideoBitRate.HasValue)
            {
                p.Add(new Tuple <string, string>("Video Rate", MiscUtils.formatSizeBytes(video.VideoBitRate.Value / 8) + "/s"));
            }

            if (!String.IsNullOrEmpty(video.AudioCodec))
            {
                p.Add(new Tuple <string, string>("", "AUDIO"));
                p.Add(new Tuple <string, string>("Audio Codec", video.AudioCodec));
                p.Add(new Tuple <string, string>("Bits Per Sample", video.BitsPerSample.ToString()));
                p.Add(new Tuple <string, string>("Samples Per Second", video.SamplesPerSecond.ToString()));
                p.Add(new Tuple <string, string>("Nr Channels", video.NrChannels.ToString()));

                if (video.AudioBitRate.HasValue)
                {
                    p.Add(new Tuple <string, string>("Audio Rate", MiscUtils.formatSizeBytes(video.AudioBitRate.Value / 8) + "/s"));
                }
            }

            p.Add(new Tuple <string, string>("", "FILE"));
            p.Add(new Tuple <string, string>("Container", video.VideoContainer));
            p.Add(new Tuple <string, string>("Duration", MiscUtils.formatTimeSeconds(video.DurationSeconds)));
        }
Exemplo n.º 2
0
        private void getExifProperties(ObservableCollection <Tuple <string, string> > p, BaseMetadata media)
        {
            p.Add(new Tuple <string, string>("Size", MediaViewer.Model.Utils.MiscUtils.formatSizeBytes(media.SizeBytes)));

            if (media.FileDate != null)
            {
                p.Add(new Tuple <string, string>("File Date", media.FileDate.ToString()));
            }

            if (media.LastModifiedDate != null)
            {
                p.Add(new Tuple <string, string>("File Modified", media.LastModifiedDate.ToString()));
            }

            int nrProps = p.Count;

            if (media.Software != null)
            {
                p.Add(new Tuple <string, string>("Software", media.Software));
            }
            if (media.MetadataDate != null)
            {
                p.Add(new Tuple <string, string>("Metadata Date", media.MetadataDate.ToString()));
            }
            if (media.MetadataModifiedDate != null)
            {
                p.Add(new Tuple <string, string>("Metadata Modified", media.MetadataModifiedDate.ToString()));
            }

            if (media is ImageMetadata)
            {
                foreach (Tuple <string, string> item in FormatMetaData.formatProperties(media as ImageMetadata))
                {
                    p.Add(item);
                }
            }
            else if (media is AudioMetadata)
            {
                AudioMetadata audio = media as AudioMetadata;

                if (audio.Genre != null)
                {
                    p.Add(new Tuple <string, string>("Genre", audio.Genre));
                }

                if (audio.Album != null)
                {
                    p.Add(new Tuple <string, string>("Album", audio.Album));
                }

                if (audio.TrackNr != null)
                {
                    String value = audio.TrackNr.ToString();

                    if (audio.TotalTracks != null)
                    {
                        value += " / " + audio.TotalTracks;
                    }

                    p.Add(new Tuple <string, string>("Track", value));
                }

                if (audio.DiscNr != null)
                {
                    String value = audio.DiscNr.ToString();

                    if (audio.TotalDiscs != null)
                    {
                        value += " / " + audio.TotalDiscs;
                    }

                    p.Add(new Tuple <string, string>("Disc", value));
                }
            }


            if (media.Latitude != null)
            {
                p.Add(new Tuple <string, string>("GPS Latitude", media.Latitude.Value.ToString("0.00000")));
            }

            if (media.Longitude != null)
            {
                p.Add(new Tuple <string, string>("GPS Longitude", media.Longitude.Value.ToString("0.00000")));
            }

            if (p.Count > nrProps)
            {
                p.Insert(nrProps, new Tuple <string, string>("", "EXIF"));
            }
        }