mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:56:14 +00:00
pcapparse: add some comments about the pcap format headers
Since the code is full of magic add at least some guidance for newbies. https://bugzilla.gnome.org/show_bug.cgi?id=795284
This commit is contained in:
parent
8e6375c08b
commit
a4df5132bc
1 changed files with 11 additions and 0 deletions
|
@ -26,6 +26,10 @@
|
||||||
* #GstPcapParse:src-port and #GstPcapParse:dst-port to restrict which packets
|
* #GstPcapParse:src-port and #GstPcapParse:dst-port to restrict which packets
|
||||||
* should be included.
|
* should be included.
|
||||||
*
|
*
|
||||||
|
* The supported data format is the classical <ulink
|
||||||
|
* url="https://wiki.wireshark.org/Development/LibpcapFileFormat">libpcap file
|
||||||
|
* format</ulink>.
|
||||||
|
*
|
||||||
* ## Example pipelines
|
* ## Example pipelines
|
||||||
* |[
|
* |[
|
||||||
* gst-launch-1.0 filesrc location=h264crasher.pcap ! pcapparse ! rtph264depay
|
* gst-launch-1.0 filesrc location=h264crasher.pcap ! pcapparse ! rtph264depay
|
||||||
|
@ -415,6 +419,8 @@ gst_pcap_parse_scan_frame (GstPcapParse * self,
|
||||||
}
|
}
|
||||||
|
|
||||||
b = *buf_ip;
|
b = *buf_ip;
|
||||||
|
|
||||||
|
/* Check that the packet is IPv4 */
|
||||||
if (((b >> 4) & 0x0f) != 4)
|
if (((b >> 4) & 0x0f) != 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -490,6 +496,7 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
|
|
||||||
if (self->initialized) {
|
if (self->initialized) {
|
||||||
if (self->cur_packet_size >= 0) {
|
if (self->cur_packet_size >= 0) {
|
||||||
|
/* Parse the Packet Data */
|
||||||
if (avail < self->cur_packet_size)
|
if (avail < self->cur_packet_size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -543,10 +550,12 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
|
|
||||||
self->cur_packet_size = -1;
|
self->cur_packet_size = -1;
|
||||||
} else {
|
} else {
|
||||||
|
/* Parse the Record (Packet) Header */
|
||||||
guint32 ts_sec;
|
guint32 ts_sec;
|
||||||
guint32 ts_usec;
|
guint32 ts_usec;
|
||||||
guint32 incl_len;
|
guint32 incl_len;
|
||||||
|
|
||||||
|
/* sizeof(pcaprec_hdr_t) == 16 */
|
||||||
if (avail < 16)
|
if (avail < 16)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -566,10 +575,12 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
self->cur_packet_size = incl_len;
|
self->cur_packet_size = incl_len;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* Parse the Global Header */
|
||||||
guint32 magic;
|
guint32 magic;
|
||||||
guint32 linktype;
|
guint32 linktype;
|
||||||
guint16 major_version;
|
guint16 major_version;
|
||||||
|
|
||||||
|
/* sizeof(pcap_hdr_t) == 24 */
|
||||||
if (avail < 24)
|
if (avail < 24)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue