mirror of
https://bitbucket.org/ohhara/ohmulticastvideoscanner.git
synced 2025-06-06 15:36:34 +00:00
If EOS, finish scan.
This commit is contained in:
parent
f25f81d2d8
commit
5e8b1667f9
22
omvs_gst.c
22
omvs_gst.c
@ -23,6 +23,7 @@
|
||||
|
||||
typedef struct _OMVSGstImpl {
|
||||
GstElement *play;
|
||||
GstBus *bus;
|
||||
} OMVSGstImpl;
|
||||
|
||||
OMVSGst omvs_gst_open(const gchar *uri, const gchar *filename) {
|
||||
@ -55,11 +56,32 @@ OMVSGst omvs_gst_open(const gchar *uri, const gchar *filename) {
|
||||
g_object_set(play, "video-sink", convpngfile, NULL);
|
||||
g_object_set(play, "mute", TRUE, NULL);
|
||||
|
||||
gst_impl->bus = gst_element_get_bus(play);
|
||||
gst_object_unref(GST_OBJECT(gst_impl->bus));
|
||||
|
||||
gst_element_set_state(play, GST_STATE_PLAYING);
|
||||
|
||||
return (OMVSGst)gst_impl;
|
||||
}
|
||||
|
||||
gboolean omvs_gst_is_finished(OMVSGst gst) {
|
||||
OMVSGstImpl *gst_impl;
|
||||
GstMessage *msg;
|
||||
|
||||
g_assert(gst);
|
||||
|
||||
gst_impl = (OMVSGstImpl *)gst;
|
||||
|
||||
msg = gst_bus_pop_filtered(gst_impl->bus, GST_MESSAGE_EOS);
|
||||
if (!msg) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_message_unref(msg);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint omvs_gst_close(OMVSGst gst) {
|
||||
OMVSGstImpl *gst_impl;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
typedef void *OMVSGst;
|
||||
|
||||
extern OMVSGst omvs_gst_open(const gchar *uri, const gchar *filename);
|
||||
extern gboolean omvs_gst_is_finished(OMVSGst gst);
|
||||
extern gint omvs_gst_close(OMVSGst gst);
|
||||
|
||||
#endif /* _OMVS_GST_H_ */
|
||||
|
28
omvs_main.c
28
omvs_main.c
@ -226,6 +226,8 @@ static gpointer _omvs_start_scan_job(gpointer data) {
|
||||
guint ip_hdr_len;
|
||||
gint udp_port;
|
||||
gboolean is_udp_port_found;
|
||||
gboolean is_gst_finished;
|
||||
gboolean is_all_gst_finished;
|
||||
|
||||
ret = pcap_next_ex(pcap, &header, &packet);
|
||||
|
||||
@ -306,6 +308,32 @@ static gpointer _omvs_start_scan_job(gpointer data) {
|
||||
o_ipaddr->ports[o_ipaddr->num_ports] = udp_port;
|
||||
o_ipaddr->num_ports++;
|
||||
}
|
||||
|
||||
is_gst_finished = FALSE;
|
||||
for (j = 0; j < o_ipaddr->num_ports; j++) {
|
||||
if (o_ipaddr->gsts[j]) {
|
||||
if (omvs_gst_is_finished(o_ipaddr->gsts[j])) {
|
||||
omvs_gst_close(o_ipaddr->gsts[j]);
|
||||
o_ipaddr->gsts[j] = NULL;
|
||||
is_gst_finished = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is_all_gst_finished = FALSE;
|
||||
if (is_gst_finished) {
|
||||
is_all_gst_finished = TRUE;
|
||||
for (j = 0; j < o_ipaddr->num_ports; j++) {
|
||||
if (o_ipaddr->gsts[j]) {
|
||||
is_all_gst_finished = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_all_gst_finished) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < o_ipaddr->num_ports; j++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user