Exemplo n.º 1
0
        private IntPtr Create(
            string filePath, VideoTrackAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
        {
            VideoTrackEncoderAttributes videoEncoderAttrs = new VideoTrackEncoderAttributes(videoAttrs);

            return(Create(filePath, videoEncoderAttrs, audioAttrs));
        }
Exemplo n.º 2
0
        private void ValidateVideoAttributes(VideoTrackEncoderAttributes videoAttrs)
        {
            var rate = videoAttrs.frameRate;

            if (rate.isNegative)
            {
                throw new ArgumentException($"Negative frame rate not supported: {rate.numerator}/{rate.denominator}");
            }
        }
Exemplo n.º 3
0
        private IntPtr Create(
            string filePath, VideoTrackEncoderAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
        {
            ValidateVideoAttributes(videoAttrs);
            ValidateAudioAttributes(audioAttrs);

            unsafe
            {
                IntPtr ptr           = IntPtr.Zero;
                void * videoAttrsPtr = &videoAttrs;
                ptr = Internal_Create(filePath, videoAttrsPtr, audioAttrs);
                if (ptr == IntPtr.Zero)
                {
                    throw new InvalidOperationException(
                              "MediaEncoder: Output file creation failed for " + filePath);
                }
                return(ptr);
            }
        }
Exemplo n.º 4
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs)
     : this(filePath, videoAttrs, new AudioTrackAttributes[0])
 {
 }
Exemplo n.º 5
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs, AudioTrackAttributes audioAttrs)
     : this(filePath, videoAttrs, new[] { audioAttrs })
 {
 }
Exemplo n.º 6
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
 {
     m_ThisPtr = Create(filePath, videoAttrs, audioAttrs);
 }