Example #1
0
        private IntPtr Create(
            string filePath, VideoTrackAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
        {
            VideoTrackEncoderAttributes videoEncoderAttrs = new VideoTrackEncoderAttributes(videoAttrs);

            return(Create(filePath, videoEncoderAttrs, audioAttrs));
        }
Example #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}");
            }
        }
Example #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);
            }
        }
Example #4
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs)
     : this(filePath, videoAttrs, new AudioTrackAttributes[0])
 {
 }
Example #5
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs, AudioTrackAttributes audioAttrs)
     : this(filePath, videoAttrs, new[] { audioAttrs })
 {
 }
Example #6
0
 public MediaEncoder(
     string filePath, VideoTrackEncoderAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
 {
     m_ThisPtr = Create(filePath, videoAttrs, audioAttrs);
 }