LoginSignup
0
2

More than 5 years have passed since last update.

gst-app-maker という黒魔術

Posted at

アドベントカレンダー14日目です。

plugin の記事を書こうとしていたら gst-plugins-bad に面白いものを見つけました。

その名は gst-app-maker

使い方は簡単。

$ gst-app-maker my_video_mixer

とすると、以下の main() を含んだ一通りのベーシックなコードが入ったものが作成されます笑

int
main (int argc, char *argv[])
{
  GError *error = NULL;
  GOptionContext *context;
  GstMyVideoMixer *myvideomixer;
  GMainLoop *main_loop;

  context = g_option_context_new ("- FIXME");
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_add_group (context, gst_init_get_option_group ());
  if (!g_option_context_parse (context, &argc, &argv, &error)) {
    g_print ("option parsing failed: %s\n", error->message);
    g_clear_error (&error);
    g_option_context_free (context);
    exit (1);
  }
  g_option_context_free (context);

  myvideomixer = gst_my_video_mixer_new ();

  if (argc > 1) {
    gchar *uri;
    if (gst_uri_is_valid (argv[1])) {
      uri = g_strdup (argv[1]);
    } else {
      uri = g_filename_to_uri (argv[1], NULL, NULL);
    }
    gst_my_video_mixer_create_pipeline_playbin (myvideomixer, uri);
    g_free (uri);
  } else {
    gst_my_video_mixer_create_pipeline (myvideomixer);
  }

  gst_my_video_mixer_start (myvideomixer);

  main_loop = g_main_loop_new (NULL, TRUE);
  myvideomixer->main_loop = main_loop;

  g_main_loop_run (main_loop);

  exit (0);
}

これで開発をスタートアップするのが一番速いのかはいささか疑問ですが、
GStreamer の流儀に沿った命名規則のコードが自動生成されるので、便利なツールであることは確かです。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2