diff --git a/epan/dissectors/packet-mp4.c b/epan/dissectors/packet-mp4.c index 1362fa7b6c..2a1334692a 100644 --- a/epan/dissectors/packet-mp4.c +++ b/epan/dissectors/packet-mp4.c @@ -45,6 +45,7 @@ static gint ett_mp4_box = -1; static int hf_mp4_box_size = -1; static int hf_mp4_box_type_str = -1; +static int hf_mp4_box_largesize = -1; static int hf_mp4_full_box_ver = -1; static int hf_mp4_ftyp_brand = -1; static int hf_mp4_ftyp_ver = -1; @@ -52,7 +53,9 @@ static int hf_mp4_ftyp_add_brand = -1; static int hf_mp4_mfhd_seq_num = -1; /* a box must at least have a 32bit len field and a 32bit type */ -#define MIN_BOX_LEN 8 +#define MIN_BOX_SIZE 8 +/* an extended box has the first length field set to 1 */ +#define BOX_SIZE_EXTENDED 1 /* the box type is stored as four text characters it is in network byte order and contains only printable characters @@ -86,6 +89,7 @@ static int hf_mp4_mfhd_seq_num = -1; #define BOX_TYPE_TFHD MAKE_TYPE_VAL('t', 'f', 'h', 'd') #define BOX_TYPE_TRUN MAKE_TYPE_VAL('t', 'r', 'u', 'n') #define BOX_TYPE_MDAT MAKE_TYPE_VAL('m', 'd', 'a', 't') +#define BOX_TYPE_UDTA MAKE_TYPE_VAL('u', 'd', 't', 'a') static const value_string box_types[] = { @@ -116,6 +120,7 @@ static const value_string box_types[] = { { BOX_TYPE_TFHD, "Track Fragment Header Box" }, { BOX_TYPE_TRUN, "Track Fragment Run Box" }, { BOX_TYPE_MDAT, "Media Data Box" }, + { BOX_TYPE_UDTA, "User Data Box" }, { 0, NULL } }; @@ -177,54 +182,68 @@ dissect_mp4_ftyp_body(tvbuff_t *tvb, guint offset, guint len, return offset-offset_start; } -static gint +/* dissect a box, return its (standard or extended) length or 0 for error */ +static guint64 dissect_mp4_box(guint32 parent_box_type _U_, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree) { guint offset_start; - guint box_len; + guint64 box_size; guint32 box_type; guint8 *box_type_str; - proto_item *pi; + proto_item *type_pi, *size_pi; proto_tree *box_tree; - gint ret; + guint64 ret; + guint body_size; offset_start = offset; /* the following mechanisms are not supported for now - - extended size (size==1, largesize parameter) - size==0, indicating that the box extends to the end of the file - extended box types */ - box_len = tvb_get_ntohl(tvb, offset); - if (box_len 0) { ret = dissect_mp4_box(BOX_TYPE_NONE, tvb, offset, pinfo, mp4_tree); - if (ret<=0) + if (ret==0) break; offset += ret; } @@ -297,6 +318,9 @@ proto_register_mp4(void) { &hf_mp4_box_type_str, { "Box type", "mp4.box.type_str", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_mp4_box_largesize, + { "Box size (largesize)", "mp4.box.largesize", FT_UINT64, BASE_DEC, + NULL, 0, NULL, HFILL } }, { &hf_mp4_full_box_ver, { "Box version", "mp4.full_box.version", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },