Skip to content

Commit

Permalink
make DecklinkOutput a bit smarter regarding pixel formats
Browse files Browse the repository at this point in the history
  • Loading branch information
asquared committed Nov 27, 2010
1 parent ebd55d9 commit 9fe5835
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion core/output_adapter.h
Expand Up @@ -131,6 +131,14 @@ class DecklinkOutput : public OutputAdapter,
unsigned char *data_ptr;
int i;

Picture *convert;

if (in_frame->pix_fmt != UYVY8) {
convert = in_frame->convert_to_format(UYVY8);
} else {
convert = in_frame;
}

if (free_frames.empty( )) {
throw std::runtime_error("Can't set next frame when no frames free!");
}
Expand All @@ -143,11 +151,15 @@ class DecklinkOutput : public OutputAdapter,
int blit_max_h = (in_frame->h < 480) ? in_frame->h : 480;

for (i = 0; i < blit_max_h; ++i) {
memcpy(data_ptr + 1440*i, in_frame->data + in_frame->line_pitch*i, 2*blit_max_w);
memcpy(data_ptr + 1440*i, convert->data + convert->line_pitch*i, 2*blit_max_w);
}

ready_frames.push_back(frame);

if (convert != in_frame) {
Picture::free(convert);
}

}

bool ReadyForNextFrame(void) {
Expand Down

0 comments on commit 9fe5835

Please sign in to comment.