libfreerdp-core: refactor codec context management