mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
tsparse: Extract and fill m2ts header for each packet
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7625>
This commit is contained in:
parent
5b521c210b
commit
37087f129f
3 changed files with 23 additions and 4 deletions
|
@ -871,6 +871,15 @@ mpegts_packetizer_next_packet (MpegTSPacketizer2 * packetizer,
|
||||||
if (!mpegts_packetizer_map (packetizer, packet_size))
|
if (!mpegts_packetizer_map (packetizer, packet_size))
|
||||||
return PACKET_NEED_MORE;
|
return PACKET_NEED_MORE;
|
||||||
|
|
||||||
|
/* Get M2TS header start */
|
||||||
|
if (packet_size == MPEGTS_M2TS_PACKETSIZE) {
|
||||||
|
guint8 *m2ts_header_start = &packetizer->map_data[packetizer->map_offset];
|
||||||
|
packet->m2ts_header_start = m2ts_header_start;
|
||||||
|
GST_MEMDUMP ("M2TS header start", packet->m2ts_header_start, 4);
|
||||||
|
} else
|
||||||
|
packet->m2ts_header_start = NULL;
|
||||||
|
|
||||||
|
/* Get TS packet data start */
|
||||||
packet_data = &packetizer->map_data[packetizer->map_offset + sync_offset];
|
packet_data = &packetizer->map_data[packetizer->map_offset + sync_offset];
|
||||||
|
|
||||||
/* Check sync byte */
|
/* Check sync byte */
|
||||||
|
|
|
@ -309,6 +309,7 @@ typedef struct
|
||||||
guint8 scram_afc_cc;
|
guint8 scram_afc_cc;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
|
|
||||||
|
guint8 *m2ts_header_start;
|
||||||
guint8 *data_start;
|
guint8 *data_start;
|
||||||
guint8 *data_end;
|
guint8 *data_end;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
|
@ -610,10 +610,19 @@ mpegts_parse_request_new_pad (GstElement * element, GstPadTemplate * template,
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
mpegts_packet_to_buffer (MpegTSPacketizerPacket * packet)
|
mpegts_packet_to_buffer (MpegTSPacketizerPacket * packet)
|
||||||
{
|
{
|
||||||
GstBuffer *buf =
|
GstBuffer *buf;
|
||||||
gst_buffer_new_and_alloc (packet->data_end - packet->data_start);
|
if (packet->m2ts_header_start != NULL) {
|
||||||
|
/* Fill the buffer with all 192 bytes */
|
||||||
|
buf =
|
||||||
|
gst_buffer_new_and_alloc (packet->data_end - packet->m2ts_header_start);
|
||||||
|
gst_buffer_fill (buf, 0, packet->m2ts_header_start,
|
||||||
|
packet->data_end - packet->m2ts_header_start);
|
||||||
|
} else {
|
||||||
|
buf = gst_buffer_new_and_alloc (packet->data_end - packet->data_start);
|
||||||
gst_buffer_fill (buf, 0, packet->data_start,
|
gst_buffer_fill (buf, 0, packet->data_start,
|
||||||
packet->data_end - packet->data_start);
|
packet->data_end - packet->data_start);
|
||||||
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue