EXPORT int duplicate_stream(void *actx,enum DuplicateFormat format) { int ret = 0; struct liveStream *ctx = (struct liveStream *)actx; if(!ctx) return -1; av_bprint_init(&ctx->graph_desc, 0, 1); if(format == SIDE_BY_SIDE) av_bprintf(&ctx->graph_desc, "[0]format=yuv420p,scale=iw/2:ih,pad=iw*2:ih[main];[main]split[dup1][dup2];[dup1][dup2]overlay=W/2:0[bg]"); else if ( format == TOP_N_BOTTOM) av_bprintf(&ctx->graph_desc, "[0]format=yuv420p,scale=iw:ih/2,pad=iw:ih*2[main];[main]split[dup1][dup2];[dup1][dup2]overlay=0:H/2[bg]"); else { av_log(NULL,AV_LOG_ERROR,"Invalid format Speified only side_by_side and top_n_bottom supported\n"); return -1; } ret = configure_filter(ctx); if(ret < 0) { av_log(NULL,AV_LOG_ERROR,"Unable to configure Filter\n"); return ret; } return ret; }
EXPORT int pause_stream(void *actx, long long duration) { int ret = 0; struct liveStream *ctx = (struct liveStream *)actx; if(!ctx) return -1; av_bprintf(&ctx->graph_desc, ";color=black:duration=%lld:s=%dx%d[onit];[bg][onit]overlay=eof_action=pass",duration, STREAM_WIDTH, STREAM_HEIGHT); ret = configure_filter(ctx); if(ret < 0) { av_log(NULL,AV_LOG_ERROR,"Unable to configure Filter\n"); return -1; } return 0; }
int init_filters(struct liveStream *ctx) { int ret = 0; if (sem_init(&ctx->filter_lock, 0, 1) == -1) { av_log(NULL,AV_LOG_ERROR,"Unable to init filter locks\n"); } av_bprint_init(&ctx->graph_desc, 0, 1); av_bprintf(&ctx->graph_desc, "[0]format=yuv420p,scale=%d:%d[bg]",STREAM_WIDTH,STREAM_HEIGHT); ret = configure_filter(ctx); if(ret < 0) { printf("unable to configure filter\n"); } return 0; }
EXPORT int duplicate_overlayed_stream(void *actx,int xpos, int ypos, int height, int width) { int ret = 0; struct liveStream *ctx = (struct liveStream *)actx; if(!ctx) return -1; av_bprint_init(&ctx->graph_desc, 0, 1); av_bprintf(&ctx->graph_desc, "[0]format=yuv420p,scale=iw:ih,split[dup1][dup2];" "[dup2]scale=%d:%d[scaled_dup2];" "[dup1][scaled_dup2]overlay=%d:%d[bg]", width, height, xpos, ypos); ret = configure_filter(ctx); if(ret < 0) { av_log(NULL,AV_LOG_ERROR,"Unable to configure Filter\n"); return ret; } return ret; }
/** * only one image can be set to be overlayed */ EXPORT int set_image(void *actx,const char*path, int xpos,int ypos,int height, int width) { int ret = 0; struct inputCfg cfg = { IN_IMAGE, 1}; struct liveStream *ctx = (struct liveStream *)actx; if(!ctx) return -1; ret = configure_input(ctx, path, &cfg); if(ret < 0) { return ret; } av_bprintf(&ctx->graph_desc, ";[1]format=yuv420p,scale=%d:%d[onit];[bg][onit]overlay=%d:%d",height,width,xpos,ypos); ret = configure_filter(ctx); if(ret < 0) { return ret; } return ret; }
void usb_sound_device::device_start() { g80_filter_state temp; int tchan, tgroup; /* find the CPU we are associated with */ m_maincpu = machine().device("maincpu"); assert(m_maincpu != NULL); /* create a sound stream */ m_stream = machine().sound().stream_alloc(*this, 0, 1, SAMPLE_RATE); /* initialize state */ m_noise_shift = 0x15555; for (tgroup = 0; tgroup < 3; tgroup++) { timer8253 *g = &m_timer_group[tgroup]; configure_filter(&g->chan_filter[0], 10e3, 1e-6); configure_filter(&g->chan_filter[1], 10e3, 1e-6); configure_filter(&g->gate1, 100e3, 0.01e-6); configure_filter(&g->gate2, 2 * 100e3, 0.01e-6); } configure_filter(&temp, 100e3, 0.01e-6); m_gate_rc1_exp[0] = temp.exponent; configure_filter(&temp, 1e3, 0.01e-6); m_gate_rc1_exp[1] = temp.exponent; configure_filter(&temp, 2 * 100e3, 0.01e-6); m_gate_rc2_exp[0] = temp.exponent; configure_filter(&temp, 2 * 1e3, 0.01e-6); m_gate_rc2_exp[1] = temp.exponent; configure_filter(&m_noise_filters[0], 2.7e3 + 2.7e3, 1.0e-6); configure_filter(&m_noise_filters[1], 2.7e3 + 1e3, 0.30e-6); configure_filter(&m_noise_filters[2], 2.7e3 + 270, 0.15e-6); configure_filter(&m_noise_filters[3], 2.7e3 + 0, 0.082e-6); configure_filter(&m_noise_filters[4], 33e3, 0.1e-6); configure_filter(&m_final_filter, 100e3, 4.7e-6); /* register for save states */ save_item(NAME(m_in_latch)); save_item(NAME(m_out_latch)); save_item(NAME(m_last_p2_value)); save_item(NAME(m_work_ram_bank)); save_item(NAME(m_t1_clock)); for (tgroup = 0; tgroup < 3; tgroup++) { timer8253 *group = &m_timer_group[tgroup]; for (tchan = 0; tchan < 3; tchan++) { timer8253_channel *channel = &group->chan[tchan]; save_item(NAME(channel->holding), tgroup * 3 + tchan); save_item(NAME(channel->latchmode), tgroup * 3 + tchan); save_item(NAME(channel->latchtoggle), tgroup * 3 + tchan); save_item(NAME(channel->clockmode), tgroup * 3 + tchan); save_item(NAME(channel->bcdmode), tgroup * 3 + tchan); save_item(NAME(channel->output), tgroup * 3 + tchan); save_item(NAME(channel->lastgate), tgroup * 3 + tchan); save_item(NAME(channel->gate), tgroup * 3 + tchan); save_item(NAME(channel->subcount), tgroup * 3 + tchan); save_item(NAME(channel->count), tgroup * 3 + tchan); save_item(NAME(channel->remain), tgroup * 3 + tchan); } save_item(NAME(group->env), tgroup); save_item(NAME(group->chan_filter[0].capval), tgroup); save_item(NAME(group->chan_filter[1].capval), tgroup); save_item(NAME(group->gate1.capval), tgroup); save_item(NAME(group->gate2.capval), tgroup); save_item(NAME(group->config), tgroup); } save_item(NAME(m_timer_mode)); save_item(NAME(m_noise_shift)); save_item(NAME(m_noise_state)); save_item(NAME(m_noise_subcount)); save_item(NAME(m_final_filter.capval)); save_item(NAME(m_noise_filters[0].capval)); save_item(NAME(m_noise_filters[1].capval)); save_item(NAME(m_noise_filters[2].capval)); save_item(NAME(m_noise_filters[3].capval)); save_item(NAME(m_noise_filters[4].capval)); }