cheese r700 - in branches/cheese-vala: . src



Author: jhaitsma
Date: Mon Apr 28 15:48:58 2008
New Revision: 700
URL: http://svn.gnome.org/viewvc/cheese?rev=700&view=rev

Log:
Commit progress


Modified:
   branches/cheese-vala/   (props changed)
   branches/cheese-vala/src/Makefile.am
   branches/cheese-vala/src/cheese-thumb-view.vala
   branches/cheese-vala/src/cheese-webcam.vala

Modified: branches/cheese-vala/src/Makefile.am
==============================================================================
--- branches/cheese-vala/src/Makefile.am	(original)
+++ branches/cheese-vala/src/Makefile.am	Mon Apr 28 15:48:58 2008
@@ -5,11 +5,13 @@
 	--pkg gdk-2.0 \
 	--pkg gtk+-2.0 \
 	--pkg gstreamer-0.10 \
+	--pkg gstreamer-interfaces-0.10 \
 	--pkg gconf-2.0 \
 	--pkg gio-2.0 \
 	--pkg gee-1.0 \
 	--pkg libgnomeui-2.0 \
 	--pkg gdk-pixbuf-2.0 \
+	--pkg gdk-x11-2.0 \
 	--pkg gnome-vfs-2.0 \
 	--pkg hal
 	

Modified: branches/cheese-vala/src/cheese-thumb-view.vala
==============================================================================
--- branches/cheese-vala/src/cheese-thumb-view.vala	(original)
+++ branches/cheese-vala/src/cheese-thumb-view.vala	Mon Apr 28 15:48:58 2008
@@ -48,6 +48,70 @@
 
 	public string media_dir {get; construct;}
 
+	
+	construct {
+		store = new ListStore (2, typeof (Pixbuf), typeof (string));
+		set_model (store);
+		set_size_request (-1, THUMB_VIEW_HEIGHT);
+
+		var dir = File.new_for_path (media_dir);
+		dir_monitor = FileMonitor.directory (dir, 0, null); 
+		dir_monitor.changed += on_file_changed;
+		set_pixbuf_column (0);
+		set_columns (int.MAX);
+
+		enable_model_drag_source (ModifierType.BUTTON1_MASK, target_entries, DragAction.COPY);
+		drag_data_get += on_drag_data_get;
+
+		store.set_sort_column_id (Column.URL, SortType.ASCENDING);
+
+		thumbnail_factory = new ThumbnailFactory (ThumbnailSize.NORMAL);
+		// FIXME: move from here
+		load_existing_thumbs ();
+	} 
+	
+	public ThumbView (string media_dir) {
+		this.media_dir = media_dir;
+	}
+
+	public ArrayList<string> get_all_thumbs () {
+		var filename_list = new ArrayList<string> ();
+		TreeIter iter;
+
+		if (store.get_iter_first (out iter)) {
+			do {
+				string path;
+				store.get (iter, Column.URL, out path);
+				filename_list.add (path);			
+			} while (store.iter_next (ref iter));
+		}
+		return filename_list;
+	}
+
+	public ArrayList<string> get_selected_thumbs () {
+		var filename_list = new ArrayList<string> ();
+		weak GLib.List<TreePath> l;
+		l = get_selected_items ();
+
+		for (int i; i < l.length (); i++) {
+			weak TreePath tree_path = l.nth_data (i);
+			var filename = get_filename_from_tree_path (tree_path);
+			filename_list.add (filename);
+		}
+
+		return filename_list;
+	}
+
+	string get_filename_from_tree_path (TreePath path) {
+		TreeModel model = get_model ();
+		TreeIter iter;
+		string filename;
+
+		model.get_iter (out iter, path);
+		model.get (iter, Column.URL, filename);
+		return filename;
+	}
+		
 	void append_thumb (File file) {
 		FileInfo file_info;
 		Pixbuf pixbuf;
@@ -114,44 +178,6 @@
 		}
 	}
 
-	public ArrayList<string> get_all_thumbs () {
-		var filename_list = new ArrayList<string> ();
-		TreeIter iter;
-
-		if (store.get_iter_first (out iter)) {
-			do {
-				string path;
-				store.get (iter, Column.URL, out path);
-				filename_list.add (path);			
-			} while (store.iter_next (ref iter));
-		}
-		return filename_list;
-	}
-
-
-	string get_filename_from_tree_path (TreePath path) {
-		TreeModel model = get_model ();
-		TreeIter iter;
-		string filename;
-
-		model.get_iter (out iter, path);
-		model.get (iter, Column.URL, filename);
-		return filename;
-	}
-
-	public ArrayList<string> get_selected_thumbs () {
-		var filename_list = new ArrayList<string> ();
-		weak GLib.List<TreePath> l;
-		l = get_selected_items ();
-
-		for (int i; i < l.length (); i++) {
-			weak TreePath tree_path = l.nth_data (i);
-			var filename = get_filename_from_tree_path (tree_path);
-			filename_list.add (filename);
-		}
-
-		return filename_list;
-	}
 
 	void on_file_changed (FileMonitor sender, File file, File other_file, FileMonitorEvent event_type) {
 		switch (event_type) {
@@ -188,28 +214,4 @@
 			// FIXME
 		}
 	}
-
-	construct {
-		store = new ListStore (2, typeof (Pixbuf), typeof (string));
-		set_model (store);
-		set_size_request (-1, THUMB_VIEW_HEIGHT);
-
-		var dir = File.new_for_path (media_dir);
-		dir_monitor = FileMonitor.directory (dir, 0, null); 
-		dir_monitor.changed += on_file_changed;
-		set_pixbuf_column (0);
-		set_columns (int.MAX);
-
-		enable_model_drag_source (ModifierType.BUTTON1_MASK, target_entries, DragAction.COPY);
-		drag_data_get += on_drag_data_get;
-
-		store.set_sort_column_id (Column.URL, SortType.ASCENDING);
-
-		thumbnail_factory = new ThumbnailFactory (ThumbnailSize.NORMAL);
-		// FIXME: move from here
-		load_existing_thumbs ();
-	} 
-	public ThumbView (string media_dir) {
-		this.media_dir = media_dir;
-	}
 }

Modified: branches/cheese-vala/src/cheese-webcam.vala
==============================================================================
--- branches/cheese-vala/src/cheese-webcam.vala	(original)
+++ branches/cheese-vala/src/cheese-webcam.vala	Mon Apr 28 15:48:58 2008
@@ -19,7 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-using GLib, Gst, Gtk, Gee, Hal;
+using GLib, Gst, Gtk, Gdk, Gee, Hal;
 
 public class Cheese.Webcam : GLib.Object {
 
@@ -66,18 +66,27 @@
 		{Effect.DICE, "dicetv", ColorSpace.RGB},
 		{Effect.WARP, "warptv", ColorSpace.RGB}
 	};
+	
+	Widget _video_window;
+	public Widget video_window {
+		get { //FIXME can be removed??
+			return _video_window;
+		}
+		set construct {
+			_video_window = video_window;
+			video_window.expose_event += on_expose;
+		}
+	}
 
-	public DrawingArea video_screen {get; construct;}
-
-	Element pipeline; 
-  	Bus     bus;
+	Pipeline pipeline; 
+  	Bus      bus;
 	/* We build the active pipeline by linking the appropriate pipelines 
 	   listed below */
-	Element webcam_source_bin;
-	Element video_display_bin;
+	Gst.Bin webcam_source_bin;
+	Gst.Bin video_display_bin;
 
-	Element photo_save_bin;
-	Element video_save_bin;
+	Gst.Bin photo_save_bin;
+	Gst.Bin video_save_bin;
 
 	Element video_source;
 	Element capsfilter;
@@ -95,6 +104,9 @@
 	bool is_recording;
 	bool pipeline_is_playing;
 	string photo_filename;
+	
+	/* Dummy variable used to increase ref count */
+	Element sink_ref;
 /*    
   XF86VidModeGamma normal_gamma;
   float flash_intensity;
@@ -133,4 +145,93 @@
 	public int get_num_devices () {
 		return 0;
 	}
+	public void set_effect (Effect effect) {
+		
+	}
+	
+	
+	void set_x_overlay () {
+		XOverlay overlay = (XOverlay)pipeline.get_by_interface (typeof(XOverlay));
+		overlay.set_xwindow_id (x11_drawable_get_xid (video_window.window));
+	}
+
+	void on_expose (Widget sender, Gdk.Event event) {
+		set_x_overlay ();
+	}
+	
+	void on_photo_data (Element element, Buffer buffer, Pad pad) {
+		
+	}
+	
+	void on_bus_message (Bus bus, Message message) {
+		
+	}
+
+	void get_video_devices_from_hal () {
+		
+	}
+	
+	void get_supported_framerates () {
+		
+	}
+	
+	void get_supported_video_formats () {
+		
+	}
+	
+	void get_webcam_device_data () {
+		
+	}
+	
+	void detect_webcam_devices () {
+		
+	}
+	
+	bool create_webcam_source_bin () {
+		return false;
+	}
+	
+	bool create_video_display_bin () {
+		return false;
+	}
+
+	bool create_photo_save_bin () {
+		return false;
+	}
+	
+	bool create_video_save_bin () {
+		return false;
+	}
+	void flash_set_intensity (float intesity) {
+		
+	}
+	void on_flash_dim () {
+		
+	}
+	
+	void flash () {
+		
+	}
+	
+	void set_effect_filter (Element filter) {
+		
+	}
+	
+	void change_sink (Element src, Element new_sink, Element old_sink) {
+		bool is_playing = pipeline_is_playing;
+		
+		stop ();
+		src.unlink (old_sink);
+		/* Increase ref with one so old_sink won't get freed */
+		// FIXME: Can be removed as soon as bug has been fixed in vala
+		sink_ref = old_sink;
+		pipeline.remove (old_sink);
+
+		pipeline.add (new_sink);
+		src.link (new_sink);
+		
+		if (is_playing) {
+			play ();
+		}
+	}	
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]