msdk: refactor removing duplicated code in encoder and decoder.
@zzoon
Submitted by Hyunjun Ko Link to original bug (#793414)
Description
There are some duplicate code and can be placed in one place, so called, gstmsdkutil.c.
Let's refactor and clean it up.