private static bool IsTemplateValid(int projectAudioChannelCount, bool projectHasVideo, bool projectHasAudio, RenderTemplate template)
 {
     // filter out invalid templates
     if (!template.IsValid())
     {
         return(false);
     }
     // filter out video templates when project has
     // no video.
     if (!projectHasVideo && (0 < template.VideoStreamCount))
     {
         return(false);
     }
     // filter out audio-only templates when project has no audio
     if (!projectHasAudio && (0 == template.VideoStreamCount) && (0 < template.AudioStreamCount))
     {
         return(false);
     }
     // filter out templates that have more channels than the project
     if (projectAudioChannelCount < template.AudioChannelCount)
     {
         return(false);
     }
     // filter out templates that don't have
     // exactly one file extension
     String[] extensions = template.FileExtensions;
     if (1 != extensions.Length)
     {
         return(false);
     }
     return(true);
 }
Example #2
0
    /**
     * Get render template from project
     * */
    public bool GetRenderTemplate(String rendererName)
    {
        Renderer render = myVegas.Renderers.FindByName(rendererName);

        render.Templates.Refresh();
        RenderTemplate[] tmpRenderTemplate = render.Templates.FindProjectMatches(myVegas.Project);
        this.renderTemplate = tmpRenderTemplate[0];

        if (!renderTemplate.IsValid())
        {
            throw new ApplicationException("Project didnt have a valid render template");
        }
        return(true);
    }
 private static bool IsTemplateValid(int projectAudioChannelCount, bool projectHasVideo, bool projectHasAudio, RenderTemplate template)
 {
     // filter out invalid templates
     if (!template.IsValid())
     {
         return false;
     }
     // filter out video templates when project has
     // no video.
     if (!projectHasVideo && (0 < template.VideoStreamCount))
     {
         return false;
     }
     // filter out audio-only templates when project has no audio
     if (!projectHasAudio && (0 == template.VideoStreamCount) && (0 < template.AudioStreamCount))
     {
         return false;
     }
     // filter out templates that have more channels than the project
     if (projectAudioChannelCount < template.AudioChannelCount)
     {
         return false;
     }
     // filter out templates that don't have
     // exactly one file extension
     String[] extensions = template.FileExtensions;
     if (1 != extensions.Length)
     {
         return false;
     }
     return true;
 }