RomaMokych / cxx-courses-2019-03-macos-streamer

coruses project
0 stars 0 forks source link

CGDisplayStream doesn't produce YCbCr 4:2:0 data #6

Closed TeaBoyy closed 5 years ago

TeaBoyy commented 5 years ago

Changing pixel_format from 'BGRA' to '420f'/'420v' and passing matrix parameters to streamer doesn't work (can't see any handler calls), so I can't apply YCbCr 4:2:0 -> format which produces only 1/4 or original image, but keeps it unchanged for human eye!

 keys[1] = (void *) kCGDisplayStreamYCbCrMatrix;
 values[1] = (void *) kCGDisplayStreamYCbCrMatrix_ITU_R_601_4;

 CFDictionaryRef opts = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 2, NULL, NULL);

 streamScreen = CGDisplayStreamCreateWithDispatchQueue(display,
                                                          output_width,
                                                          output_height,
                                                          pixel_format,
                                                          opts,         // Additional params
SiTiGi commented 5 years ago

Works just fine on Mac mini(Late 2012)