Skip to content

Commit

Permalink
update osd logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Mar 4, 2024
1 parent 48833bc commit e39c31f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 20 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# prudynt-t

**prudynt-t** is a video server based on the **[prudynt-v3](https://git.i386.io/wyze/prudynt-v3)** project originally for the Wyzecam v3. It extends the functionality of the original project while expanding compatibility with modern Ingenic hardware.

## Features

- **Video Compression**: Supports both H264 and H265 codecs for efficient video compression and streaming.
- **Expanded Configuration**: Integrated support for **[libimp_control](https://github.com/gtxaspec/libimp_control)**.
- **Thingino Integration**: Seamlessly integrates with **[thingino](https://github.com/themactep/thingino-firmware)**, enhancing connectivity and control options.

## Contributing

Contributions to prudynt-t are welcome! If you have improvements, bug fixes, or new features, please feel free to submit a pull request or open an issue.
63 changes: 43 additions & 20 deletions src/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,47 @@ bool Encoder::init() {
return true;
}

ret = osd.init();
if (ret) {
LOG_ERROR("OSD Init Failed");
return true;
}
if (Config::singleton()->OSDEnabled == 0) {
// If OSD is not enabled, initialize without OSD and bind FrameSource directly to Encoder
ret = osd.init();
if (ret) {
LOG_ERROR("OSD Init Failed");
return true;
}

IMPCell fs = { DEV_ID_FS, 0, 0 };
IMPCell enc = { DEV_ID_ENC, 0, 0 };
// Framesource -> ENC
ret = IMP_System_Bind(&fs, &enc);
if (ret < 0) {
LOG_ERROR("IMP_System_Bind(FS, ENC) == " << ret);
return true;
}

} else {
// If OSD is enabled, initialize OSD and bind FrameSource to OSD, then OSD to Encoder
ret = osd.init();
if (ret) {
LOG_ERROR("OSD Init Failed");
return true;
}

IMPCell fs = { DEV_ID_FS, 0, 0 };
IMPCell osd_cell = { DEV_ID_OSD, 0, 0 };
IMPCell enc = { DEV_ID_ENC, 0, 0 };
// Framesource -> OSD
ret = IMP_System_Bind(&fs, &osd_cell);
if (ret < 0) {
LOG_ERROR("IMP_System_Bind(FS, OSD) == " << ret);
return true;
}
// OSD -> Encoder
ret = IMP_System_Bind(&osd_cell, &enc);
if (ret < 0) {
LOG_ERROR("IMP_System_Bind(OSD, ENC) == " << ret);
return true;
}

IMPCell fs = { DEV_ID_FS, 0, 0 };
IMPCell osd_cell = { DEV_ID_OSD, 0, 0 };
IMPCell enc = { DEV_ID_ENC, 0, 0 };
//Framesource -> OSD
ret = IMP_System_Bind(&fs, &osd_cell);
if (ret < 0) {
LOG_ERROR("IMP_System_Bind(FS, OSD) == " << ret);
return true;
}
//OSD -> Encoder
ret = IMP_System_Bind(&osd_cell, &enc);
if (ret < 0) {
LOG_ERROR("IMP_System_Bind(OSD, ENC) == " << ret);
return true;
}

ret = IMP_FrameSource_EnableChn(0);
Expand Down Expand Up @@ -194,7 +215,9 @@ void Encoder::run() {
}
}
}
osd.update();
if (Config::singleton()->OSDEnabled == 1) {
osd.update();
}
IMP_Encoder_ReleaseStream(0, &stream);
last_nal_ts = nal_ts;
std::this_thread::yield();
Expand Down

0 comments on commit e39c31f

Please sign in to comment.