日別アーカイブ: 2016/05/15

ClutterGst Aspect Rate

Y901x 1.2 beta2 を公開しました。

色々考えた結果リサイズはキーボード操作のみに。
だってメニューからリサイズしたことなんて作った本人は一度も無いモン!

GTK+ 3.20 でショートカットウィンドウが追加されるようなのでそれで賄う予定。
ソレを使う問題点は Ubuntu には完全未対応となるってことだけ。
Ubuntu GNOME でさえ 3.18 ですから。

その Ubuntu は次で独自 API に切り換えるという破滅への第一歩を選んだみたい。
GNOME が GNOME3 でアレだけシェアを落としたのを見てきたはずなのにねぇ。
とりあえず我がサイトは Ubuntu のページを全削除しておいた。

まあそれはどうでもよくて。
アスペクト比変更機能には本当に困った。

GStreamer-devel – Difference between videoscale and videobox

gst-launch-1.0 には aspect-ratio というオプションがある。
ならば普通に比率を与えれば有効にできる手段があるはず!
と探してみるけど全然見つからない。

手段は違うけどこんなのも見つけた。
kaa-candy/gstreamer.py at master ? freevo/kaa-candy ? GitHub
でも clutter_actor_animatev はもう使うなとのこと。

本当に Clutter はゴロッと変わって以前のサンプルコードが全滅状態。
初期段階で手を出さないでよかったなんて思うくらい。

結局自力でやることに。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
this.actor = new Clutter.Actor();
this.actor.set_background_color(Clutter.Color.new(0, 0, 0, 255));
//this.content = new ClutterGst.Aspectratio();
this.content = new ClutterGst.Content();
this.actor.set_content(this.content);
//
// etc...
//
this.set_video_size = function() {
    let allocation = this.vbox.get_allocation();
    let offset = SEEKBAR_HEIGHT;
    if (this.is_fullscreen)
        offset = 0;
    if (this.player.get_uri() != null) {
        let w = this.src_width;
        if (this.aspectrate == 1)
            w = this.src_height *16 / 9;
        else if (this.aspectrate == 2)
            w = this.src_height *4 / 3;
        let h = this.src_height;
        let aw = allocation.width;
        let ah = allocation.height - offset;
        let width, height, x, y = 0;
        if (aw * h > ah * w) {
            width = w * ah / h;
            height = ah;
            x = (aw - width) / 2;
            y = 0;
        } else {
            width = aw;
            height = h * aw / w;
            x = 0;
            y = (ah - height) / 2;
        }
        this.actor.set_width(width);
        this.actor.set_height(height);
        this.actor.set_position(x, y);
    } else {
        this.actor.set_width(allocation.width);
        this.actor.set_height(allocation.height - offset);
    }
}

ま、自力変更は x の付かない Y901 でやっていたし。
ClutterGst.Content を適切にレイアウトするだけで難しくはない。

それより色々問題が出ている。

application_id を有効にすると多重起動の一つを閉じただけで落ちる。
GLXBadDrawable というエラーで落ちる。

GtkApplication からもう一つウインドウを開く処理を入れると落ちる。
GLXBadDrawable というエラーで落ちる。

GL* だから OpenGL だよね、Clutter 側がなんとかしてくれないとお手上げ。