@@ -40,7 +40,7 @@ int32_t main(int32_t argc, char **argv) {
40
40
std::cerr << " Usage: " << argv[0 ] << " --cid=<OpenDaVINCI session> --name=<name of shared memory area> --width=<width> --height=<height> [--gop=<GOP>] [--bitrate=<bitrate>] [--verbose] [--id=<identifier in case of multiple instances]" << std::endl;
41
41
std::cerr << " --vp8: use VP8 encoder" << std::endl;
42
42
std::cerr << " --vp9: use VP9 encoder" << std::endl;
43
- std::cerr << " --cid: CID of the OD4Session to send h264 frames" << std::endl;
43
+ std::cerr << " --cid: CID of the OD4Session to send VP8 or VP9 frames" << std::endl;
44
44
std::cerr << " --id: when using several instances, this identifier is used as senderStamp" << std::endl;
45
45
std::cerr << " --name: name of the shared memory area to attach" << std::endl;
46
46
std::cerr << " --width: width of the frame" << std::endl;
@@ -67,22 +67,22 @@ int32_t main(int32_t argc, char **argv) {
67
67
68
68
std::unique_ptr<cluon::SharedMemory> sharedMemory (new cluon::SharedMemory{NAME});
69
69
if (sharedMemory && sharedMemory->valid ()) {
70
- std::clog << argv[ 0 ] << " : Attached to '" << sharedMemory->name () << " ' (" << sharedMemory->size () << " bytes)." << std::endl;
70
+ std::clog << " [opendlv-video-vpx-encoder] : Attached to '" << sharedMemory->name () << " ' (" << sharedMemory->size () << " bytes)." << std::endl;
71
71
72
72
vpx_codec_iface_t *encoderAlgorithm{(VP8 ? &vpx_codec_vp8_cx_algo : &vpx_codec_vp9_cx_algo)};
73
73
74
74
vpx_image_t yuvFrame;
75
75
memset (&yuvFrame, 0 , sizeof (yuvFrame));
76
76
if (!vpx_img_alloc (&yuvFrame, VPX_IMG_FMT_I420, WIDTH, HEIGHT, 1 )) {
77
- std::cerr << argv[ 0 ] << " : Failed to allocate image." << std::endl;
77
+ std::cerr << " [opendlv-video-vpx-encoder] : Failed to allocate image." << std::endl;
78
78
return retCode;
79
79
}
80
80
81
81
struct vpx_codec_enc_cfg parameters;
82
82
memset (¶meters, 0 , sizeof (parameters));
83
83
vpx_codec_err_t result = vpx_codec_enc_config_default (encoderAlgorithm, ¶meters, 0 );
84
84
if (result) {
85
- std::cerr << argv[ 0 ] << " : Failed to get default configuration: " << vpx_codec_err_to_string (result) << std::endl;
85
+ std::cerr << " [opendlv-video-vpx-encoder] : Failed to get default configuration: " << vpx_codec_err_to_string (result) << std::endl;
86
86
return retCode;
87
87
}
88
88
@@ -106,11 +106,11 @@ int32_t main(int32_t argc, char **argv) {
106
106
memset (&codec, 0 , sizeof (codec));
107
107
result = vpx_codec_enc_init (&codec, encoderAlgorithm, ¶meters, 0 );
108
108
if (result) {
109
- std::cerr << argv[ 0 ] << " : Failed to initialize encoder: " << vpx_codec_err_to_string (result) << std::endl;
109
+ std::cerr << " [opendlv-video-vpx-encoder] : Failed to initialize encoder: " << vpx_codec_err_to_string (result) << std::endl;
110
110
return retCode;
111
111
}
112
112
else {
113
- std::clog << argv[ 0 ] << " : Using " << vpx_codec_iface_name (encoderAlgorithm) << std::endl;
113
+ std::clog << " [opendlv-video-vpx-encoder] : Using " << vpx_codec_iface_name (encoderAlgorithm) << std::endl;
114
114
}
115
115
vpx_codec_control (&codec, VP8E_SET_CPUUSED, 4 );
116
116
@@ -149,7 +149,7 @@ int32_t main(int32_t argc, char **argv) {
149
149
int flags{ (0 == (frameCounter%GOP)) ? VPX_EFLAG_FORCE_KF : 0 };
150
150
result = vpx_codec_encode (&codec, &yuvFrame, frameCounter, 1 , flags, VPX_DL_REALTIME);
151
151
if (result) {
152
- std::cerr << argv[ 0 ] << " : Failed to encode frame: " << vpx_codec_err_to_string (result) << std::endl;
152
+ std::cerr << " [opendlv-video-vpx-encoder] : Failed to encode frame: " << vpx_codec_err_to_string (result) << std::endl;
153
153
}
154
154
if (VERBOSE) {
155
155
after = cluon::time::now ();
@@ -177,7 +177,7 @@ int32_t main(int32_t argc, char **argv) {
177
177
od4.send (ir, sampleTimeStamp, ID);
178
178
179
179
if (VERBOSE) {
180
- std::clog << argv[ 0 ] << " : Frame size = " << totalSize << " bytes; encoding took " << cluon::time::deltaInMicroseconds (after, before) << " microseconds." << std::endl;
180
+ std::clog << " [opendlv-video-vpx-encoder] : Frame size = " << totalSize << " bytes; encoding took " << cluon::time::deltaInMicroseconds (after, before) << " microseconds." << std::endl;
181
181
}
182
182
frameCounter++;
183
183
}
@@ -189,7 +189,7 @@ int32_t main(int32_t argc, char **argv) {
189
189
retCode = 0 ;
190
190
}
191
191
else {
192
- std::cerr << argv[ 0 ] << " : Failed to attach to shared memory '" << NAME << " '." << std::endl;
192
+ std::cerr << " [opendlv-video-vpx-encoder] : Failed to attach to shared memory '" << NAME << " '." << std::endl;
193
193
}
194
194
}
195
195
return retCode;
0 commit comments