Skip to content

Commit d7a46ad

Browse files
committed
better examples
1 parent 8ebac50 commit d7a46ad

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

examples/desktop/0-print_camera_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ bool frame_callback(const CcapVideoFrame* frame, void* userData) {
1717

1818
CcapVideoFrameInfo frameInfo;
1919
if (ccap_video_frame_get_info(frame, &frameInfo)) {
20-
printf("Frame %d: %dx%d, format=%d, timestamp=%llu\n",
20+
printf("Frame %d: %dx%d, format=%d, timestamp=%d\n",
2121
frameCount, frameInfo.width, frameInfo.height,
22-
frameInfo.pixelFormat, frameInfo.timestamp);
22+
frameInfo.pixelFormat, (int)frameInfo.timestamp);
2323
}
2424

2525
// Return false to keep the frame available for grab()

examples/desktop/1-minimal_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ int main() {
2525
for (int i = 0; i < 10; ++i) {
2626
auto frame = cameraProvider.grab(3000);
2727
if (frame) {
28-
printf("VideoFrame %lld grabbed: width = %d, height = %d, bytes: %d, format: %s\n", frame->frameIndex, frame->width,
29-
frame->height, frame->sizeInBytes, ccap::pixelFormatToString(frame->pixelFormat).data());
28+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d, format: %s\n", (int)frame->frameIndex, frame->width,
29+
frame->height, (int)frame->sizeInBytes, ccap::pixelFormatToString(frame->pixelFormat).data());
3030
} else {
3131
std::cerr << "Failed to grab frame!" << std::endl;
3232
exit(-1);

examples/desktop/1-minimal_example_c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ int main() {
4949
char formatStr[64];
5050
ccap_pixel_format_to_string(frameInfo.pixelFormat, formatStr, sizeof(formatStr));
5151

52-
printf("VideoFrame %llu grabbed: width = %d, height = %d, bytes: %d, format: %s\n",
53-
frameInfo.frameIndex, frameInfo.width, frameInfo.height,
54-
frameInfo.sizeInBytes, formatStr);
52+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d, format: %s\n",
53+
(int)frameInfo.frameIndex, frameInfo.width, frameInfo.height,
54+
(int)frameInfo.sizeInBytes, formatStr);
5555
}
5656

5757
ccap_video_frame_release(frame);

examples/desktop/2-capture_grab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ int main(int argc, char** argv) {
7373

7474
/// 3000 ms timeout when grabbing frames
7575
while (auto frame = cameraProvider.grab(3000)) {
76-
printf("VideoFrame %lld grabbed: width = %d, height = %d, bytes: %d\n", frame->frameIndex, frame->width, frame->height,
77-
frame->sizeInBytes);
76+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d\n", (int)frame->frameIndex, frame->width, frame->height,
77+
(int)frame->sizeInBytes);
7878
if (auto dumpFile = ccap::dumpFrameToDirectory(frame.get(), captureDir); !dumpFile.empty()) {
7979
std::cout << "VideoFrame saved to: " << dumpFile << std::endl;
8080
} else {

examples/desktop/2-capture_grab_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ int main(int argc, char** argv) {
102102
if (frame) {
103103
CcapVideoFrameInfo frameInfo;
104104
if (ccap_video_frame_get_info(frame, &frameInfo)) {
105-
printf("VideoFrame %llu grabbed: width = %d, height = %d, bytes: %d\n",
106-
frameInfo.frameIndex, frameInfo.width, frameInfo.height, frameInfo.sizeInBytes);
105+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d\n",
106+
(int)frameInfo.frameIndex, frameInfo.width, frameInfo.height, (int)frameInfo.sizeInBytes);
107107

108108
// Save frame to directory
109109
char outputPath[2048];

examples/desktop/3-capture_callback.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ int main(int argc, char** argv) {
7878
requestedWidth, requestedHeight, realWidth, realHeight, requestedFps, realFps);
7979

8080
cameraProvider.setNewFrameCallback([=](const std::shared_ptr<ccap::VideoFrame>& frame) -> bool {
81-
printf("VideoFrame %lld grabbed: width = %d, height = %d, bytes: %d\n", frame->frameIndex, frame->width, frame->height,
82-
frame->sizeInBytes);
81+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d\n", (int)frame->frameIndex, frame->width, frame->height,
82+
(int)frame->sizeInBytes);
8383
if (auto dumpFile = ccap::dumpFrameToDirectory(frame.get(), captureDir); !dumpFile.empty()) {
8484
std::cout << "VideoFrame saved to: " << dumpFile << std::endl;
8585
} else {

examples/desktop/3-capture_callback_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ bool frame_callback(const CcapVideoFrame* frame, void* userData) {
3232

3333
CcapVideoFrameInfo frameInfo;
3434
if (ccap_video_frame_get_info(frame, &frameInfo)) {
35-
printf("VideoFrame %llu grabbed: width = %d, height = %d, bytes: %d\n",
36-
frameInfo.frameIndex, frameInfo.width, frameInfo.height, frameInfo.sizeInBytes);
35+
printf("VideoFrame %d grabbed: width = %d, height = %d, bytes: %d\n",
36+
(int)frameInfo.frameIndex, frameInfo.width, frameInfo.height, (int)frameInfo.sizeInBytes);
3737

3838
// Save frame to directory
3939
char outputPath[2048];

0 commit comments

Comments
 (0)