aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mp2t.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-09-07 18:40:36 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2014-09-08 20:53:28 +0000
commit4af01a8f30722e969046ab3cd7a1e3e3e4e3d69e (patch)
treea481df350d5494c8c92aeb6f9d26cd78417e4255 /epan/dissectors/packet-mp2t.c
parent412662afb3c404df5a1e5e19988b0df8d594267a (diff)
don't skip another 6 bytes after OPCR
Bug: 10446 simplify OPCR calculation while we're at it Change-Id: I8590e409895e712fe6bbb64ab23093caf5795fa7 Reviewed-on: https://code.wireshark.org/review/4040 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-mp2t.c')
-rw-r--r--epan/dissectors/packet-mp2t.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index 7a17ddc6df..fa819df890 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -985,38 +985,16 @@ dissect_mp2t_adaptation_field(tvbuff_t *tvb, gint offset, proto_tree *tree)
}
if (af_flags & MP2T_AF_OPCR_MASK) {
- guint64 opcr_base = 0;
- guint32 opcr_ext = 0;
- guint8 tmp = 0;
+ guint64 opcr_base;
+ guint32 opcr_ext;
- tmp = tvb_get_guint8(tvb, offset);
- opcr_base = (opcr_base << 8) | tmp;
- offset += 1;
-
- tmp = tvb_get_guint8(tvb, offset);
- opcr_base = (opcr_base << 8) | tmp;
- offset += 1;
+ /* the same format as PCR above */
+ opcr_base = tvb_get_ntoh48(tvb, offset) >> (48-33);
+ opcr_ext = tvb_get_ntoh48(tvb, offset) & 0x1FF;
- tmp = tvb_get_guint8(tvb, offset);
- opcr_base = (opcr_base << 8) | tmp;
- offset += 1;
-
- tmp = tvb_get_guint8(tvb, offset);
- opcr_base = (opcr_base << 8) | tmp;
- offset += 1;
-
- tmp = tvb_get_guint8(tvb, offset);
- opcr_base = (opcr_base << 1) | ((tmp >> 7) & 0x01);
- opcr_ext = (tmp & 0x01);
- offset += 1;
-
- tmp = tvb_get_guint8(tvb, offset);
- opcr_ext = (opcr_ext << 8) | tmp;
- offset += 1;
-
- proto_tree_add_none_format(mp2t_af_tree, hf_mp2t_af_opcr, tvb, offset - 6, 6,
- "Original Program Clock Reference: base(%" G_GINT64_MODIFIER "u) * 300 + ext(%u) = %" G_GINT64_MODIFIER "u",
- opcr_base, opcr_ext, opcr_base * 300 + opcr_ext);
+ proto_tree_add_uint64_format_value(mp2t_af_tree, hf_mp2t_af_opcr, tvb, offset, 6,
+ opcr_base*300 + opcr_ext, "%" G_GINT64_MODIFIER "u",
+ opcr_base*300 + opcr_ext);
offset += 6;
}
@@ -1362,7 +1340,7 @@ proto_register_mp2t(void)
} } ,
{ &hf_mp2t_af_opcr, {
"Original Program Clock Reference", "mp2t.af.opcr",
- FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
+ FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL
} } ,
{ &hf_mp2t_af_sc, {
"Splice Countdown", "mp2t.af.sc",