int set_media_info(play_para_t *p_para) { int ret = -1; media_info_init(&p_para->media_info); ret = set_stream_info(p_para); if (ret < 0) { log_error("[set_media_info]set_stream_info failed! ret=%d\n", ret); } ret = set_vstream_info(p_para); if (ret < 0) { log_error("[set_media_info]set_vstream_info failed! ret=%d\n", ret); } ret = set_astream_info(p_para); if (ret < 0) { log_error("[set_media_info]set_astream_info failed ret=%d!\n", ret); } ret = set_sstream_info(p_para); if (ret < 0) { log_error("[set_media_info]set_sstream_info failed ret=%d!\n", ret); } return 0; }
static void ldh_op_fuck(void *data, void *user_data) { tp_block *tb = (tp_block*)data; int32_t err; media_info msi; ldh_src *ldh = (ldh_src*)tb->hs; BUG_ON(!ldh); switch (tb->action) { case PROBE: media_info_init(&msi); err = __ldh_src_probe(ldh, &tb->mrl, &msi); media_src_fill_info((media_src*)ldh, &msi, err); media_info_clear(&msi); break; case OPEN: AQUIRE_LOCK(ldh->ldh_lock); err = __ldh_src_open(ldh, &tb->mrl); RELEASE_LOCK(ldh->ldh_lock); media_src_open_end((media_src*)ldh, err); break; case PLAY: AQUIRE_LOCK(ldh->ldh_lock); __ldh_src_play(ldh); RELEASE_LOCK(ldh->ldh_lock); break; case PAUSE: AQUIRE_LOCK(ldh->ldh_lock); __ldh_src_pause(ldh); RELEASE_LOCK(ldh->ldh_lock); break; case SEEK: AQUIRE_LOCK(ldh->ldh_lock); __ldh_src_lseek(ldh, tb->ts); RELEASE_LOCK(ldh->ldh_lock); break; case KILL: AQUIRE_LOCK(ldh->ldh_lock); __ldh_src_kill(ldh); RELEASE_LOCK(ldh->ldh_lock); break; case READ: AQUIRE_LOCK(ldh->ldh_lock); __ldh_src_read_ahead(ldh); RELEASE_LOCK(ldh->ldh_lock); break; } media_src_unref((media_src*)ldh); tr_free(tb, sizeof(*tb)); }
static void ldl_op_fuck(void *data, void *user_data) { int32_t err; media_info msi; tp_block *tb = (tp_block*)data; ldl_src *ldl = (ldl_src*)tb->ls; switch (tb->action) { case ACTION_PROBE: media_info_init(&msi); err = __ldl_src_probe(ldl, &tb->mrl, &msi); media_src_fill_info((media_src*)ldl, &msi, err); media_info_clear(&msi); #ifdef DEVICE_INTERFACE_TEST void ldl_interfaces_test(media_uri *mrl); ldl_interfaces_test(&tb->mrl); #endif break; case ACTION_OPEN: AQUIRE_LOCK(ldl->ldl_lock); err = __ldl_src_open(ldl, &tb->mrl); RELEASE_LOCK(ldl->ldl_lock); media_src_open_end((media_src*)ldl, err); break; case ACTION_PLAY: AQUIRE_LOCK(ldl->ldl_lock); __ldl_src_play(ldl); RELEASE_LOCK(ldl->ldl_lock); break; case ACTION_CTRL: AQUIRE_LOCK(ldl->ldl_lock); __ldl_src_ctrl(ldl, 1, NULL); RELEASE_LOCK(ldl->ldl_lock); break; case ACTION_CLOSE: AQUIRE_LOCK(ldl->ldl_lock); __ldl_src_kill(ldl); RELEASE_LOCK(ldl->ldl_lock); break; default: break; } media_src_unref((media_src*)ldl); tr_free(tb, sizeof(*tb)); }
void ldl_interfaces_test(media_uri *mrl) { ldl_src *ldl; int32_t err; media_info msi; for (;;) { ldl = ldl_src_alloc(NULL); media_info_init(&msi); err = __ldl_src_probe(ldl, mrl, &msi); media_info_clear(&msi); if (err) { LOG_W( "ldl_interfaces_test()->__ldl_src_probe() failed, err:'%d'", err ); goto test_failed; } err = __ldl_src_open(ldl, mrl); if (err) { LOG_W( "ldl_interfaces_test()->__ldl_src_open() failed, err:'%d'", err ); goto test_failed; } __ldl_src_play(ldl); usleep(100*1000); __ldl_src_ctrl(ldl, 1, NULL); usleep(1000*1000); __ldl_src_kill(ldl); test_failed: media_src_kill_unref((media_src*)ldl); usleep(2000*1000); } }