[FFmpeg-soc] [soc]: r3937 - dvbmuxer/mpegtsenc.c
Tomer Barletz
barletz at gmail.com
Sun Jan 11 10:28:53 CET 2009
Hi,
On Sat, Jan 10, 2009 at 2:48 AM, bcoudurier <subversion at mplayerhq.hu> wrote:
> Author: bcoudurier
> Date: Sat Jan 10 01:48:25 2009
> New Revision: 3937
>
> Log:
> fix pcr computation, forgot si packets
>
> Modified:
> dvbmuxer/mpegtsenc.c
>
> Modified: dvbmuxer/mpegtsenc.c
> ==============================================================================
> --- dvbmuxer/mpegtsenc.c Fri Jan 2 00:33:53 2009 (r3936)
> +++ dvbmuxer/mpegtsenc.c Sat Jan 10 01:48:25 2009 (r3937)
> @@ -37,9 +37,34 @@ typedef struct MpegTSSection {
> void *opaque;
> } MpegTSSection;
>
> +typedef struct MpegTSService {
> + MpegTSSection pmt; /* MPEG2 pmt table context */
> + int sid; /* service ID */
> + char *name;
> + char *provider_name;
> + int pcr_pid;
> +} MpegTSService;
> +
> +typedef struct MpegTSWrite {
> + MpegTSSection pat; /* MPEG2 pat table */
> + MpegTSSection sdt; /* MPEG2 sdt table context */
> + MpegTSService **services;
> + int sdt_packet_count;
> + int sdt_packet_freq;
> + int pat_packet_count;
> + int pat_packet_freq;
> + int nb_services;
> + int onid;
> + int tsid;
> + int64_t last_pcr; ///< last program clock reference */
> + int64_t cur_pcr; ///< last program clock reference */
> + int mux_rate;
> +} MpegTSWrite;
> +
> /* NOTE: 4 bytes must be left at the end for the crc32 */
> static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
> {
> + MpegTSWrite *ts = ((AVFormatContext*)s->opaque)->priv_data;
> unsigned int crc;
> unsigned char packet[TS_PACKET_SIZE];
> const unsigned char *buf_ptr;
> @@ -81,6 +106,7 @@ static void mpegts_write_section(MpegTSS
>
> buf_ptr += len1;
> len -= len1;
> + ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
Why 8?
> }
> }
>
> @@ -151,30 +177,6 @@ typedef struct MpegTSWriteStream {
> uint8_t payload[DEFAULT_PES_PAYLOAD_SIZE];
> } MpegTSWriteStream;
>
> -typedef struct MpegTSService {
> - MpegTSSection pmt; /* MPEG2 pmt table context */
> - int sid; /* service ID */
> - char *name;
> - char *provider_name;
> - int pcr_pid;
> -} MpegTSService;
> -
> -typedef struct MpegTSWrite {
> - MpegTSSection pat; /* MPEG2 pat table */
> - MpegTSSection sdt; /* MPEG2 sdt table context */
> - MpegTSService **services;
> - int sdt_packet_count;
> - int sdt_packet_freq;
> - int pat_packet_count;
> - int pat_packet_freq;
> - int nb_services;
> - int onid;
> - int tsid;
> - int64_t last_pcr; ///< last program clock reference */
> - int64_t cur_pcr; ///< last program clock reference */
> - int mux_rate;
> -} MpegTSWrite;
> -
> static void mpegts_write_pat(AVFormatContext *s)
> {
> MpegTSWrite *ts = s->priv_data;
> @@ -580,7 +582,7 @@ static void mpegts_write_pes(AVFormatCon
> payload += len;
> payload_size -= len;
> put_buffer(s->pb, buf, TS_PACKET_SIZE);
> - ts->cur_pcr += (TS_PACKET_SIZE+write_pcr)*8*90000LL / ts->mux_rate;
> + ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
And again...
> }
> put_flush_packet(s->pb);
> }
> _______________________________________________
> FFmpeg-soc mailing list
> FFmpeg-soc at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc
>
It seems like you assume each SI section duration is 8 packets long.
Am I correct?
Anyway, this does not seem too accurate to me. Have we abandoned the
former method of calculating each written SI packet?
Tomer
More information about the FFmpeg-soc
mailing list