void stop_playback_cb (GtkWidget * widget, gpointer data) { sw_view * view = (sw_view *)data; stop_playback (view->sample); }
/** Joue la vidéo à intervalle fixe */ void Ui_MainWindow::timerEvent(QTimerEvent*){ int i, count, taille; /* THAT SUCKS ! But I don't get how opencv manages memory */ bool should_free = false; /* END OF MAJOR SUCKINESS */ type_filtre filter; QString type, param; QListWidgetItem* item_i; count = listWidget->count(); current_image = cvQueryFrame(source); if (!current_image) { stop_playback(); return; } update_image_infos(); fit_window(); for(i = 0; i < count; i++) { item_i = listWidget->item(i); if (item_i->text() != "Nouveau") { type = item_i->text().section(" ", 0, 0); filter = filter_of_id(type); if (MEDIAN == filter || BILATERAL == filter) should_free = true; param = item_i->text().section(" ", 1, 1); taille = param.at(0).digitValue(); current_image = apply_filter(current_image, filter_of_id(type), taille); } } cvwidget->putImage(current_image); if (should_free) cvReleaseImage(¤t_image); return; }
RecordMonitorThread::~RecordMonitorThread() { stop_playback(); if( input_frame && !shared_data ) delete input_frame; delete ovly; delete output_lock; delete input_lock; }
/* Callback function invoked when a message arrives on the playback * pipeline's bus. */ static gboolean bus_callback (GstBus *bus, GstMessage *message, gpointer data) { switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR: { /* An error has occurred. * A real application would probably need to handle this more * intelligently than just quitting. */ GError *err; gchar *debug; gst_message_parse_error(message, &err, &debug); g_print("Error: %s\n", err->message); g_error_free(err); g_free(debug); gtk_main_quit(); break; } case GST_MESSAGE_EOS: /* The pipeline has reached the end of the stream. */ g_print("End of stream\n"); stop_playback(); gui_status_update(STATE_STOP); break; case GST_MESSAGE_TAG: { /* The stream discovered new tags. */ GstTagList *tags; gchar *title = ""; gchar *artist = ""; /* Extract from the message the GstTagList. * This generates a copy, so we must remember to free it.*/ gst_message_parse_tag(message, &tags); /* Extract the title and artist tags - if they exist */ if (gst_tag_list_get_string(tags, GST_TAG_TITLE, &title) && gst_tag_list_get_string(tags, GST_TAG_ARTIST, &artist)) gui_update_metadata(title, artist); /* Free the tag list */ gst_tag_list_free(tags); break; } default: /* Another message occurred which we are not interested in handling. */ break; } /* We have handled this message, so indicate that it should be removed from * the queue.*/ return TRUE; }
static void suspend_device(ALCdevice *pDevice) { SLresult result; if (pDevice) { opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData; if (devState->bqPlayerPlay) { result = (*devState->bqPlayerPlay)->SetPlayState(devState->bqPlayerPlay, SL_PLAYSTATE_PAUSED); assert(SL_RESULT_SUCCESS == result); result = (*devState->bqPlayerBufferQueue)->Clear(devState->bqPlayerBufferQueue); assert(SL_RESULT_SUCCESS == result); } stop_playback(pDevice); } }
void RecordMonitor::reconfig() { stop_playback(); VideoOutConfig config = *device->out_config; device->close_all(); device->open_output(&config, record->default_asset->frame_rate, record->default_asset->width, record->default_asset->height, window->canvas, 0); start_playback(); redraw(); }
void print_string(const char *string, int num_lines, int freq_min, int freq_max, int col_time_ms) { Context context; Pa_Initialize(); context_init(&context, num_lines, freq_min, freq_max, col_time_ms); start_playback(&context); int num_cols = 0; const char *message = prepare_message(string, &num_cols); for (int col = 0; col < num_cols; col++) { const char *col_start = message + col*ROWS_PER_LETTER; print_text_column(&context, col_start, ROWS_PER_LETTER); } free((void*)message); stop_playback(&context); Pa_Terminate(); context_dealloc(&context); }
int TimeBar::button_press_event() { if(is_event_win() && cursor_inside() && get_buttonpress() == 1) { // Change time format if(ctrl_down()) { if(get_buttonpress() == 1) mwindow->next_time_format(); else if(get_buttonpress() == 2) mwindow->prev_time_format(); return 1; } else // if(test_preview(1)) // { // } // else { stop_playback(); // Select region between two labels if(get_double_click()) { double position = pixel_to_position(get_cursor_x()); // Test labels select_region(position); return 1; } else // Reposition highlight cursor if(is_event_win() && cursor_inside()) { update_cursor(); current_operation = TIMEBAR_DRAG; activate_timeline(); return 1; } } } return 0; }
/************************************************************************ * * * Notifier proceedure for start/stop buttons * */ void Win_movie::start_stop(Panel_item, int value, Event *) { switch (value){ case 0: play_direction = BACKWARD; start_playback(); break; case 1: stop_playback(); break; case 2: play_direction = FORWARD; start_playback(); break; } }
void print_image(const char *filename, int freq_min, int freq_max, int col_time_ms) { char buf[2048]; Context context; int width, height, max; const char *image = read_pgm(filename, &width, &height, &max); if (image == NULL) { printf("Error loading %s", filename); exit(1); } Pa_Initialize(); context_init(&context, height, freq_min, freq_max, col_time_ms); start_playback(&context); for (int col = 0; col < width; col++) { for (int row = 0; row < height; row++) { buf[height - 1 - row] = image[row*width + col]; } print_image_column(&context, buf, height, max); } stop_playback(&context); Pa_Terminate(); context_dealloc(&context); }
static void opensles_stop_playback(ALCdevice *pDevice) { LOGV("opensles_stop_playback device=%p", pDevice); stop_playback(pDevice); }
static void dbus_stop_handler(struct con_win *cwin) { stop_playback(cwin); }
/* FIXME: Cleanup track refs */ void common_cleanup(struct con_win *cwin) { CDEBUG(DBG_INFO, "Cleaning up"); if ((cwin->cstate->state == ST_STOPPED) && (cwin->cstate->curr_mobj_clear)) delete_musicobject(cwin->cstate->curr_mobj); if ((cwin->cstate->state == ST_PLAYING) || (cwin->cstate->state == ST_PAUSED)) stop_playback(cwin); save_preferences(cwin); g_object_unref(cwin->library_store); g_object_unref(cwin->pixbuf->image_play); g_object_unref(cwin->pixbuf->image_pause); if (cwin->pixbuf->pixbuf_app) g_object_unref(cwin->pixbuf->pixbuf_app); if (cwin->pixbuf->pixbuf_dir) g_object_unref(cwin->pixbuf->pixbuf_dir); if (cwin->pixbuf->pixbuf_artist) g_object_unref(cwin->pixbuf->pixbuf_artist); if (cwin->pixbuf->pixbuf_album) g_object_unref(cwin->pixbuf->pixbuf_album); if (cwin->pixbuf->pixbuf_track) g_object_unref(cwin->pixbuf->pixbuf_track); if (cwin->pixbuf->pixbuf_genre) g_object_unref(cwin->pixbuf->pixbuf_genre); g_slice_free(struct pixbuf, cwin->pixbuf); if (cwin->album_art) gtk_widget_destroy(cwin->album_art); if (cwin->cstate->cdda_drive) cdio_cddap_close(cwin->cstate->cdda_drive); if (cwin->cstate->cddb_disc) cddb_disc_destroy(cwin->cstate->cddb_disc); if (cwin->cstate->cddb_conn) { cddb_destroy(cwin->cstate->cddb_conn); libcddb_shutdown(); } g_free(cwin->cpref->lw.lastfm_user); g_free(cwin->cpref->lw.lastfm_pass); #ifdef HAVE_LIBGLYR g_free(cwin->cpref->cache_folder); #endif g_free(cwin->cpref->configrc_file); g_free(cwin->cpref->installed_version); g_free(cwin->cpref->audio_sink); g_free(cwin->cpref->audio_alsa_device); g_free(cwin->cpref->audio_oss_device); g_free(cwin->cpref->album_art_pattern); g_free(cwin->cpref->audio_cd_device); g_free(cwin->cpref->start_mode); g_free(cwin->cpref->sidebar_pane); g_key_file_free(cwin->cpref->configrc_keyfile); free_str_list(cwin->cpref->library_dir); free_str_list(cwin->cpref->lib_add); free_str_list(cwin->cpref->lib_delete); free_str_list(cwin->cpref->library_tree_nodes); free_str_list(cwin->cpref->playlist_columns); g_slist_free(cwin->cpref->playlist_column_widths); g_slice_free(struct con_pref, cwin->cpref); g_rand_free(cwin->cstate->rand); g_free(cwin->cstate->last_folder); g_mutex_free(cwin->cstate->c_mutex); /* Hack, hack */ if (g_mutex_trylock(cwin->cstate->l_mutex) == TRUE) { g_mutex_unlock(cwin->cstate->l_mutex); g_mutex_free(cwin->cstate->l_mutex); } g_cond_free(cwin->cstate->c_cond); g_slice_free(struct con_state, cwin->cstate); #ifdef HAVE_LIBGLYR uninit_glyr_related (cwin); #endif g_free(cwin->cdbase->db_file); sqlite3_close(cwin->cdbase->db); g_slice_free(struct con_dbase, cwin->cdbase); if (cwin->cstate->audio_init && cwin->cmixer) cwin->cmixer->deinit_mixer(cwin); if (cwin->clibao->ao_dev) { CDEBUG(DBG_INFO, "Freeing ao dev"); ao_close(cwin->clibao->ao_dev); } ao_shutdown(); g_slice_free(struct con_mixer, cwin->cmixer); g_slice_free(struct con_libao, cwin->clibao); g_free(cwin->clastfm->session_id); g_free(cwin->clastfm->submission_url); if (cwin->clastfm->curl_handle) curl_easy_cleanup(cwin->clastfm->curl_handle); curl_global_cleanup(); g_slice_free(struct con_lastfm, cwin->clastfm); dbus_connection_remove_filter(cwin->con_dbus, dbus_filter_handler, cwin); dbus_bus_remove_match(cwin->con_dbus, "type='signal',path='/org/pragha/DBus'", NULL); dbus_connection_unref(cwin->con_dbus); #if HAVE_GLIB_2_26 mpris_cleanup(cwin); #endif if (notify_is_initted()) notify_uninit(); #ifdef HAVE_LIBKEYBINDER keybinder_unbind("XF86AudioPlay", (KeybinderHandler) keybind_play_handler); keybinder_unbind("XF86AudioStop", (KeybinderHandler) keybind_stop_handler); keybinder_unbind("XF86AudioPrev", (KeybinderHandler) keybind_prev_handler); keybinder_unbind("XF86AudioNext", (KeybinderHandler) keybind_next_handler); keybinder_unbind("XF86AudioMedia", (KeybinderHandler) keybind_media_handler); #endif g_option_context_free(cwin->cmd_context); g_slice_free(struct con_win, cwin); }
GThread* start_playback(struct musicobject *mobj, struct con_win *cwin) { GThread *thread = NULL; GError *error = NULL; if (!mobj) { g_critical("Dangling entry in current playlist"); return NULL; } if (!cwin->cstate->audio_init) { g_idle_add(dialog_audio_init, cwin); return NULL; } if ((cwin->cstate->state == ST_PLAYING) || (cwin->cstate->state == ST_PAUSED)) { stop_playback(cwin); } cwin->cstate->curr_mobj = mobj; cwin->cstate->cmd = 0; cwin->cstate->curr_mobj_clear = FALSE; switch(mobj->file_type) { case FILE_WAV: thread = g_thread_create(play_thread_wav, cwin, TRUE, &error); break; case FILE_MP3: thread = g_thread_create(play_thread_mp3, cwin, TRUE, &error); break; case FILE_FLAC: thread = g_thread_create(play_thread_flac, cwin, TRUE, &error); break; case FILE_OGGVORBIS: thread = g_thread_create(play_thread_oggvorbis, cwin, TRUE, &error); break; case FILE_MODPLUG: thread = g_thread_create(play_thread_modplug, cwin, TRUE, &error); break; case FILE_CDDA: thread = g_thread_create(play_thread_cdda, cwin, TRUE, &error); break; default: g_warning("Unknown file type"); } if (error) { g_critical("Unable to create playback thread : %s", error->message); return NULL; } else { cwin->cstate->state = ST_PLAYING; play_button_toggle_state(cwin); #ifdef HAVE_LIBGLYR update_related_state(cwin); #endif CDEBUG(DBG_INFO, "Starting playback"); return thread; } }