Hi, On Mon, Mar 31, 2008 at 11:18:07PM +0800, zhentan feng wrote:
[...]
Index: mpegpes.h =================================================================== --- mpegpes.h (revision 2048) +++ mpegpes.h (working copy) @@ -30,6 +30,12 @@ #include "avformat.h" #include "fifo.h"
+#define PES_FMT_MPEG2 0x01 +#define PES_FMT_VCD 0x02 +#define PES_FMT_SVCD 0x04 | PES_FMT_MPEG2 +#define PES_FMT_DVD 0x08 | PES_FMT_MPEG2 +#define PES_FMT_TS 0x10 | PES_FMT_MPEG2 +
Yes, but problem now is that == PES_FMT_TS is causing problems, and gcc warns you about it. So you should directly merge values I guess.
[...]
Index: mpegpesenc.c =================================================================== --- mpegpesenc.c (revision 2048) +++ mpegpesenc.c (working copy) @@ -100,7 +100,109 @@
return nb_frames; } +/** + * Caculate the PES header to flush + * @param[in] id the stream id + * @param[in] stream the PES stream + * @param[in] packet_size the packet size for PES + * @param[in] header_len the PES header length + * @param[in] pts the PTS + * @param[in] dts the DTS + * @param[in] payload_size the PES palyload size + * @param[in] startcode the startcode + * @param[in]stuffing_size the PES stuff size + * @param[in] trailer_size the trailer_ size + * @param[in] pad_packet_bytes the padding size for packet + * @return NULL + */ +void ff_pes_cal_header(int id,PESStream * stream, + int *packet_size,int *header_len,int64_t *pts,int64_t *dts, + int *payload_size,int *startcode,int *stuffing_size, + int *trailer_size,int *pad_packet_bytes) +{ + /* packet header size */ + *packet_size -= 6;
+ /* packet header */ + if (stream->format & PES_FMT_MPEG2){ + *header_len = 3; + if (stream->packet_number==0) + *header_len += 3; /* PES extension */
You don't check for TS here ? Old code is not checking this. Are you sure it is correct ? Did you test it ? Except that patch is ok. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA SMARTJOG SAS http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA Phone: +33 1 49966312