diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-04-27 19:43:02 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-04-27 19:43:02 +0000 |
commit | 4852c618d8f38a20111ab38a45c92a0d98f2713d (patch) | |
tree | 01760ef2326c4be026922aff015e8931d4883a86 /capture.c | |
parent | b979f69c0c2f3b4a70f00730c581cb53b1aa1d37 (diff) |
add a state member to the capture_opts, and set it according to the capture engine
svn path=/trunk/; revision=14205
Diffstat (limited to 'capture.c')
-rw-r--r-- | capture.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -82,6 +82,9 @@ capture_start(capture_options *capture_opts) /* close the currently loaded capture file */ cf_close(capture_opts->cf); + g_assert(capture_opts->state == CAPTURE_STOPPED); + capture_opts->state = CAPTURE_PREPARING; + /* try to start the capture child process */ ret = sync_pipe_start(capture_opts, capture_opts->save_file == NULL); if(!ret) { @@ -89,6 +92,8 @@ capture_start(capture_options *capture_opts) g_free(capture_opts->save_file); capture_opts->save_file = NULL; } + + capture_opts->state = CAPTURE_STOPPED; } return ret; @@ -209,6 +214,7 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file) int err; + g_assert(capture_opts->state == CAPTURE_PREPARING || capture_opts->state == CAPTURE_RUNNING); /*g_warning("New capture file: %s", new_file);*/ /* free the old filename */ @@ -251,6 +257,7 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file) cf_callback_invoke(cf_cb_live_capture_fixed_started, capture_opts); } + capture_opts->state = CAPTURE_RUNNING; return TRUE; } @@ -299,8 +306,10 @@ capture_input_closed(capture_options *capture_opts) int err; - /* if we have no file (happens if an error occured), do a fake start */ - if(capture_opts->save_file == NULL) { + g_assert(capture_opts->state == CAPTURE_PREPARING || capture_opts->state == CAPTURE_RUNNING); + + /* if we didn't started the capture (happens if an error occured), do a fake start */ + if(capture_opts->state == CAPTURE_PREPARING) { if(capture_opts->real_time_mode) { cf_callback_invoke(cf_cb_live_capture_update_started, capture_opts); } else { @@ -349,6 +358,8 @@ capture_input_closed(capture_options *capture_opts) } } + capture_opts->state = CAPTURE_STOPPED; + /* if we couldn't open a capture file, there's nothing more for us to do */ if(capture_opts->save_file == NULL) { cf_close(capture_opts->cf); |