M2PA: fix parsing of MTP3 portion of M2PA user messages
diff --git a/src/m2pa_codec.erl b/src/m2pa_codec.erl
index 585b9c9..0165447 100644
--- a/src/m2pa_codec.erl
+++ b/src/m2pa_codec.erl
@@ -37,8 +37,8 @@
 			{undefined, Ret}
 	end;
 parse_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Len, RemainIn) ->
-	<<Pri:1, _:7, SIO:8, SIF/binary>> = RemainIn,
-	Mtp3 = #mtp3_msg{service_ind = SIO, m3ua_mp = Pri, payload = SIF},
+	<<Pri:1, _:7, Mtp3Bin/binary>> = RemainIn,
+	Mtp3 = mtp3_codec:parse_mtp3_msg(Mtp3Bin),
 	{Mtp3, []}.
 
 parse_msg(DataBin) when is_binary(DataBin) ->
@@ -49,8 +49,11 @@
 			fwd_seq_nr = FSN, back_seq_nr = BSN,
 			mtp3 = Mtp3, parameters = Params}}.
 
-encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, _Params) ->
+encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, _Params) when is_binary(Mtp3) ->
 	<<Mtp3/binary>>;
+encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3, Params) when is_record(Mtp3, mtp3_msg) ->
+	Mtp3bin = mtp3_codec:encode_mtp3_msg(Mtp3),
+	encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_USER, Mtp3bin, Params);
 encode_m2pa_msgt(?M2PA_CLASS_M2PA, ?M2PA_TYPE_LINK, _, Params) ->
 	State = proplists:get_value(link_state, Params),
 	% FIXME: filler