Skip to content

Commit

Permalink
updated config files
Browse files Browse the repository at this point in the history
  • Loading branch information
shortstheory committed Oct 29, 2020
1 parent 8be0bdb commit 60b12c3
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 30 deletions.
4 changes: 1 addition & 3 deletions config/MJPGCamera.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
camera: {
properties: {
launch_string = "v4l2src name=src device=%device ! capsfilter name=capsfilter caps=%capsfilter ! jpegdec ! videoconvert ! textoverlay name=textoverlay ! x264enc name=%encoder bitrate=%bitrate key-int-max = 10 threads = 4 tune = 4 intra-refresh = true ! tee name=tee_element tee_element. ! queue ! h264parse ! rtph264pay name=pay0";
launch_string = "v4l2src name=src device=%device ! capsfilter name=capsfilter caps=%capsfilter ! jpegdec ! videoconvert ! textoverlay name=textoverlay ! x264enc name=encoder bitrate=%bitrate key-int-max = 10 threads = 4 tune = 4 intra-refresh = true ! tee name=tee_element tee_element. ! queue ! h264parse ! rtph264pay name=pay0";
capsfilter = "image/jpeg,width=(int)%width,height=(int)%height,framerate=(fraction)%framerate/1";
mode = "encoder";
encoder_name = "x264enc";
supported_qualities = 511;
dynamic_res = true;
dynamic_bitrate = true;
Expand Down
2 changes: 0 additions & 2 deletions config/RPiCamera.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ camera: {
properties: {
launch_string = "v4l2src name=src device=%device ! queue ! capsfilter name=capsfilter caps=%capsfilter ! tee name=tee_element tee_element. ! queue ! h264parse ! rtph264pay name=pay0";
capsfilter = "video/x-h264,width=(int)%width,height=(int)%height,framerate=(fraction)%framerate/1";
mode = "encoder";
encoder_name = "omxh264enc";
supported_qualities = 511;
dynamic_res = true;
dynamic_bitrate = true;
Expand Down
4 changes: 1 addition & 3 deletions config/ZEDCamera.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
camera: {
properties: {
launch_string = "v4l2src name=src device=%device ! videoconvert ! capsfilter name=capsfilter caps=%capsfilter ! x264enc name=%encoder bitrate=%bitrate ! tee name=tee_element tee_element. ! queue ! h264parse ! rtph264pay name=pay0";
launch_string = "v4l2src name=src device=%device ! videoconvert ! capsfilter name=capsfilter caps=%capsfilter ! x264enc name=encoder bitrate=%bitrate ! tee name=tee_element tee_element. ! queue ! h264parse ! rtph264pay name=pay0";
capsfilter = "video/x-raw,format=(string)I420,width=(int)%width,height=(int)%height";
mode = "encoder";
encoder_name = "x264enc";
supported_qualities = 511;
dynamic_res = false;
dynamic_bitrate = true;
Expand Down
10 changes: 1 addition & 9 deletions src/Camera/MJPGCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MJPGCamera::MJPGCamera(string device, Quality q) : Camera(device, q), encoder(nu

bool MJPGCamera::set_element_references(GstElement *pipeline)
{
encoder = gst_bin_get_by_name(GST_BIN(pipeline), encoder_name.c_str());
encoder = gst_bin_get_by_name(GST_BIN(pipeline), "encoder");
capsfilter = gst_bin_get_by_name(GST_BIN(pipeline), "capsfilter");
if (encoder && capsfilter) {
return true;
Expand Down Expand Up @@ -137,12 +137,6 @@ bool MJPGCamera::set_quality(Quality q)
return true;
}

bool MJPGCamera::read_configuration(Setting &camera_config, Setting &quality_config)
{
encoder_name = static_cast<const char *>(camera_config.lookup("camera.properties.encoder_name"));
return Camera::read_configuration(camera_config, quality_config);
}

string MJPGCamera::generate_launch_string() const
{
string capsfilter_string;
Expand All @@ -161,12 +155,10 @@ string MJPGCamera::generate_launch_string() const
capsfilter_string = generate_capsfilter();
regex d("%device");
regex cf("%capsfilter");
regex enc("%encoder");
regex br("%bitrate");
string result;
result = regex_replace(launch_string, d, device_path);
result = regex_replace(result, cf, capsfilter_string);
result = regex_replace(result, enc, encoder_name);
result = regex_replace(result, br, to_string(launch_bitrate));
return result;
}
2 changes: 0 additions & 2 deletions src/Camera/MJPGCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class MJPGCamera : public Camera
protected:
GstElement *encoder;
GstElement *capsfilter;
string encoder_name;
virtual bool read_configuration(Setting &camera_config, Setting &quality_config) override;
bool get_supported_qualities();

public:
Expand Down
10 changes: 1 addition & 9 deletions src/Camera/ZEDCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ZEDCamera::ZEDCamera(string device, Quality q) : Camera(device, q), encoder(null

bool ZEDCamera::set_element_references(GstElement *pipeline)
{
encoder = gst_bin_get_by_name(GST_BIN(pipeline), encoder_name.c_str());
encoder = gst_bin_get_by_name(GST_BIN(pipeline), "encoder");
capsfilter = gst_bin_get_by_name(GST_BIN(pipeline), "capsfilter");
if (encoder && capsfilter) {
return true;
Expand Down Expand Up @@ -57,12 +57,6 @@ bool ZEDCamera::set_quality(Quality q)
return true;
}

bool ZEDCamera::read_configuration(Setting &camera_config, Setting &quality_config)
{
encoder_name = static_cast<const char *>(camera_config.lookup("camera.properties.encoder_name"));
return Camera::read_configuration(camera_config, quality_config);
}

string ZEDCamera::generate_launch_string() const
{
string capsfilter_string;
Expand All @@ -81,12 +75,10 @@ string ZEDCamera::generate_launch_string() const
capsfilter_string = generate_capsfilter();
regex d("%device");
regex cf("%capsfilter");
regex enc("%encoder");
regex br("%bitrate");
string result;
result = regex_replace(launch_string, d, device_path);
result = regex_replace(result, cf, capsfilter_string);
result = regex_replace(result, enc, encoder_name);
result = regex_replace(result, br, to_string(launch_bitrate));
return result;
}
2 changes: 0 additions & 2 deletions src/Camera/ZEDCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class ZEDCamera : public Camera
protected:
GstElement *encoder;
GstElement *capsfilter;
string encoder_name;
virtual bool read_configuration(Setting &camera_config, Setting &quality_config) override;

public:
ZEDCamera(string device, Quality q);
Expand Down

0 comments on commit 60b12c3

Please sign in to comment.