~stianse/playraw/trunk

« back to all changes in this revision

Viewing changes to src/rawcompare.vala

  • Committer: Stian Selnes
  • Date: 2010-05-09 14:15:59 UTC
  • Revision ID: stian.selnes@tandberg.com-20100509141559-pj4typprju7t9qtp
[playraw] Added preferences (brightness/contrast for rawcompare). Dialog and instant update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
    private dynamic Element suppresscolor1;
35
35
    private dynamic Element suppresscolor2;
 
36
    private dynamic Element videocompare;
 
37
 
 
38
    private int brightness;
 
39
    private int contrast;
36
40
 
37
41
    ~RawCompare () {
38
42
        close_file ();
53
57
        this.format = format;
54
58
        this.xid = xid;
55
59
 
 
60
        var prefs = Config.Preferences.instance ();
 
61
        this.brightness = prefs.brightness;
 
62
        this.contrast = prefs.contrast;
 
63
        // Notify when preferences change so we can update immediately
 
64
        prefs.notify["brightness"] += on_preference_change;
 
65
        prefs.notify["contrast"] += on_preference_change;
 
66
 
56
67
        loading_complete = false;
57
68
 
58
69
        pipeline = new Pipeline ("RawComparePipeline");
99
110
        pipeline.add (suppresscolor2);
100
111
 
101
112
        // Compare and display
102
 
        var videocompare = ElementFactory.make ("videocompare", null);
 
113
        videocompare = ElementFactory.make ("videocompare", null);
 
114
        videocompare.brightness = brightness;
 
115
        videocompare.contrast = contrast;
103
116
        pipeline.add (videocompare);
104
117
 
105
118
        Element colorspace1 = ElementFactory.make ("ffmpegcolorspace", null);
126
139
        pipeline.set_state (State.PLAYING);
127
140
    }
128
141
 
 
142
    private void on_preference_change (Config.Preferences prefs, ParamSpec pspec) {
 
143
        switch (pspec.name) {
 
144
        case "brightness":
 
145
            this.brightness = prefs.brightness;
 
146
            break;
 
147
        case "contrast":
 
148
            this.contrast = prefs.contrast;
 
149
            break;
 
150
        default:
 
151
            break;
 
152
        }
 
153
        update_pipeline ();
 
154
    }
129
155
 
130
156
 
131
157
    private override void update_pipeline ()
140
166
        suppresscolor2.suppress_u = ! show_u;
141
167
        suppresscolor2.suppress_v = ! show_v;
142
168
 
 
169
        videocompare.brightness = brightness;
 
170
        videocompare.contrast = contrast;
 
171
 
143
172
        advance_frames (0);
144
173
        pipeline.set_state (state);
145
174
    }