Fix encoding PCM on some recent FFmpeg change (kdenlive 1282).
Fix encoding PCM on some recent FFmpeg change (kdenlive 1282).

Also includes a little cleanup and extra buffer overwrite protection.

gmarco/mlt-orig,ttill/MLT-roto,wideioltd/mlt,ttill/MLT-roto-tracking,ttill/MLT,zzhhui/mlt,anba8005/mlt,anba8005/mlt,anba8005/mlt,zzhhui/mlt,zzhhui/mlt,j-b-m/mlt,siddharudh/mlt,ttill/MLT-roto-tracking,ttill/MLT-roto-tracking,xzhavilla/mlt,j-b-m/mlt,ttill/MLT-roto,ttill/MLT,j-b-m/mlt,mltframework/mlt,wideioltd/mlt,wideioltd/mlt,xzhavilla/mlt,siddharudh/mlt,ttill/MLT-roto-tracking,ttill/MLT-roto-tracking,ttill/MLT,xzhavilla/mlt,j-b-m/mlt,mltframework/mlt,anba8005/mlt,ttill/MLT-roto,xzhavilla/mlt,ttill/MLT-roto,gmarco/mlt-orig,wideioltd/mlt,ttill/MLT,gmarco/mlt-orig,anba8005/mlt,mltframework/mlt,siddharudh/mlt,zzhhui/mlt,ttill/MLT,wideioltd/mlt,ttill/MLT,ttill/MLT,ttill/MLT-roto-tracking,xzhavilla/mlt,siddharudh/mlt,mltframework/mlt,mltframework/mlt,anba8005/mlt,j-b-m/mlt,j-b-m/mlt,ttill/MLT-roto,xzhavilla/mlt,wideioltd/mlt,siddharudh/mlt,anba8005/mlt,mltframework/mlt,anba8005/mlt,mltframework/mlt,siddharudh/mlt,mltframework/mlt,gmarco/mlt-orig,ttill/MLT-roto,mltframework/mlt,siddharudh/mlt,j-b-m/mlt,mltframework/mlt,anba8005/mlt,zzhhui/mlt,ttill/MLT-roto-tracking,wideioltd/mlt,wideioltd/mlt,ttill/MLT-roto-tracking,zzhhui/mlt,ttill/MLT-roto,zzhhui/mlt,ttill/MLT,ttill/MLT-roto,ttill/MLT,gmarco/mlt-orig,siddharudh/mlt,siddharudh/mlt,j-b-m/mlt,j-b-m/mlt,xzhavilla/mlt,gmarco/mlt-orig,ttill/MLT-roto,xzhavilla/mlt,j-b-m/mlt,wideioltd/mlt,zzhhui/mlt,gmarco/mlt-orig,zzhhui/mlt,ttill/MLT-roto-tracking,gmarco/mlt-orig,gmarco/mlt-orig,xzhavilla/mlt