Implemented changes to be compatible with libav