void DecoderH264_OnEvent(object sender, EltEventArgs e) { if (g_MainInstH264.Dispatcher.CheckAccess() == false) { g_MainInstH264.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.DataBind, (Action)(() => DecoderH264_OnEvent(sender, e))); return; } Debug.Assert(e.Elt.Type == Elt.EltType_t.EltType_Section); foreach (Elt elt in e.Elt.Elements) { switch (elt.Type) { case Elt.EltType_t.EltType_Nalu: { EltH264Nalu nalu = (elt as EltH264Nalu); switch (nalu.NaluType) { case NalUnitType.NAL_UNIT_SPS: case NalUnitType.NAL_UNIT_SUBSET_SPS: { AddSeqParamSet(new H264SeqParamSet(nalu)); break; } case NalUnitType.NAL_UNIT_PPS: { AddPicParamSet(new H264PicParamSet(nalu, this)); break; } case NalUnitType.NAL_UNIT_CODED_SLICE: case NalUnitType.NAL_UNIT_CODED_SLICE_IDR: case NalUnitType.NAL_UNIT_CODED_SLICE_SCALABLE: { H264Slice slice = new H264Slice(nalu, this); Debug.Assert(slice != null); H264Picture picture = FindPicture(nalu.LayerId, nalu.PictureId) as H264Picture; if (picture == null) { picture = new H264Picture(nalu.LayerId, nalu.PictureId, slice.PicParamSet, slice.SeqParamSet); } bool wasComplete = picture.IsComplete; picture.AddSlice(slice); AddPicture(picture, wasComplete); break; } case NalUnitType.NAL_UNIT_ACCESS_UNIT_DELIMITER: { break; } } break; } } } if (OnEvent != null) { EventHandlerTrigger.TriggerEvent<EltEventArgs>(OnEvent, this, e); } }
void DecoderH264_OnEvent(object sender, EltEventArgs e) { if (g_MainInstH264.Dispatcher.CheckAccess() == false) { g_MainInstH264.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.DataBind, (Action)(() => DecoderH264_OnEvent(sender, e))); return; } Debug.Assert(e.Elt.Type == Elt.EltType_t.EltType_Section); foreach (Elt elt in e.Elt.Elements) { switch (elt.Type) { case Elt.EltType_t.EltType_Nalu: { EltH264Nalu nalu = (elt as EltH264Nalu); switch (nalu.NaluType) { case NalUnitType.NAL_UNIT_SPS: case NalUnitType.NAL_UNIT_SUBSET_SPS: { AddSeqParamSet(new H264SeqParamSet(nalu)); break; } case NalUnitType.NAL_UNIT_PPS: { AddPicParamSet(new H264PicParamSet(nalu, this)); break; } case NalUnitType.NAL_UNIT_CODED_SLICE: case NalUnitType.NAL_UNIT_CODED_SLICE_IDR: case NalUnitType.NAL_UNIT_CODED_SLICE_SCALABLE: { H264Slice slice = new H264Slice(nalu, this); Debug.Assert(slice != null); H264Picture picture = FindPicture(nalu.LayerId, nalu.PictureId) as H264Picture; if (picture == null) { picture = new H264Picture(nalu.LayerId, nalu.PictureId, slice.PicParamSet, slice.SeqParamSet); } bool wasComplete = picture.IsComplete; picture.AddSlice(slice); AddPicture(picture, wasComplete); break; } case NalUnitType.NAL_UNIT_ACCESS_UNIT_DELIMITER: { break; } } break; } } } if (OnEvent != null) { EventHandlerTrigger.TriggerEvent <EltEventArgs>(OnEvent, this, e); } }