I have two minor comment for v5, otherwise it looks good to me:
+typedef enum
+{
+ STREAM_NEW,
+ STREAM_HAS_DATA,
+ STREAM_FINISHED,
+} pg_stream_state;
+
This is duplicated in two files, wouldn't be astreamer.h a better place for it?
+ if (!mystreamer->stream_finished)
+ pg_fatal("could not decompress data: compressed stream is incomplete");
+
The other two checks distinguish empty from incomplete, is this
difference intended?