[longomatch/redesign3] Add Extension field to EncodingProfile
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign3] Add Extension field to EncodingProfile
- Date: Thu, 18 Aug 2011 18:47:55 +0000 (UTC)
commit 74f5c9e57eaa525a082a79f3724a1ebcc5c13f68
Author: Andoni Morales Alastruey <amorales flumotion com>
Date: Thu Aug 18 12:37:42 2011 +0200
Add Extension field to EncodingProfile
CesarPlayer/CesarPlayer.mdp | 5 +-
CesarPlayer/Common/EncodingProfiles.cs | 34 +++--
CesarPlayer/Common/Enum.cs | 8 -
CesarPlayer/Editor/GstVideoSplitter.cs | 56 ++------
CesarPlayer/Editor/IVideoEditor.cs | 29 +----
LongoMatch/Gui/Component/PlayListWidget.cs | 10 +-
LongoMatch/Gui/Component/ProjectDetailsWidget.cs | 4 +
LongoMatch/Gui/Dialog/VideoEditionProperties.cs | 147 ++++++++------------
...LongoMatch.Gui.Dialog.VideoEditionProperties.cs | 10 +-
LongoMatch/gtk-gui/gui.stetic | 9 +-
10 files changed, 105 insertions(+), 207 deletions(-)
---
diff --git a/CesarPlayer/CesarPlayer.mdp b/CesarPlayer/CesarPlayer.mdp
index 729cda8..c424d85 100644
--- a/CesarPlayer/CesarPlayer.mdp
+++ b/CesarPlayer/CesarPlayer.mdp
@@ -66,11 +66,10 @@
<File subtype="Code" buildaction="Compile" name="Utils/Device.cs" />
<File subtype="Code" buildaction="Compile" name="Common/Constants.cs" />
<File subtype="Code" buildaction="Compile" name="Utils/MpegRemuxer.cs" />
- <File subtype="Code" buildaction="Compile" name="Common/VideoStandards.cs" />
+ <File subtype="Code" buildaction="Compile" name="Common/CaptureSettings.cs" />
<File subtype="Code" buildaction="Compile" name="Common/EncodingProfiles.cs" />
<File subtype="Code" buildaction="Compile" name="Common/EncodingSettings.cs" />
- <File subtype="Code" buildaction="Compile" name="Common/CaptureSettings.cs" />
- <File subtype="Directory" buildaction="Compile" name="Capturer" />
+ <File subtype="Code" buildaction="Compile" name="Common/VideoStandards.cs" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/CesarPlayer/Common/EncodingProfiles.cs b/CesarPlayer/Common/EncodingProfiles.cs
index a8ac364..a5cbd26 100644
--- a/CesarPlayer/Common/EncodingProfiles.cs
+++ b/CesarPlayer/Common/EncodingProfiles.cs
@@ -20,37 +20,39 @@ namespace LongoMatch.Video.Common
{
public struct EncodingProfile
{
- public EncodingProfile(string name,
- VideoEncoderType videoEncoder,
- AudioEncoderType audioEncoder,
- VideoMuxerType muxer) {
+ public EncodingProfile(string name, string extension,
+ VideoEncoderType videoEncoder,
+ AudioEncoderType audioEncoder,
+ VideoMuxerType muxer) {
Name = name;
+ Extension = extension;
VideoEncoder = videoEncoder;
AudioEncoder = audioEncoder;
Muxer = muxer;
}
public string Name;
+ public string Extension;
public VideoEncoderType VideoEncoder;
public AudioEncoderType AudioEncoder;
public VideoMuxerType Muxer;
}
public class EncodingProfiles {
- public static EncodingProfile WebM = new EncodingProfile("WebM (VP8 + Vorbis)",
- VideoEncoderType.VP8,
- AudioEncoderType.Vorbis,
- VideoMuxerType.WebM);
+ public static EncodingProfile WebM = new EncodingProfile("WebM (VP8 + Vorbis)", "webm",
+ VideoEncoderType.VP8,
+ AudioEncoderType.Vorbis,
+ VideoMuxerType.WebM);
- public static EncodingProfile Avi = new EncodingProfile("AVI (Mpeg4 + MP3)",
- VideoEncoderType.Mpeg4,
- AudioEncoderType.Mp3,
- VideoMuxerType.Avi);
+ public static EncodingProfile Avi = new EncodingProfile("AVI (Mpeg4 + MP3)", "avi",
+ VideoEncoderType.Mpeg4,
+ AudioEncoderType.Mp3,
+ VideoMuxerType.Avi);
- public static EncodingProfile MP4 = new EncodingProfile("MP4 (H264 + AAC)",
- VideoEncoderType.H264,
- AudioEncoderType.Aac,
- VideoMuxerType.Mp4);
+ public static EncodingProfile MP4 = new EncodingProfile("MP4 (H264 + AAC)", "mp4",
+ VideoEncoderType.H264,
+ AudioEncoderType.Aac,
+ VideoMuxerType.Mp4);
}
}
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
index e63162b..0a60812 100644
--- a/CesarPlayer/Common/Enum.cs
+++ b/CesarPlayer/Common/Enum.cs
@@ -76,14 +76,6 @@ namespace LongoMatch.Video.Common
Live,
}
- public enum VideoFormat {
- PORTABLE=0,
- VGA=1,
- TV=2,
- HD720p=3,
- HD1080p=4
- }
-
public enum VideoQuality {
Low = 1000,
Normal = 3000,
diff --git a/CesarPlayer/Editor/GstVideoSplitter.cs b/CesarPlayer/Editor/GstVideoSplitter.cs
index 9c22e7e..6ff1981 100644
--- a/CesarPlayer/Editor/GstVideoSplitter.cs
+++ b/CesarPlayer/Editor/GstVideoSplitter.cs
@@ -356,50 +356,20 @@ namespace LongoMatch.Video.Editor {
return argc;
}
-
- public void SetSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
- ClearList();
- AddSegment(filePath, start, duration, rate, title,hasAudio);
- }
-
- public VideoQuality VideoQuality {
- set {
- VideoBitrate=(int)value;
- }
- }
-
- public AudioQuality AudioQuality {
- set {
- AudioBitrate = (int)value;
- }
- }
-
- public VideoFormat VideoFormat {
- set {
- if(value == VideoFormat.PORTABLE) {
- Height = 240;
- Width = 320;
- }
- else if(value == VideoFormat.VGA) {
- Height = 480 ;
- Width = 640;
- }
- else if(value == VideoFormat.TV) {
- Height = 576;
- Width = 720;
- }
- else if(value == VideoFormat.HD720p) {
- Height = 720;
- Width = 1280;
- }
- else if(value == VideoFormat.HD1080p) {
- Height = 1080;
- Width = 1920;
- }
+ public EncodingSettings EncodingSettings{
+ set{
+ AudioEncoder = value.EncodingProfile.AudioEncoder;
+ VideoEncoder = value.EncodingProfile.VideoEncoder;
+ VideoMuxer = value.EncodingProfile.Muxer;
+ Height = (int) value.VideoStandard.Height;
+ Width = (int) value.VideoStandard.Width;
+ VideoBitrate = (int) value.VideoBitrate;
+ AudioBitrate = (int) value.AudioBitrate;
+ OutputFile = value.OutputFile;
}
}
- public AudioEncoderType AudioEncoder {
+ private AudioEncoderType AudioEncoder {
set {
string error;
SetAudioEncoder(out error,value);
@@ -408,7 +378,7 @@ namespace LongoMatch.Video.Editor {
}
}
- public VideoEncoderType VideoEncoder {
+ private VideoEncoderType VideoEncoder {
set {
string error;
SetVideoEncoder(out error, value);
@@ -417,7 +387,7 @@ namespace LongoMatch.Video.Editor {
}
}
- public VideoMuxerType VideoMuxer {
+ private VideoMuxerType VideoMuxer {
set {
string error;
SetVideoMuxer(out error,value);
diff --git a/CesarPlayer/Editor/IVideoEditor.cs b/CesarPlayer/Editor/IVideoEditor.cs
index f177384..e421150 100644
--- a/CesarPlayer/Editor/IVideoEditor.cs
+++ b/CesarPlayer/Editor/IVideoEditor.cs
@@ -30,34 +30,10 @@ namespace LongoMatch.Video.Editor
{
event ProgressHandler Progress;
- VideoQuality VideoQuality {
+ EncodingSettings EncodingSettings{
set;
}
-
- AudioQuality AudioQuality {
- set;
- }
-
- VideoFormat VideoFormat {
- set;
- }
-
- AudioEncoderType AudioEncoder {
- set;
- }
-
- VideoEncoderType VideoEncoder {
- set;
- }
-
- VideoMuxerType VideoMuxer {
- set;
- }
-
- string OutputFile {
- set;
- }
-
+
string TempDir {
set;
}
@@ -70,7 +46,6 @@ namespace LongoMatch.Video.Editor
set;
}
-
void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
void ClearList();
diff --git a/LongoMatch/Gui/Component/PlayListWidget.cs b/LongoMatch/Gui/Component/PlayListWidget.cs
index 16e7009..b488844 100644
--- a/LongoMatch/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch/Gui/Component/PlayListWidget.cs
@@ -266,7 +266,7 @@ namespace LongoMatch.Gui.Component
vep = new VideoEditionProperties();
vep.TransientFor = (Gtk.Window)this.Toplevel;
response = vep.Run();
- while(response == (int)ResponseType.Ok && vep.Filename == "") {
+ while(response == (int)ResponseType.Ok && vep.EncodingSettings.OutputFile == "") {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("Please, select a video file."));
response=vep.Run();
@@ -285,15 +285,9 @@ namespace LongoMatch.Gui.Component
segment.MediaFile.HasAudio);
}
try {
- videoEditor.VideoQuality = vep.VideoQuality;
- videoEditor.AudioQuality = AudioQuality.Good;
- videoEditor.VideoFormat = vep.VideoFormat;
- videoEditor.AudioEncoder = vep.AudioEncoderType;
- videoEditor.VideoEncoder = vep.VideoEncoderType;
- videoEditor.OutputFile = vep.Filename;
+ videoEditor.EncodingSettings = vep.EncodingSettings;
videoEditor.EnableTitle = vep.TitleOverlay;
videoEditor.EnableAudio = vep.EnableAudio;
- videoEditor.VideoMuxer = vep.VideoMuxer;
videoEditor.Start();
closebutton.Show();
newvideobutton.Hide();
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index b524dc2..652b923 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -264,6 +264,10 @@ namespace LongoMatch.Gui.Component
videoformatcombobox.GetActiveIter(out iter);
encSettings.EncodingProfile = (EncodingProfile) encProfileList.GetValue(iter, 1);
+ /* FIXME: Configure with the UI */
+ encSettings.Framerate_n = 25;
+ encSettings.Framerate_d = 1;
+
s.EncodingSettings = encSettings;
return s;
}
diff --git a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
index bfd2bc2..c3b1d90 100644
--- a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
@@ -32,57 +32,26 @@ namespace LongoMatch.Gui.Dialog
[System.ComponentModel.ToolboxItem(false)]
public partial class VideoEditionProperties : Gtk.Dialog
{
- private VideoQuality vq;
- private VideoFormat vf;
- private VideoEncoderType vcodec;
- private AudioEncoderType acodec;
- private VideoMuxerType muxer;
+ private EncodingSettings encSettings;
+ private ListStore stdStore;
+ private ListStore encStore;
#region Constructors
public VideoEditionProperties()
{
this.Build();
- formatcombobox.AppendText(Constants.MP4);
- formatcombobox.AppendText(Constants.AVI);
- if(System.Environment.OSVersion.Platform != PlatformID.Win32NT) {
- formatcombobox.AppendText(Constants.WEBM);
- formatcombobox.AppendText(Constants.OGG);
- formatcombobox.AppendText(Constants.DVD);
- }
- formatcombobox.Active=0;
+ encSettings = new EncodingSettings();
+ FillVideoStandards();
+ FillEncodingProfiles();
}
#endregion
#region Properties
- public VideoQuality VideoQuality {
- get {
- return vq;
- }
- }
-
- public VideoEncoderType VideoEncoderType {
- get {
- return vcodec;
- }
- }
-
- public AudioEncoderType AudioEncoderType {
- get {
- return acodec;
- }
- }
-
- public VideoMuxerType VideoMuxer {
+ public EncodingSettings EncodingSettings{
get {
- return muxer;
- }
- }
-
- public string Filename {
- get {
- return fileentry.Text;
+ return encSettings;
}
}
@@ -98,72 +67,76 @@ namespace LongoMatch.Gui.Dialog
}
}
- public VideoFormat VideoFormat {
- get {
- return vf;
- }
- }
#endregion Properties
#region Private Methods
private string GetExtension() {
- if(formatcombobox.ActiveText == Constants.MP4)
- return "mp4";
- else if(formatcombobox.ActiveText == Constants.OGG)
- return "ogg";
- else if(formatcombobox.ActiveText == Constants.WEBM)
- return "webm";
- else if(formatcombobox.ActiveText == Constants.AVI)
- return "avi";
- else
- return "mpg";
+ TreeIter iter;
+ return ((EncodingProfile) encStore.GetValue(iter, 1)).Extension;
}
#endregion
+ private void FillVideoStandards() {
+ stdStore = new ListStore(typeof(string), typeof (VideoStandard));
+ stdStore.AppendValues(VideoStandards.Original.Name, VideoStandards.Original);
+ stdStore.AppendValues(VideoStandards.P240.Name, VideoStandards.P240_4_3);
+ stdStore.AppendValues(VideoStandards.P240.Name, VideoStandards.P240_16_9);
+ stdStore.AppendValues(VideoStandards.P480.Name, VideoStandards.P480_4_3);
+ stdStore.AppendValues(VideoStandards.P480.Name, VideoStandards.P480_16_9);
+ stdStore.AppendValues(VideoStandards.P720.Name, VideoStandards.P720_4_3);
+ stdStore.AppendValues(VideoStandards.P720.Name, VideoStandards.P720_16_9);
+ stdStore.AppendValues(VideoStandards.P1080.Name, VideoStandards.P1080_4_3);
+ stdStore.AppendValues(VideoStandards.P1080.Name, VideoStandards.P1080_16_9);
+ sizecombobox.Model = stdStore;
+ sizecombobox.Active = 0;
+ }
+
+ private void FillEncodingProfiles() {
+ encStore = new ListStore(typeof(string), typeof (EncodingProfile));
+ encStore.AppendValues(EncodingProfiles.MP4.Name, EncodingProfiles.MP4);
+ encStore.AppendValues(EncodingProfiles.Avi.Name, EncodingProfiles.Avi);
+ encStore.AppendValues(EncodingProfiles.WebM.Name, EncodingProfiles.WebM);
+ formatcombobox.Model = encStore;
+ formatcombobox.Active = 0;
+ }
+
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
{
+ TreeIter iter;
+
if(qualitycombobox.ActiveText == Catalog.GetString("Low")) {
- vq = VideoQuality.Low;
+ encSettings.VideoBitrate = (uint) VideoQuality.Low;
+ encSettings.AudioBitrate = (uint) AudioQuality.Low;
}
else if(qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
- vq = VideoQuality.Normal;
+ encSettings.VideoBitrate = (uint) VideoQuality.Normal;
+ encSettings.AudioBitrate =(uint) AudioQuality.Normal;
}
else if(qualitycombobox.ActiveText == Catalog.GetString("Good")) {
- vq = VideoQuality.Good;
+ encSettings.VideoBitrate =(uint) VideoQuality.Good;
+ encSettings.AudioBitrate =(uint) AudioQuality.Good;
}
else if(qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
- vq = VideoQuality.Extra;
- }
-
- vf = (VideoFormat)sizecombobox.Active;
-
- if(formatcombobox.ActiveText == Constants.MP4) {
- vcodec = VideoEncoderType.H264;
- acodec = AudioEncoderType.Aac;
- muxer = VideoMuxerType.Mp4;
- }
- else if(formatcombobox.ActiveText == Constants.OGG) {
- vcodec = VideoEncoderType.Theora;
- acodec = AudioEncoderType.Vorbis;
- muxer = VideoMuxerType.Ogg;
- }
- else if(formatcombobox.ActiveText == Constants.WEBM) {
- vcodec = VideoEncoderType.VP8;
- acodec = AudioEncoderType.Vorbis;
- muxer = VideoMuxerType.WebM;
- }
- else if(formatcombobox.ActiveText == Constants.AVI) {
- vcodec = VideoEncoderType.Xvid;
- acodec = AudioEncoderType.Mp3;
- muxer = VideoMuxerType.Avi;
- }
- else if(formatcombobox.ActiveText == Constants.DVD) {
- vcodec = VideoEncoderType.Mpeg2;
- acodec = AudioEncoderType.Mp3;
- muxer = VideoMuxerType.MpegPS;
- }
+ encSettings.VideoBitrate =(uint) VideoQuality.Extra;
+ encSettings.AudioBitrate =(uint) AudioQuality.Extra;
+ }
+
+ /* Get size info */
+ sizecombobox.GetActiveIter(out iter);
+ encSettings.VideoStandard = (VideoStandard) stdStore.GetValue(iter, 1);
+
+ /* Get encoding profile info */
+ formatcombobox.GetActiveIter(out iter);
+ encSettings.EncodingProfile = (EncodingProfile) encStore.GetValue(iter, 1);
+
+ encSettings.OutputFile = fileentry.Text;
+
+ /* FIXME: Configure with the UI */
+ encSettings.Framerate_n = 25;
+ encSettings.Framerate_d = 1;
+
Hide();
}
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
index 0b51d5e..c798206 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
@@ -108,13 +108,7 @@ namespace LongoMatch.Gui.Dialog
w5.Position = 0;
// Container child hbox4.Gtk.Box+BoxChild
this.sizecombobox = global::Gtk.ComboBox.NewText ();
- this.sizecombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Portable (4:3 - 320x240)"));
- this.sizecombobox.AppendText (global::Mono.Unix.Catalog.GetString ("VGA (4:3 - 640x480)"));
- this.sizecombobox.AppendText (global::Mono.Unix.Catalog.GetString ("TV (4:3 - 720x576)"));
- this.sizecombobox.AppendText (global::Mono.Unix.Catalog.GetString ("HD 720p (16:9 - 1280x720)"));
- this.sizecombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Full HD 1080p (16:9 - 1920x1080)"));
this.sizecombobox.Name = "sizecombobox";
- this.sizecombobox.Active = 1;
this.hbox4.Add (this.sizecombobox);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.sizecombobox]));
w6.Position = 1;
@@ -262,8 +256,8 @@ namespace LongoMatch.Gui.Dialog
if ((this.Child != null)) {
this.Child.ShowAll ();
}
- this.DefaultWidth = 514;
- this.DefaultHeight = 223;
+ this.DefaultWidth = 516;
+ this.DefaultHeight = 245;
this.Show ();
this.openbutton.Clicked += new global::System.EventHandler (this.OnOpenbuttonClicked);
this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked);
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 0973a55..b784d4f 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -3232,7 +3232,7 @@ new one.</property>
</widget>
</child>
</widget>
- <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.VideoEditionProperties" design-size="514 223">
+ <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.VideoEditionProperties" design-size="516 245">
<property name="MemberName" />
<property name="Title" translatable="yes">Video Properties</property>
<property name="Icon">stock:longomatch Dialog</property>
@@ -3310,12 +3310,7 @@ Extra</property>
<widget class="Gtk.ComboBox" id="sizecombobox">
<property name="MemberName" />
<property name="IsTextCombo">True</property>
- <property name="Items">Portable (4:3 - 320x240)
-VGA (4:3 - 640x480)
-TV (4:3 - 720x576)
-HD 720p (16:9 - 1280x720)
-Full HD 1080p (16:9 - 1920x1080)</property>
- <property name="Active">1</property>
+ <property name="Items" />
</widget>
<packing>
<property name="Position">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]