Dolby Digital Plus (E-AC-3) SAMPLE-AES encryption

I have implemented SAMPLE-AES encryption according to the spec: https://developer.apple.com/library/iad/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Encryption/Encryption.html#//apple_ref/doc/uid/TP40012862-CH2-SW5

I have tried to add also implemention for Dolby Digital Plus (E-AC-3) SAMPLE-AES encryption, But it does not play well.

I believe that my IV handling between E-AC-3 syncframes is wrong.

right now I'm taking the first 16 (or the last 16) encrypted Bytes of the previous syncframe as my new IV.

I would be glad if someone will be able to instruct me how to handle the IV between 2 consecutive syncframes.

In addition, are there known tools (like mediafilesegmenter) that has the ability to do SAMPLE-AES encryption for E-AC-3 audio so I will be able to use it has a refernce?