mirror of
https://bitbucket.org/ohhara/ohmulticastvideoscanner.git
synced 2025-08-26 18:21:43 +00:00
Save the content of the udp url to png file.
This commit is contained in:
parent
22de3de619
commit
94ed43a4ad
24
omvs_main.c
24
omvs_main.c
@ -5,6 +5,8 @@
|
||||
#include <gio/gio.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "omvs_gst.h"
|
||||
|
||||
#define _OMVS_IPPROTO_UDP 17
|
||||
|
||||
static gint _omvs_net_dev_idx;
|
||||
@ -74,6 +76,7 @@ typedef struct _OMVSUDPHdr {
|
||||
|
||||
typedef struct _OMVSIPAddr {
|
||||
guint32 addr;
|
||||
OMVSGst *gsts;
|
||||
guint16 *ports;
|
||||
gint num_ports;
|
||||
} OMVSIPAddr;
|
||||
@ -284,16 +287,31 @@ static gpointer _omvs_start_scan_job(gpointer data) {
|
||||
}
|
||||
|
||||
if (!is_udp_port_found) {
|
||||
gchar *uri;
|
||||
gchar *filename;
|
||||
uri = g_strdup_printf("udp://%s:%d", addr_str, udp_port);
|
||||
filename =
|
||||
g_strdup_printf("%s/%s-%d.png", _omvs_outdir, addr_str, udp_port);
|
||||
if (_omvs_verbose) {
|
||||
g_print("[%p] trying to save %s to %s\n", (void *)g_thread_self(),
|
||||
uri, filename);
|
||||
}
|
||||
o_ipaddr->gsts = g_realloc(o_ipaddr->gsts,
|
||||
(o_ipaddr->num_ports + 1) * sizeof(OMVSGst));
|
||||
o_ipaddr->gsts[o_ipaddr->num_ports] = omvs_gst_open(uri, filename);
|
||||
g_free(filename);
|
||||
g_free(uri);
|
||||
o_ipaddr->ports = g_realloc(o_ipaddr->ports,
|
||||
(o_ipaddr->num_ports + 1) * sizeof(guint16));
|
||||
o_ipaddr->ports[o_ipaddr->num_ports] = udp_port;
|
||||
o_ipaddr->num_ports++;
|
||||
if (_omvs_verbose) {
|
||||
g_print("[%p] found udp://%s:%d\n", (void *)g_thread_self(),
|
||||
addr_str, udp_port);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < o_ipaddr->num_ports; j++) {
|
||||
omvs_gst_close(o_ipaddr->gsts[j]);
|
||||
}
|
||||
g_free(o_ipaddr->gsts);
|
||||
|
||||
if (_omvs_verbose) {
|
||||
g_print("[%p] finish scanning %s\n", (void *)g_thread_self(), addr_str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user