Beispiel #1
0
static void set_gpu_converted_data(struct obs_core_video *video,
		struct video_frame *output, const struct video_data *input,
		const struct video_output_info *info)
{
	if (input->linesize[0] == video->output_width*4) {
		struct video_frame frame;

		for (size_t i = 0; i < 3; i++) {
			if (video->plane_linewidth[i] == 0)
				break;

			frame.linesize[i] = video->plane_linewidth[i];
			frame.data[i] =
				input->data[0] + video->plane_offsets[i];
		}

		video_frame_copy(output, &frame, info->format, info->height);

	} else if (video->using_nv12_tex) {
		int width = (int)info->width;
		int height = (int)info->height;
		int width_d2 = width / 2;
		int height_d2 = height / 2;
		int height_d4 = height_d2 / 2;
		uint8_t *out_y = output->data[0];
		uint8_t *out_uv = output->data[1];
		uint8_t *in = input->data[0];

		for (size_t y = 0; y < height; y++) {
			memcpy(out_y, in, width);
			out_y += output->linesize[0];
			in += input->linesize[0];
		}
		for (size_t y = 0; y < height_d2; y++) {
			memcpy(out_uv, in, width);
			out_uv += output->linesize[0];
			in += input->linesize[0];
		}

	} else {
		fix_gpu_converted_alignment(video, output, input);
	}
}
Beispiel #2
0
void * startVideoEncoding() {
    int bufferIndex = 0;
    //int elapsedTime = 0;
    //int frames = 0;
    ftime(&startTime);

    while( stopRecording == 0) {
        bufferIndex = video_frame_copy();
        video_frame_display( bufferIndex );
        video_frame_compress( bufferIndex );
        if(streaming == 1)
            video_frame_queue();
        /*frames++;
        ftime(&currentTime);
        elapsedTime =  ((currentTime.time-startTime.time) * 1000 ) + ((currentTime.millitm-startTime.millitm) );
        framesps = (float)elapsedTime / 1000;*/
    }
    //printf("frames: %d\n", frames);
    //printf("time ms: %d\n", elapsedTime);
    pthread_exit(NULL);
}
Beispiel #3
0
static void set_gpu_converted_data(struct obs_core_video *video,
		struct video_frame *output, const struct video_data *input,
		const struct video_output_info *info)
{
	if (input->linesize[0] == video->output_width*4) {
		struct video_frame frame;

		for (size_t i = 0; i < 3; i++) {
			if (video->plane_linewidth[i] == 0)
				break;

			frame.linesize[i] = video->plane_linewidth[i];
			frame.data[i] =
				input->data[0] + video->plane_offsets[i];
		}

		video_frame_copy(output, &frame, info->format, info->height);

	} else {
		fix_gpu_converted_alignment(video, output, input);
	}
}