예제 #1
0
int main(int argc, char* argv[])
{
    if (argc < 2)
    {
        printf("%s <ip>\n", argv[0]);
        return 0;
    }

	tlog_init(TLOG_MODE_STDERR, TLOG_INFO, NULL);

	rcp_connect(argv[1]);

	start_message_manager();

	client_register(RCP_USER_LEVEL_LIVE, "", RCP_REGISTRATION_TYPE_NORMAL, RCP_ENCRYPTION_MODE_MD5);

	int preset_id = get_coder_preset(1);
	TL_INFO("preset id = %d", preset_id);
	preset_id = get_current_stream_profile(1, 1, &preset_id);
	TL_INFO("preset id = %d", preset_id);

	preset_set_default(1);

	rcp_mpeg4_preset preset;
    get_preset(1, &preset, 0);
    log_preset(TLOG_INFO, &preset, 0);

	strcpy(preset.name, "myConfig");
	preset.resolution = PRESET_RESOLUTION_4CIF;
	preset.field_mode = PRESET_FIELD_MODE_PROGRESSIVE;
	preset.bandwidth = 100000;
	preset.bandwidth_soft_limit = 100000;
	preset.video_quality = 1;
    preset.avc_gop_structure = 0;
    preset.averaging_period = 0;
    preset.iframe_distance = 31;
    preset.avc_pframe_qunatizer_min = 0;
    preset.avc_delta_ipquantizer = 5;

	set_preset(1, &preset, 0);

	get_preset(1, &preset, 0);
	log_preset(TLOG_INFO, &preset, 0);

	client_unregister();

	stop_message_manager();

	return 0;
}
예제 #2
0
extern int
main(int argc, char **argv)
{
	// Get the preset number from the command line.
	uint32_t preset = get_preset(argc, argv);

	// Initialize a lzma_stream structure. When it is allocated on stack,
	// it is simplest to use LZMA_STREAM_INIT macro like below. When it
	// is allocated on heap, using memset(strmptr, 0, sizeof(*strmptr))
	// works (as long as NULL pointers are represented with zero bits
	// as they are on practically all computers today).
	lzma_stream strm = LZMA_STREAM_INIT;

	// Initialize the encoder. If it succeeds, compress from
	// stdin to stdout.
	bool success = init_encoder(&strm, preset);
	if (success)
		success = compress(&strm, stdin, stdout);

	// Free the memory allocated for the encoder. If we were encoding
	// multiple files, this would only need to be done after the last
	// file. See 02_decompress.c for handling of multiple files.
	//
	// It is OK to call lzma_end() multiple times or when it hasn't been
	// actually used except initialized with LZMA_STREAM_INIT.
	lzma_end(&strm);

	// Close stdout to catch possible write errors that can occur
	// when pending data is flushed from the stdio buffers.
	if (fclose(stdout)) {
		fprintf(stderr, "Write error: %s\n", strerror(errno));
		success = false;
	}

	return success ? EXIT_SUCCESS : EXIT_FAILURE;
}
예제 #3
0
int main(int argc, char* argv[])
{
	tlog_init(TLOG_MODE_STDERR, TLOG_INFO, NULL);

	if (argc < 2)
	{
		TL_INFO("%s ip\n", argv[0]);
		return 0;
	}

	rcp_connect(argv[1]);

	start_event_handler();

	client_register(RCP_USER_LEVEL_LIVE, "", RCP_REGISTRATION_TYPE_NORMAL, RCP_ENCRYPTION_MODE_MD5);

	rcp_coder_list encoders;
	get_coder_list(RCP_CODER_DECODER, RCP_MEDIA_TYPE_VIDEO, &encoders, 2);

	int preset_id = get_coder_preset(8);
	rcp_mpeg4_preset preset;
	get_preset(preset_id, &preset, 1);
	log_preset(TLOG_INFO, &preset, 1);
	preset.resolution = RCP_VIDEO_RESOLUTION_4CIF;
	set_preset(preset_id, &preset, 1);
	log_preset(TLOG_INFO, &preset, 1);
/*
	for (int i=0; i<encoders.count; i++)
	{
		int mode;
		get_coder_video_operation_mode(encoders.coder[i].number, &mode);
		TL_INFO("video mode is %d", mode);
		TL_INFO("%x %x %x %x %x", encoders.coder[i].number, encoders.coder[i].caps, encoders.coder[i].current_cap, encoders.coder[i].param_caps, encoders.coder[i].current_param);
		log_coder(TLOG_INFO, &encoders.coder[i]);

		mode = (mode==1)?2:1;
		mode = set_coder_video_operation_mode(encoders.coder[i].number, mode);
		TL_INFO("video mode is %d", mode);
		TL_INFO("-----------------------");
	}

	get_coder_list(RCP_CODER_ENCODER, RCP_MEDIA_TYPE_VIDEO, &encoders, 1);
	for (int i=0; i<encoders.count; i++)
	{
		int mode;
		get_coder_video_operation_mode(encoders.coder[i].number, &mode);
		TL_INFO("video mode is %d", mode);
		TL_INFO("%x %x %x %x %x", encoders.coder[i].number, encoders.coder[i].caps, encoders.coder[i].current_cap, encoders.coder[i].param_caps, encoders.coder[i].current_param);
		log_coder(TLOG_INFO, &encoders.coder[i]);

		mode = (mode==1)?2:1;
		mode = set_coder_video_operation_mode(encoders.coder[i].number, mode);
		TL_INFO("video mode is %d", mode);
		TL_INFO("-----------------------");
	}


	get_coder_list(RCP_CODER_DECODER, RCP_MEDIA_TYPE_AUDIO, &encoders, 1);
	for (int i=0; i<encoders.count; i++)
	{
		TL_INFO("%x %x %x %x %x", encoders.coder[i].number, encoders.coder[i].caps, encoders.coder[i].current_cap, encoders.coder[i].param_caps, encoders.coder[i].current_param);
		log_coder(TLOG_INFO, &encoders.coder[i]);
		TL_INFO("-----------------------");
	}
*/

	stop_event_handler();

	return 0;
}