[theora] Theora encoder directshow Filter configuration

Andrew Bisson Andrew.Bisson at gossinteractive.com
Tue Apr 13 01:24:09 PDT 2010


> From: theora-bounces at xiph.org [mailto:theora-bounces at xiph.org] On
Behalf Of ZEDER Mathieu BU IT&L at bs
> Sent: 09 April 2010 16:05
> To: theora at xiph.org
> Subject: [theora] Theora encoder directshow Filter configuration
> 
> Hi,
>  
> I'am using the Xiph Theora Encoder directshow Filter in a csharp
application. It works fine but I would like to modify the 
> configuration, like the quality settings. I would like to know if
there is a possibility to configure it programmatically without 
> using the propertyPage dialog.
>  
> Thanks a lot for your help
> Mathieu


Try this - no guarantees - I am not a COM interop expert but it seems to
work for me.
Also beware that some settings have side effects like setting
appropriate modes.
You need to check the filter source for the full story.

Regards,
Andy


using System.Runtime.InteropServices;

[ComVisible(true),
  ComImport,
  Guid("4F063B3A-B397-4c22-AFF4-2F8DB96D292A"),
  InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITheoraEncodeSettings
{
  /// <summary>
  /// Return true if settings may be modified
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  bool canModifySettings();

  /// <summary>
  /// Target bitrate in bps when not in quality mode
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  uint targetBitrate();

  // Target keyframe bitrate in bps when not in quality mode 
  [PreserveSig]
  uint keyFrameDataBitrate();

  /// <summary>
  /// Quality level when in quality mode
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  byte quality();

  /// <summary>
  /// Sharpness setting
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  int sharpness();

  /// <summary>
  /// Noise sensitivity setting
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  int noiseSensitivity();

  /// <summary>
  /// Max/Fixed keyframe interval
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  uint keyframeFreq();

  /// <summary>
  /// Use fixed keyframe interval flag
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  bool isFixedKeyframeInterval();

  /// <summary>
  /// Allow encoder to drop frames to ensure quality
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool allowDroppedFrames();

  /// <summary>
  /// Quality mode flag
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool isUsingQualityMode();

  /// <summary>
  /// Quick mode flag
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool isUsingQuickMode();

  /// <summary>
  /// Minimum keyframe interval when not fixed interval
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  uint keyframeFreqMin();

  /// <summary>
  /// Keyframe interval threshold when not fixed interval
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  int keyframeAutoThreshold();

  /// <summary>
  /// Set target bitrate in bps when not in quality mode
  /// </summary>
  /// <param name="inBitrate"></param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setTargetBitrate([In] uint inBitrate);

  /// <summary>
  /// Set target keyframe bitrate in bps when not in quality mode
  /// </summary>
  /// <param name="inBitrate"></param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setKeyframeDataBitrate([In] uint inBitrate);

  /// <summary>
  /// Quality level - enabled by setIsUsingQualityMode(true)
  /// </summary>
  /// <param name="inQuality">quality 0-63</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setQuality([In] byte inQuality);

  /// <summary>
  /// Set image sharpness
  /// 0 = Sharpest (default)
  /// 1 = Sharper
  /// 2 = Sharp (fastest)
  /// </summary>
  /// <param name="inSharpness">sharpness 0-2</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setSharpness([In] int inSharpness);

  /// <summary>
  /// Set noise sensitivity
  /// 0 = Most sensitive
  /// 1 = Theora default
  /// 2 = VP3 default
  /// 4 = 
  /// 5 =
  /// 6 = Least sensitive
  /// </summary>
  /// <param name="inNoiseSensitivity"></param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setNoiseSensitivity([In] int inNoiseSensitivity);

  /// <summary>
  /// Set keyframe interval 1-8192
  /// Sets fixed interval when isFixedKeyframeInterval is true
  /// Sets maximum interval otherwise 
  /// </summary>
  /// <param name="inKeyframeFreq"></param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setKeyframeFreq([In] uint inKeyframeFreq);

  /// <summary>
  /// If set true then use a fixed keyframe interval determined by
setKeyframeFreq
  /// </summary>
  /// <param name="inIsFixedKeyframeInterval">true for fixed keyframe
interval</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setIsFixedKeyframeInterval([In, MarshalAs(UnmanagedType.U1)] bool
inIsFixedKeyframeInterval);

  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setAllowDroppedFrames([In, MarshalAs(UnmanagedType.U1)] bool
inAllowDroppedFrames);

  /// <summary>
  /// Set quality mode if true
  /// </summary>
  /// <param name="inIsUsingQualityMode">quality mode flag</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setIsUsingQualityMode([In, MarshalAs(UnmanagedType.U1)] bool
inIsUsingQualityMode);

  /// <summary>
  /// Set quick mode if true
  /// </summary>
  /// <param name="inIsUsingQuickMode">quick mode if true</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setIsUsingQuickMode([In, MarshalAs(UnmanagedType.U1)] bool
inIsUsingQuickMode);

  /// <summary>
  /// Sets the minimum keyframe interval when isFixedKeyframeInterval is
true
  /// values from 1-KeyframeFreq
  /// </summary>
  /// <param name="inKeyframeFreqMin">keyframe interval 1-8192</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setKeyframeFreqMin([In] uint inKeyframeFreqMin);

  /// <summary>
  /// Set keyframe auto threshold 0-100
  /// </summary>
  /// <param name="inKeyframeAutoThreshold">threshold 0-100</param>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool setKeyframeAutoThreshold([In] int inKeyframeAutoThreshold);

  /// <summary>
  /// Flip image lines (because some filtergraphs may invert them)
  /// </summary>
  /// <param name="flipImageVerticaly"></param>
  [PreserveSig]
  void setFlipImageVerticaly([In, MarshalAs(UnmanagedType.U1)] bool
flipImageVerticaly);

  /// <summary>
  /// True if flip mode active
  /// </summary>
  /// <returns></returns>
  [PreserveSig]
  [return: MarshalAs(UnmanagedType.U1)]
  bool getFlipImageVerticaly();
}



Free Developer Webinar for clients on 19th May, more information on our client extranet: http://www.gossinteractive.com/devugmay2010 

Web design and Content Management experts. www.twitter.com/gossinteractive 

Registered Office: c/o Bishop Fleming, Cobourg House, Mayflower Street, Plymouth, PL1 1LG.  Company Registration No: 3553908 

This email contains proprietary information, some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this email, please notify the author by replying to this email. If you are not the intended recipient you may not use, disclose, distribute, copy, print or rely on this email. 

Email transmission cannot be guaranteed to be secure or error free, as information may be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. This email and any files attached to it have been checked with virus detection software before transmission. You should nonetheless carry out your own virus check before opening any attachment. GOSS Interactive Ltd accepts no liability for any loss or damage that may be caused by software viruses.





More information about the theora mailing list