Fix read next packet

Improve extracting process from InputFile
Could add a function into Frame (CodedData) instead of duplicating this code, no?