EncodingProfile.vala 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. namespace Publicate.Video {
  2. public abstract class EncodingProfile {
  3. public string size { get; protected set; }
  4. public string codec_names { get; protected set; }
  5. public double fps { get; protected set; }
  6. public EncodingProfile? alternative_to { get; set; }
  7. protected double get_low_framerate(double input_framerate) {
  8. if(input_framerate >= 50) {
  9. return input_framerate / 2;
  10. }
  11. return input_framerate;
  12. }
  13. public abstract string[] get_first_pass_command(string input_path, string output_path);
  14. public abstract string[] get_second_pass_command(string input_path, string output_path);
  15. public abstract string output_name();
  16. public abstract string version_label();
  17. public abstract bool suitable_for(VideoInfo info);
  18. public abstract void setup_for(VideoInfo info);
  19. }
  20. public static Invercargill.Enumerable<EncodingProfile> construct_free_profiles() {
  21. return Invercargill.ate(new EncodingProfile[] {
  22. new Vp9Video1080pHighFramerateProfile (),
  23. new Vp9Video1080pLowFramerateProfile (),
  24. new Vp9Video720pProfile(),
  25. new Vp9Video480pProfile(),
  26. new TheoraVideo360pProfile(),
  27. new TheoraVideo240pProfile(),
  28. });
  29. }
  30. public static Invercargill.Enumerable<EncodingProfile> construct_all_profiles() {
  31. var vp9_720 = new Vp9Video720pProfile();
  32. var vp9_480 = new Vp9Video480pProfile();
  33. var avc_720 = new H264Video720pProfile() {alternative_to = vp9_720};
  34. var avc_480 = new H264Video480pProfile() {alternative_to = vp9_480};
  35. return Invercargill.ate(new EncodingProfile[] {
  36. new Vp9Video1080pHighFramerateProfile (),
  37. new Vp9Video1080pLowFramerateProfile (),
  38. vp9_720,
  39. avc_720,
  40. vp9_480,
  41. avc_480,
  42. new TheoraVideo360pProfile(),
  43. new TheoraVideo240pProfile(),
  44. });
  45. }
  46. }