do not operate on deleted ptr

TODO: allocate an internal avcodec context in decoder