Ejemplo n.º 1
0
        public ErrorCode init(AVProperty prop, IMediaInfo input, out IMediaInfo output)
        {
            output = null;
            if (input == null)
            {
                return ErrorCode.NullReference;
            }
            if (input.stremType() != StreamType.Audio)
            {
                return ErrorCode.InvalidStream;
            }

            if (input.mediaType() == MediaType.WAVE_LPCM)
            {
                lpcm_ = true;
            }
            else if (input.mediaType() == MediaType.WAVE_PCM)
            {
                lpcm_ = false;
            }
            else
            {
                return ErrorCode.InvalidStream;
            }

            output = new WaveInfo(input.getAudioInfo(), input.getDuration());
            return ErrorCode.Success;
        }
Ejemplo n.º 2
0
        public static ErrorCode create(IMediaInfo info, out IFilter decoder)
        {
            decoder = null;

            if (info == null)
            {
                return ErrorCode.NullReference;
            }

            if (info.stremType() == StreamType.Audio)
            {
                switch (info.mediaType())
                {
                    case MediaType.WAVE_LPCM:
                    case MediaType.WAVE_PCM:
                    {
                        decoder = new PCMDecoder();
                        return ErrorCode.Success;
                    }
                    case MediaType.MPEG10:
                    {
                        decoder = new M1L2Decoder();
                        return ErrorCode.Success;
                    }
                }
            }
            return ErrorCode.Unsupported;
        }
Ejemplo n.º 3
0
        public ErrorCode init(AVProperty prop, IMediaInfo input)
        {
            if (input == null)
            {
                return ErrorCode.NullReference;
            }

            StreamType st = input.stremType();
            if (st != StreamType.Audio)
            {
                return ErrorCode.InvalidStream;
            }

            MediaType mt = input.mediaType();
            if (mt != MediaType.WAVE_PCM)
            {
                return ErrorCode.InvalidStream;
            }

            AudioInfo ai = input.getAudioInfo();

            wfx_.cbSize = 0;
            wfx_.nChannels = ai.channels;
            wfx_.wBitsPerSample = ai.bitsPerSample;
            wfx_.nBlockAlign = (UInt16)(ai.channels * ai.bitsPerSample / 8);
            wfx_.wFormatTag = 1;
            wfx_.nSamplesPerSec = ai.sampleRate;
            wfx_.nAvgBytesPerSec = wfx_.nBlockAlign * wfx_.nSamplesPerSec;

            return ErrorCode.Success;
        }
Ejemplo n.º 4
0
        public static ErrorCode create(IMediaInfo info, out IRenderer renderer)
        {
            renderer = null;

            if (info == null)
            {
                return ErrorCode.NullReference;
            }

            if (info.stremType() == StreamType.Audio)
            {
                switch (info.mediaType())
                {
                    case MediaType.WAVE_PCM:
                        {
                            renderer = new AudioRenderer();
                            return ErrorCode.Success;
                        }
                }
            }
            return ErrorCode.Unsupported;
        }
Ejemplo n.º 5
0
        public ErrorCode init(AVProperty prop, IMediaInfo input, out IMediaInfo output)
        {
            output = null;
            if (input == null)
            {
                return ErrorCode.NullReference;
            }
            if (input.stremType() != StreamType.Audio)
            {
                return ErrorCode.InvalidStream;
            }

            if (input.mediaType() != MediaType.MPEG10)
            {
                return ErrorCode.InvalidStream;
            }

            output = new WaveInfo(input.getAudioInfo(), input.getDuration());
            return ErrorCode.Success;
        }