From 8b60054843d0c7f4106d0558c59906a0c33df6da Mon Sep 17 00:00:00 2001 From: Trever Fischer Date: Tue, 1 Mar 2011 18:36:07 -0500 Subject: Add --version flag --- src/anchorman.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/anchorman.c b/src/anchorman.c index 6ed979b..db4e8a5 100644 --- a/src/anchorman.c +++ b/src/anchorman.c @@ -23,6 +23,23 @@ #include #include +#define ANCHORMAN_VERSION_MAJOR 0 +#define ANCHORMAN_VERSION_MINOR 0 +#define ANCHORMAN_VERSION_MICRO 1 + +#define ANCHORMAN_VERSION \ + ((ANCHORMAN_VERSION_MAJOR << 8) | \ + (ANCHORMAN_VERSION_MINOR << 4) | \ + (ANCHORMAN_VERSION_MICRO)) + +#define STRINGIZE2(s) #s +#define STRINGIZE(s) STRINGIZE2(s) + +#define ANCHORMAN_VERSION_STRING \ + STRINGIZE(ANCHORMAN_VERSION_MAJOR) "." \ + STRINGIZE(ANCHORMAN_VERSION_MINOR) "." \ + STRINGIZE(ANCHORMAN_VERSION_MICRO) + // Original gst-launch command: // gst-launch v4l2src device=/dev/video0 ! ffmpegcolorspace ! videorate ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc bitrate=64 ! queue leaky=1 ! oggmux name=mux alsasrc device=hw:1 ! audioconvert ! vorbisenc ! queue leaky=1 ! mux. mux. ! queue ! shout2send ip=acm.cs.uakron.edu mount=lab.ogg @@ -32,6 +49,7 @@ static gchar *videoDevice = 0; static gchar *audioDevice = 0; static gchar *icecastServer = 0; static gchar *icecastMount = 0; +static gboolean printVersion = FALSE; static GOptionEntry entries[] = { @@ -39,6 +57,7 @@ static GOptionEntry entries[] = { "audio-device", 'a', 0, G_OPTION_ARG_STRING, &audioDevice, "Audio device to use", "device" }, { "server", 's', 0, G_OPTION_ARG_STRING, &icecastServer, "Icecast server to stream to", "server" }, { "mount", 'm', 0, G_OPTION_ARG_STRING, &icecastMount, "Icecast mount to stream to on the server", "mount" }, + { "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Display version", NULL }, { NULL } }; @@ -223,6 +242,11 @@ int main(int argc, char* argv[]) exit(1); } + if (printVersion) { + g_print("anchorman version %s\n", ANCHORMAN_VERSION_STRING); + exit(0); + } + if (!videoDevice) { videoDevice = strdup("/dev/video0"); } -- cgit