lavc/libopenjpegenc: move opj_create_compress, opj_cio_open and opj_set_event_mgr to libopenjpeg_encode_frame

 libopenjpegenc crashes with "pointer being freed was not allocated" when threading
 is enabled with:
 ffmpeg -i tests/vsynth1/01.pgm -vcodec libopenjpeg file.j2k
 this appears to be a bug in libopenjpeg

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
