Skip to content

Commit 3c249fb

Browse files
Mr-DaveDevMr-Dave
authored andcommitted
Logging messages
Closes #861
1 parent 3955c75 commit 3c249fb

3 files changed

Lines changed: 104 additions & 9 deletions

File tree

motion.c

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,6 +3132,65 @@ static void motion_camera_ids(void){
31323132
}
31333133
}
31343134

3135+
static void motion_ntc(void){
3136+
3137+
#ifdef HAVE_V4L2
3138+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available"));
3139+
#else
3140+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : not available"));
3141+
#endif
3142+
3143+
#ifdef HAVE_BKTR
3144+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("bktr : available"));
3145+
#else
3146+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("bktr : not available"));
3147+
#endif
3148+
3149+
#ifdef HAVE_WEBP
3150+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : available"));
3151+
#else
3152+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : not available"));
3153+
#endif
3154+
3155+
#ifdef HAVE_MMAL
3156+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mmal : available"));
3157+
#else
3158+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mmal : not available"));
3159+
#endif
3160+
3161+
#ifdef HAVE_FFMPEG
3162+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("ffmpeg : available"));
3163+
#else
3164+
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("ffmpeg : not available"));
3165+
#endif
3166+
3167+
#ifdef HAVE_MYSQL
3168+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("mysql : available"));
3169+
#else
3170+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("mysql : not available"));
3171+
#endif
3172+
3173+
#ifdef HAVE_SQLITE3
3174+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("sqlite3: available"));
3175+
#else
3176+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("sqlite3: not available"));
3177+
#endif
3178+
3179+
#ifdef HAVE_PGSQL
3180+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("pgsql : available"));
3181+
#else
3182+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("pgsql : not available"));
3183+
#endif
3184+
3185+
#ifdef HAVE_INTL
3186+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("nls : available"));
3187+
#else
3188+
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("nls : not available"));
3189+
#endif
3190+
3191+
3192+
}
3193+
31353194

31363195
/**
31373196
* motion_startup
@@ -3224,6 +3283,8 @@ static void motion_startup(int daemonize, int argc, char *argv[])
32243283

32253284
conf_output_parms(cnt_list);
32263285

3286+
motion_ntc();
3287+
32273288
motion_camera_ids();
32283289

32293290
initialize_chars();
@@ -3261,8 +3322,6 @@ static void motion_start_thread(struct context *cnt){
32613322
snprintf(service,6,"%s",cnt->conf.netcam_url);
32623323
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Camera ID: %d Camera Name: %s Service: %s")
32633324
,cnt->camera_id, cnt->conf.camera_name,service);
3264-
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Stream port %d"),
3265-
cnt->conf.stream_port);
32663325
} else {
32673326
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Camera ID: %d Camera Name: %s Device: %s")
32683327
,cnt->camera_id, cnt->conf.camera_name,cnt->conf.video_device);

webu.c

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,10 @@ static void webu_answer_strm_type(struct webui_ctx *webui) {
11471147
(strcmp(webui->uri_camid,"current") == 0)){
11481148
webui->cnct_type = WEBUI_CNCT_STATIC;
11491149

1150+
} else if ((strlen(webui->uri_camid) > 0) &&
1151+
(strlen(webui->uri_cmd1) == 0)){
1152+
webui->cnct_type = WEBUI_CNCT_FULL;
1153+
11501154
} else {
11511155
webui->cnct_type = WEBUI_CNCT_UNKNOWN;
11521156
}
@@ -1434,7 +1438,7 @@ static void webu_mhd_features_basic(struct mhdstart_ctx *mhdst){
14341438
int retcd;
14351439
retcd = MHD_is_feature_supported (MHD_FEATURE_BASIC_AUTH);
14361440
if (retcd == MHD_YES){
1437-
MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available"));
1441+
MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available"));
14381442
} else {
14391443
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_auth_method == 1)){
14401444
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled"));
@@ -1457,7 +1461,7 @@ static void webu_mhd_features_digest(struct mhdstart_ctx *mhdst){
14571461
int retcd;
14581462
retcd = MHD_is_feature_supported (MHD_FEATURE_DIGEST_AUTH);
14591463
if (retcd == MHD_YES){
1460-
MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available"));
1464+
MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available"));
14611465
} else {
14621466
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_auth_method == 2)){
14631467
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled"));
@@ -1486,9 +1490,9 @@ static void webu_mhd_features_ipv6(struct mhdstart_ctx *mhdst){
14861490
int retcd;
14871491
retcd = MHD_is_feature_supported (MHD_FEATURE_IPv6);
14881492
if (retcd == MHD_YES){
1489-
MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("IPV6: available"));
1493+
MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("IPV6: available"));
14901494
} else {
1491-
MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled"));
1495+
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled"));
14921496
if (mhdst->ipv6) mhdst->ipv6 = 0;
14931497
}
14941498
#endif
@@ -1511,7 +1515,7 @@ static void webu_mhd_features_tls(struct mhdstart_ctx *mhdst){
15111515
int retcd;
15121516
retcd = MHD_is_feature_supported (MHD_FEATURE_SSL);
15131517
if (retcd == MHD_YES){
1514-
MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available"));
1518+
MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available"));
15151519
} else {
15161520
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_tls)){
15171521
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled"));
@@ -1836,6 +1840,10 @@ static void webu_start_ctrl(struct context **cnt){
18361840
free(mhdst.mhd_ops);
18371841
if (cnt[0]->webcontrol_daemon == NULL){
18381842
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Unable to start MHD"));
1843+
} else {
1844+
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
1845+
,_("Started webcontrol on port %d")
1846+
,cnt[0]->conf.webcontrol_port);
18391847
}
18401848
}
18411849

@@ -1845,6 +1853,32 @@ static void webu_start_ctrl(struct context **cnt){
18451853
return;
18461854
}
18471855

1856+
static void webu_strm_ntc(struct context **cnt, int indxthrd){
1857+
int indx;
1858+
1859+
if (indxthrd == 0 ){
1860+
if (cnt[1] != NULL) {
1861+
indx = 1;
1862+
while (cnt[indx] != NULL){
1863+
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
1864+
,_("Started camera %d stream on port/camera_id %d/%d")
1865+
,cnt[indx]->camera_id
1866+
,cnt[indxthrd]->conf.stream_port
1867+
,cnt[indx]->camera_id);
1868+
indx++;
1869+
}
1870+
} else {
1871+
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
1872+
,_("Started camera %d stream on port %d")
1873+
,cnt[indxthrd]->camera_id,cnt[indxthrd]->conf.stream_port);
1874+
}
1875+
} else {
1876+
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
1877+
,_("Started camera %d stream on port %d")
1878+
,cnt[indxthrd]->camera_id,cnt[indxthrd]->conf.stream_port);
1879+
}
1880+
}
1881+
18481882
static void webu_start_strm(struct context **cnt){
18491883
/* This function starts up the daemon for the streams. It loops through
18501884
* all of the camera context's provided and starts streams as requested. If
@@ -1905,6 +1939,8 @@ static void webu_start_strm(struct context **cnt){
19051939
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
19061940
,_("Unable to start stream for camera %d")
19071941
,cnt[mhdst.indxthrd]->camera_id);
1942+
} else {
1943+
webu_strm_ntc(cnt,mhdst.indxthrd);
19081944
}
19091945
}
19101946
mhdst.indxthrd++;

webu_stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ int webu_stream_mjpeg(struct webui_ctx *webui) {
275275
return MHD_NO;
276276
}
277277

278-
if (webui->cnt->conf.webcontrol_cors_header != NULL){
278+
if (webui->cnt->conf.stream_cors_header != NULL){
279279
MHD_add_response_header (response, MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
280-
, webui->cnt->conf.webcontrol_cors_header);
280+
, webui->cnt->conf.stream_cors_header);
281281
}
282282

283283
MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE

0 commit comments

Comments
 (0)