diff options
author | Edward Hervey <bilboed@bilboed.com> | 2017-03-01 16:23:28 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-03-03 14:51:51 +0100 |
commit | 8ff24ec9ff987421ea6e52b1f5d198026afbf7c0 (patch) | |
tree | 8c04d689f683d7fd39a15724eab4f881340be584 | |
parent | c8b69db0f36d465a1b5af7423078186e80cf1b2c (diff) |
gstgraph: Fix for live mode
-rw-r--r-- | python-utils/adaptivetrickmode.py | 11 | ||||
-rwxr-xr-x | python-utils/gstgraph.py | 19 |
2 files changed, 24 insertions, 6 deletions
diff --git a/python-utils/adaptivetrickmode.py b/python-utils/adaptivetrickmode.py index 3c91271..4458e26 100644 --- a/python-utils/adaptivetrickmode.py +++ b/python-utils/adaptivetrickmode.py @@ -22,6 +22,14 @@ import sys from gstgraph import LogFigure, LogGrapher, VDecLogData, ADecLogData, BaseSinkLogData, \ AdaptiveDemuxData, Queue2LogData, DashDemuxData +# Example usage of the gstgraph API +# +# This example will live plot the gstdebug log provided in input. +# +# # GST_DEBUG=2,*adaptiv*:8,*dash*:8,*decoder:6,*sink:6 GST_DEBUG_FILE=/tmp/log <anygstapp> +# # python adaptivetrickmode.py /tmp/log +# + if __name__ == "__main__": # We want to extract data from various sources vdec = VDecLogData() @@ -78,4 +86,5 @@ if __name__ == "__main__": grapher = LogGrapher([vf, vf2, vf3, vf5, vf6, vf7, vf8, vf9, vfx, vfy, vfd, vfu, vfz]) print "Opening file for processing" - grapher.analyze_file(sys.argv[1]) + # Use .analyze_file() if file won't grow + grapher.plot_live_log(sys.argv[1]) diff --git a/python-utils/gstgraph.py b/python-utils/gstgraph.py index 850f7cc..143038b 100755 --- a/python-utils/gstgraph.py +++ b/python-utils/gstgraph.py @@ -1018,8 +1018,9 @@ class LogFigure: res["axes"] = res["figure"].get_axes()[0] return res - def __update_single_figure(self, fig, filter_dict={}, key_values=[]): + def __update_single_figure(self, figkey, filter_dict={}, key_values=[]): any_updated = False + fig = self.__figures[figkey] for p in self.datapoints: if p.has_updates(): if key_values is not []: @@ -1027,10 +1028,18 @@ class LogFigure: d = filter_dict d[self.main_key] = k print "Updating plots for", p, k - pl = fig["plots"][(p, k)] - pl.set_xdata(p.get_walltime(**d)) - pl.set_ydata(p.get_values(**d)) - any_updated = True + xs = p.get_walltime(**d) + ys = p.get_values(**d) + if ys != []: + if (p, k) in fig["plots"]: + pl = fig["plots"][(p, k)] + pl.set_xdata(xs) + pl.set_ydata(ys) + else: + fig["plots"][(p,k)] = pylab.plot(xs, ys, label="%s %s" % (p.get_label(), k), + marker=p.get_marker(), + linestyle=p.get_linestyle())[0] + any_updated = True else: print "Updating plots for", p pl = fig["plots"][p] |