GstEnginePipeline: Refactor code

This commit is contained in:
Jonas Kvinge 2021-10-12 18:36:58 +02:00
parent f3b70d1cb2
commit 0093eb6c2c
1 changed files with 12 additions and 6 deletions

View File

@ -614,14 +614,20 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
GstCaps *caps = gst_pad_get_current_caps(pad);
GstStructure *structure = gst_caps_get_structure(caps, 0);
QString format = QString(gst_structure_get_string(structure, "format"));
QString format;
int channels = 0;
int rate = 0;
gst_structure_get_int(structure, "channels", &channels);
gst_structure_get_int(structure, "rate", &rate);
gst_caps_unref(caps);
GstCaps *caps = gst_pad_get_current_caps(pad);
if (caps) {
GstStructure *structure = gst_caps_get_structure(caps, 0);
if (structure) {
format = QString(gst_structure_get_string(structure, "format"));
gst_structure_get_int(structure, "channels", &channels);
gst_structure_get_int(structure, "rate", &rate);
}
gst_caps_unref(caps);
}
GstBuffer *buf = gst_pad_probe_info_get_buffer(info);
GstBuffer *buf16 = nullptr;