Skip to content

Instantly share code, notes, and snippets.

View joanpau's full-sized avatar

Joan Pau Beltran joanpau

  • Mallorca
View GitHub Profile
@joanpau
joanpau / testnctext.m
Last active August 29, 2015 14:01
NetCDF text attribute encoding test.
%TESTNCTEXT NetCDF text attribute test.
%
% Input and output of text attributes to NetCDF files is not consistent when
% they contain non-ASCII characters. Saving the attribute to a file and loading
% it again doest not recover the original value.
%
% The cause of the problem seems to be the different data types used by MATLAB
% and NetCDF to represent character data, and that it is not documented how
% the conversion is done:
%
@joanpau
joanpau / ticky.py
Last active August 29, 2015 14:03
Snippet to correct the local time offset in the dygraphs date ticker test suite.
#!/usr/bin/python3
#
# Correct dygraphs date ticks test-suite.
#
# The test suite contains assertions on the value of a tick timestamp
# (millis since the epoch) and its label in a local time zone
# which happens to be -04:00 or -05:00 away from UTC. These values are compared
# to the output of a ticker that receives the timestamp of the start and end
# of the time range (also millis since the epoch).
#
@joanpau
joanpau / dynamic.c
Last active October 2, 2015 01:30
Test growing and pruning branches dynamically in a gstreamer pipeline.
/**
* Test a dynamic pipeline made of:
* - source elements (videotestsrc, capsfilter, and tee)
* - sink elements (queue, and appsink)
*
* After building the pipeline and playing it for a while,
* pause it and remove the sink elements.
* Then add identical elements and try to play again.
* The pipeline fails to change the state to PLAYING.
*
@joanpau
joanpau / idleprobe.c
Created October 5, 2015 16:17
Test whether idle pad probes are effectively blocking probes, as stated in the gstreamer's documentaion.
/**
* Test if idle probes are blocking or not.
*
* Build dynamic pipeline made of a videotestsrc and an autovideosink,
* and add/remove a dummy idle probe (print a message) every 5 seconds.
*
* Probes of type GST_PAD_PROBE_TYPE_IDLE are described as blocking
* in the design documents [1] and the reference documentation [2],
* so that they block the pad until the probe is removed.
* But it seems that they just block the pad during the execution of the
@joanpau
joanpau / gstappsink.c
Last active July 14, 2016 17:58
Add timeout sample pull to GstAppSink
/* inside gst_app_sink_class_init */
static void
gst_app_sink_class_init (GstAppSinkClass * klass)
{
/* ... */
gst_app_sink_signals[SIGNAL_TRY_PULL_SAMPLE] =
g_signal_new ("try-pull-sample", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,