diff options
author | Jakub Adam <jakub.adam@collabora.com> | 2020-01-16 19:14:47 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-01-27 18:41:29 +0000 |
commit | 9247ae9757e3ce368d8cdfe4c7f61fdf6f0e9a23 (patch) | |
tree | f352fd5eeaa129431eb6913b2b1134c8828975d6 /epan/dissectors/file-mp4.c | |
parent | 77ff747e9f50fa9f9c4e2694507af91ec8ad5478 (diff) |
mp4: dissect stts box
Change-Id: If6ad1aadf8ef5901490047f07513578ad3d5d1a9
Reviewed-on: https://code.wireshark.org/review/35889
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/file-mp4.c')
-rw-r--r-- | epan/dissectors/file-mp4.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/epan/dissectors/file-mp4.c b/epan/dissectors/file-mp4.c index dc47474c63..58c2f5fd61 100644 --- a/epan/dissectors/file-mp4.c +++ b/epan/dissectors/file-mp4.c @@ -43,6 +43,7 @@ static int proto_mp4 = -1; static gint ett_mp4 = -1; static gint ett_mp4_box = -1; static gint ett_mp4_full_box_flags = -1; +static gint ett_mp4_stts_entry = -1; static int hf_mp4_box_size = -1; static int hf_mp4_box_type_str = -1; @@ -78,6 +79,9 @@ static int hf_mp4_hdlr_name = -1; static int hf_mp4_dref_entry_cnt = -1; static int hf_mp4_stsd_entry_cnt = -1; static int hf_mp4_url_flags_media_data_location = -1; +static int hf_mp4_stts_entry_cnt = -1; +static int hf_mp4_stts_sample_count = -1; +static int hf_mp4_stts_sample_delta = -1; static expert_field ei_mp4_box_too_large = EI_INIT; static expert_field ei_mp4_too_many_rec_lvls = EI_INIT; @@ -529,7 +533,44 @@ dissect_mp4_stsd_body(tvbuff_t *tvb, gint offset, gint len, return len; } - +static gint +dissect_mp4_stts_body(tvbuff_t *tvb, gint offset, gint len, + packet_info *pinfo _U_, guint depth _U_, proto_tree *tree) +{ + guint32 entry_cnt; + guint i; + + offset += dissect_mp4_full_box (tvb, offset, tree, NULL, NULL, NULL); + + proto_tree_add_item_ret_uint(tree, hf_mp4_stts_entry_cnt, + tvb, offset, 4, ENC_BIG_ENDIAN, &entry_cnt); + offset += 4; + + for(i=0; i<entry_cnt; i++) { + proto_tree *subtree; + proto_item *subtree_item; + guint32 sample_count; + guint32 sample_delta; + + subtree = proto_tree_add_subtree_format (tree, tvb, offset, 2 * 4, + ett_mp4_stts_entry, &subtree_item, "Entry %u:", i + 1); + + proto_tree_add_item_ret_uint(subtree, hf_mp4_stts_sample_count, + tvb, offset, 4, ENC_BIG_ENDIAN, &sample_count); + offset += 4; + + proto_tree_add_item_ret_uint(subtree, hf_mp4_stts_sample_delta, + tvb, offset, 4, ENC_BIG_ENDIAN, &sample_delta); + offset += 4; + + proto_item_append_text (subtree_item, + " Sample count: %u, Sample delta: %d", + sample_count, sample_delta); + } + + return len; +} + /* dissect a box, return its (standard or extended) length or 0 for error depth is the recursion level of the parent box */ static gint @@ -628,6 +669,9 @@ dissect_mp4_box(guint32 parent_box_type _U_, guint depth, case BOX_TYPE_STSD: dissect_mp4_stsd_body(tvb, offset, body_size, pinfo, depth, box_tree); break; + case BOX_TYPE_STTS: + dissect_mp4_stts_body(tvb, offset, body_size, pinfo, depth, box_tree); + break; case BOX_TYPE_MOOV: case BOX_TYPE_MOOF: case BOX_TYPE_STBL: @@ -798,12 +842,22 @@ proto_register_mp4(void) { &hf_mp4_url_flags_media_data_location, { "Media data location is defined in the movie box", "mp4.url.flags.media_data_location", FT_BOOLEAN, 24, NULL, ENTRY_FLAG_MOVIE, NULL, HFILL } }, + { &hf_mp4_stts_entry_cnt, + { "Number of entries", "mp4.stts.entry_count", FT_UINT32, + BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_mp4_stts_sample_count, + { "Sample count", "mp4.stts.sample_count", FT_UINT32, + BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_mp4_stts_sample_delta, + { "Sample delta", "mp4.stts.sample_delta", FT_UINT32, + BASE_DEC, NULL, 0, NULL, HFILL } }, }; static gint *ett[] = { &ett_mp4, &ett_mp4_box, - &ett_mp4_full_box_flags + &ett_mp4_full_box_flags, + &ett_mp4_stts_entry }; static ei_register_info ei[] = { |