set global header flag for all media types

When the output format requires global headers, 
CODEC_FLAG_GLOBAL_HEADER should be set for all codec media types.

This appears to be a very old bug, inherited from the 2009 version of output_example.c

This fix uses the same approach currently in new_output_stream() 
in both avconv_opt.c and ffmpeg_opt.c (just search for CODEC_FLAG_GLOBAL_HEADER)
It is also present in a slightly different form in add_audio_stream() of libavformat/output-example.c

This change may fix the residual issues from "Leading silence (gaps) in audio segments",
but that needs to be confirmed.