static GstCaps * gst_msdkh264enc_set_src_caps (GstMsdkEnc * encoder) { GstCaps *caps; GstStructure *structure; const gchar *profile; const gchar *level; caps = gst_caps_new_empty_simple ("video/x-h264"); structure = gst_caps_get_structure (caps, 0); gst_structure_set (structure, "stream-format", G_TYPE_STRING, "byte-stream", NULL); gst_structure_set (structure, "alignment", G_TYPE_STRING, "au", NULL); profile = profile_to_string (encoder->param.mfx.CodecProfile); if (profile) gst_structure_set (structure, "profile", G_TYPE_STRING, profile, NULL); level = level_to_string (encoder->param.mfx.CodecLevel); if (level) gst_structure_set (structure, "level", G_TYPE_STRING, level, NULL); return caps; }
void playback_sensor::register_sensor_streams(const stream_profiles& profiles) { for (auto profile : profiles) { profile->set_unique_id(environment::get_instance().generate_stream_id()); m_available_profiles.push_back(profile); m_streams[std::make_pair(profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()))] = profile; LOG_DEBUG("Added new stream: " << profile_to_string(profile)); } }
static GstCaps * gst_msdkvp8enc_set_src_caps (GstMsdkEnc * encoder) { GstCaps *caps; GstStructure *structure; const gchar *profile; caps = gst_caps_new_empty_simple ("video/x-vp8"); structure = gst_caps_get_structure (caps, 0); profile = profile_to_string (encoder->param.mfx.CodecProfile); if (profile) gst_structure_set (structure, "profile", G_TYPE_STRING, profile, NULL); return caps; }
void playback_sensor::open(const stream_profiles& requests) { //Playback can only play the streams that were recorded. //Go over the requested profiles and see if they are available LOG_DEBUG("Open Sensor " << m_sensor_id); for (auto&& r : requests) { if (std::find_if(std::begin(m_available_profiles), std::end(m_available_profiles), [r](const std::shared_ptr<stream_profile_interface>& s) { return r->get_unique_id() == s->get_unique_id(); }) == std::end(m_available_profiles)) { throw std::runtime_error(to_string() << "Failed to open sensor, requested profile: " << profile_to_string(r) << " is not available"); } } std::vector<device_serializer::stream_identifier> opened_streams; //For each stream, create a dedicated dispatching thread for (auto&& profile : requests) { m_dispatchers.emplace(std::make_pair(profile->get_unique_id(), std::make_shared<dispatcher>(10))); //TODO: what size the queue should be? m_dispatchers[profile->get_unique_id()]->start(); device_serializer::stream_identifier f{ get_device_index(), m_sensor_id, profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()) }; opened_streams.push_back(f); } m_active_streams = requests; opened(opened_streams); }