コード例 #1
0
        /// <summary>
        /// Add a <see cref="System.Drawing.Bitmap"/> thumbnail.
        /// </summary>
        /// <param name="thumbnail">The <see cref="System.Drawing.Bitmap"/> 
        /// thumbnail.</param>
        /// <param name="time">The <see cref="TimeSpan">time</see> the thumbnail was
        /// captured.</param>
        /// <param name="highlight">if set to <c>true</c> highlight thumbnail border.</param>
        /// <param name="fileNum">The file number
        /// (>0 for multi-file <see cref="AVFileSet"/>s).</param>
        public void Add(System.Drawing.Bitmap thumbnail, TimeSpan time, bool highlight, int fileNum)
        {
            if (_thumbnailPage == null)
                _thumbnailPage = CreateThumbnailPage (time);

            _thumbnailPage.Add (thumbnail, time, fileNum, TimeSpan.Zero, highlight);

            int percentage = _creator.CalcDurationPercentage (time);
            if (_creator.BGWorker == null)
                {
                Console.Write("\b\b\b\b\b\b");
                Console.Write (String.Format("{0} {1,3}%", THelper.GetNextProgressStr (), percentage));
                }
            else
                {
                _creator.BGWorker.ReportProgress (percentage);
                }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ThumbnailWriter"/> class.
        /// </summary>
        /// <param name="creator">The <see cref="ThumbnailCreator"/>
        /// (only used to get a jpeg compression encoder).</param>
        /// <param name="tgrid">The <see cref="ThumbnailGrid"/>.</param>
        /// <param name="directory">The directory to write the thumbnail page.</param>
        /// <param name="displayFilename">The display name of the <see cref="AVFileSet"/>
        /// from which the thumbnails are generated.</param>
        /// <param name="outTemplate">The template used to generate page filename.</param>
        /// <param name="nFiles">The number of files in set (>0 for multi-part videos).</param>
        /// <param name="stats">The stats of the <see cref="AVFileSet"/> to display 
        /// in header.</param>
        /// <param name="duration">The duration of the <see cref="AVFileSet"/>.</param>
        public ThumbnailWriter(ThumbnailCreator creator,
            ThumbnailGrid tgrid,
            string directory,
            string displayFilename,
            string outTemplate,
            int nFiles,
            string stats,
            TimeSpan duration)
        {
            this._creator = creator;
            this._tgrid = tgrid;
            this._directory = directory;
            this._displayFilename = displayFilename;
            this._outTemplate = outTemplate;
            this._nFiles = nFiles;
            this._stats = stats;
            this._duration = duration;

            _thumbnailPage = null;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ThumbnailMultiWriter"/> class.
        /// </summary>
        /// <param name="creator">The <see cref="ThumbnailCreator"/>
        /// (only used to get a jpeg compression encoder).</param>
        /// <param name="tgrid">The <see cref="ThumbnailGrid"/>.</param>
        /// <param name="directory">The directory to write thumbnail pages.</param>
        /// <param name="displayFilename">The display name of the <see cref="AVFileSet"/>
        /// from which the thumbnails are generated.</param>
        /// <param name="outTemplate">The template used to generate page filenames.</param>
        /// <param name="nFiles">The number of files in set (>0 for multi-part videos).</param>
        /// <param name="interval">The interval between thumbnails.</param>
        /// <param name="stats">The stats of the <see cref="AVFileSet"/> to display
        /// in header.</param>
        /// <param name="duration">The duration of the <see cref="AVFileSet"/>.</param>
        /// <param name="nPages">The total number of thumbnail pages.</param>
        public ThumbnailMultiWriter(ThumbnailCreator creator,
            ThumbnailGrid tgrid,
            string directory,
            string displayFilename,
            string outTemplate,
            int nFiles,
            TimeSpan interval,
            string stats, TimeSpan duration, int nPages)
        {
            this._creator = creator;
            this._tgrid = tgrid;
            this._directory = directory;
            this._displayFilename = displayFilename;
            this._outTemplate = outTemplate;
            this._nFiles = nFiles;
            this._interval = interval;
            this._stats = stats;
            this._duration = duration;
            this._nPages = nPages;

            this._pageNum = 1;
            _thumbnailPage = null;
        }
コード例 #4
0
        /// <summary>
        /// Closes this instance.
        /// </summary>
        public void Close()
        {
            if (_thumbnailPage != null)
                {
                _thumbnailPage.Close ();
                _thumbnailPage = null;
                }

            if (_creator.BGWorker == null)
                {
                Console.Write("\b\b\b\b\b\b      \b\b\b\b\b\b");
                //Console.WriteLine ("");
                }
        }
コード例 #5
0
        /// <summary>
        /// Creates an overview thumbnail page.
        /// </summary>
        /// <param name="time">The <see cref="TimeSpan">time</see> of the first thumbnail 
        /// on page.</param>
        /// <returns>new <see cref="ThumbnailPage"/>.</returns>
        private ThumbnailPage CreateThumbnailPage(TimeSpan time)
        {
            string filename = _outTemplate;
            filename = System.IO.Path.Combine (_directory, filename);

            ThumbnailPage page = new ThumbnailPage (_creator, _tgrid,
                                                    _displayFilename, filename, _nFiles,
                                                    time,
                                                    -1,
                                                    _duration, 1,
                                                    _stats);
            return page;
        }
コード例 #6
0
        /// <summary>
        /// Creates a multi-page thumbnail page.
        /// </summary>
        /// <param name="time">The <see cref="TimeSpan">time</see> of the first thumbnail 
        /// on page.</param>
        /// <returns>new <see cref="ThumbnailPage"/>.</returns>
        private ThumbnailPage CreateThumbnailPage(TimeSpan time)
        {
            string filename = String.Format (_outTemplate, _pageNum);
            if (_creator.TNSettings.DetailFileTimestamps)
                {
                string ext = System.IO.Path.GetExtension (filename);
                filename = System.IO.Path.GetFileNameWithoutExtension (filename);
                filename += String.Format (@"{0:\_hh\_mm\_ss}{1}", time, ext);
                }
            filename = System.IO.Path.Combine (_directory, filename);

            ThumbnailPage page = new ThumbnailPage (_creator, _tgrid,
                                                    _displayFilename, filename, _nFiles,
                                                    time,
                                                    _pageNum,
                                                    _duration, _nPages,
                                                    _stats);
            return page;
        }