Ejemplo n.º 1
0
            public void Open(MergingMethod stMergingMethod, ffmpeg.net.File.Input.PlaybackMode ePlaybackMode)
            {
                // TODO  нужно выцеплять размеры кадра из видео.
                _bClosed = false;
                if (null == _cFile)
                {
                    _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart);
                }
                (new Logger()).WriteDebug("[video_file open " + GetHashCode() + "][ffmpeg_file " + _cFile.GetHashCode() + "]");
                //Area stDeviceArea = Baetylus.Helper.stCurrentBTLArea;
                _cFormatVideo = new ffmpeg.net.Format.Video(stArea.nWidth, stArea.nHeight, ffmpeg.net.PixelFormat.AV_PIX_FMT_BGRA, ffmpeg.net.AVFieldOrder.AV_FIELD_TT);

                short  nTop = stArea.nTop;
                ushort nHei = stArea.nHeight;

                if (stArea.nTop < 0)                 // если верх выше границы, то не будем копировать лишние строки в пиксельсмэп
                {
                    nTop = 0;
                }
                if (nTop < stContainerArea.nHeight && stArea.nHeight + stArea.nTop > stContainerArea.nHeight)                 // если низ ниже, то не будем копировать лишние строки в пиксельсмэп
                {
                    nHei = (ushort)(stContainerArea.nHeight - (ushort)nTop);
                }

                stPixelArea = new Area(stArea.nLeft, nTop, stArea.nWidth, nHei);

                _cPMDuo = new PixelsMap.Triple(stMergingMethod, stPixelArea, PixelsMap.Format.BGRA32, true, Baetylus.PixelsMapDispose);
                ffmpeg.net.AVSampleFormat eAVSampleFormat;
                switch (Preferences.nAudioBitDepth)
                {
                case 32:
                    eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32;
                    break;

                case 16:
                default:
                    eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16;
                    break;
                }
                int nAudioChannelsQty = Preferences.nAudioChannelsQtyFfmpeg;

                _cFormatAudio = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat);
                nFramesTotal  = _cFile.nFramesQty;
                //_cFile.Prepare(nDuration);
                _cFile.Prepare(_cFormatVideo, _cFormatAudio, ePlaybackMode);
            }
Ejemplo n.º 2
0
            public void Open(ffmpeg.net.File.Input.PlaybackMode ePlaybackMode)
            {
                _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart);
                ffmpeg.net.AVSampleFormat eAVSampleFormat;
                switch (Preferences.nAudioBitDepth)
                {
                case 32:
                    eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32;
                    break;

                case 16:
                default:
                    eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16;
                    break;
                }
                int nAudioChannelsQty = Preferences.nAudioChannelsQtyFfmpeg;

                _cFormat     = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat);
                nFramesTotal = _cFile.nFramesQty;
                //_cFile.Prepare(nDuration);
                _cFile.Prepare(null, _cFormat, ePlaybackMode);
            }
Ejemplo n.º 3
0
            public void Open(bool bCUDA)
            {
				// TODO  нужно выцепл¤ть размеры кадра из видео.
				_bClosed = false;
                if (null == _cFile)
				{
					_cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart);
				}
				(new Logger()).WriteDebug("[video_file " + GetHashCode() + "][ffmpeg_file " + _cFile.GetHashCode() + "]");
				Area stDeviceArea = Baetylus.Helper.cBoard.stArea;
                _cFormatVideo = new ffmpeg.net.Format.Video(stArea.nWidth, stArea.nHeight, ffmpeg.net.PixelFormat.AV_PIX_FMT_BGRA);

				_cPixelsMap = new PixelsMap(bCUDA, stArea, PixelsMap.Format.BGRA32);
                _cPixelsMap.bBackgroundClear = true;
                _cPixelsMap.bKeepAlive = true;
				ffmpeg.net.AVSampleFormat eAVSampleFormat;
				switch (Preferences.nAudioBitDepth)
				{
					case 32:
                        eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32;
						break;
					case 16:
					default:
                        eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16;
						break;
				}
				int nAudioChannelsQty = Preferences.nAudioChannelsQty;
				switch (Preferences.nAudioChannelsQty)
				{
					case 8:
						nAudioChannelsQty = 2;
						break;
				}
				_cFormatAudio = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat);
                nFramesTotal = _cFile.nFramesQty;
				//_cFile.Prepare(nDuration);
                _cFile.Prepare(_cFormatVideo, _cFormatAudio);
            }
Ejemplo n.º 4
0
			public void Open()
			{
				_cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart);
				ffmpeg.net.AVSampleFormat eAVSampleFormat;
				switch (Preferences.nAudioBitDepth)
				{
					case 32:
                        eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32;
						break;
					case 16:
					default:
                        eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16;
						break;
				}
				int nAudioChannelsQty = Preferences.nAudioChannelsQty;
				switch (Preferences.nAudioChannelsQty)
				{
					case 8:
						nAudioChannelsQty = 2;
						break;
				}
				_cFormat = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat);
				nFramesTotal = _cFile.nFramesQty;
				//_cFile.Prepare(nDuration);
				_cFile.Prepare(null, _cFormat);
			}