how H264 (ES) packaged into H264 (PES)
has been on the internet to collect all kinds of information, heart tired ah. The following nine locks are very complicated for you to explain the unknown relationship between TS and H264. First, the overall general diagram
This I do not know is in which CSDN master that get the figure, helped me a lot of busy, on the picture time to:
How to encapsulate the PES data by ES data
1 , how to extract a frame es data, is so simple ...
[CPP] View plain copy print? #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int startcodeprefix_len; //! 4 for parameter sets and first slice in picture, 3 for everything else (suggested) unsigned len; //! Length of the NAL unit (excluding the start code, which does not belong to the nalu) unsigned max_size; //! Nal Unit Buffer size int forbidden_bit; //! should be always FALSE int nal_ reference_idc; //! nalu_priority_xxxx int nal_unit_type; //! nalu_type_xxxx char *buf; // ! contains the first byte followed by the ebsp unsigned short lost_packets; //! true, if packet loss is detected } nalu_t; file *bits = null; //!< the bit stream file static int findstartcode2 (UNSIGNED&NBSP;CHAR&NBSP;*BUF);//Find start character 0x000001 static int findstartcode3 (UNSIGNED&NBSP;CHAR&NBSP;*BUF);//Find start character 0x00000001 // static bool flag = true; static int info2=0, info3=0; Nalu_t *allocnalu (int buffersize) { nalu_t *n; if ((n = (nalu_t*) calloc (1, sizeof (nalu_t)) == null) { printf ("Allocnalu: n"); exit (0); } n->max_size=buffersize; if (n->buf = (char*) calloc (buffersize, sizeof (char))) == null) { free (n); printf ("Allocnalu: n->buf"); exit (0); } return n; }