[FFmpeg-devel] [PATCH]pes packetizer
Michael Niedermayer
michaelni
Fri Jun 29 22:45:29 CEST 2007
Hi
On Fri, Jun 29, 2007 at 09:36:27AM +0800, realsun wrote:
[...]
> Index: pes.h
> ===================================================================
> --- pes.h (revision 0)
> +++ pes.h (revision 0)
> @@ -0,0 +1,159 @@
[...]
> +static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
putting tables into headers will cause them to be duplicated in every
object which used the header
[...]
> id = stream->id;
> - if (id == 0xbd && stream->max_buffer_size > P_STD_max_mpeg_PS1) {
> - P_STD_max_mpeg_PS1 = stream->max_buffer_size;
> - } else if (id >= 0xc0 && id <= 0xc7 && stream->max_buffer_size > P_STD_max_mpeg_audio) {
> - P_STD_max_mpeg_audio = stream->max_buffer_size;
> - } else if (id == 0xe0 && stream->max_buffer_size > P_STD_max_video) {
> - P_STD_max_video = stream->max_buffer_size;
> + if (id == 0xbd && pes_stream->max_buffer_size > P_STD_max_mpeg_PS1) {
> + P_STD_max_mpeg_PS1 = pes_stream->max_buffer_size;
> + } else if (id >= 0xc0 && id <= 0xc7 && pes_stream->max_buffer_size > P_STD_max_mpeg_audio) {
> + P_STD_max_mpeg_audio = pes_stream->max_buffer_size;
> + } else if (id == 0xe0 && pes_stream->max_buffer_size > P_STD_max_video) {
> + P_STD_max_video = pes_stream->max_buffer_size;
> }
> }
cosmetic
[...]
> + if (startcode == PRIVATE_STREAM_1) {
> + bytestream_put_byte(&p, id);
> + if (id >= 0xa0) {
> + /* LPCM (XXX: check nb_frames) */
> + bytestream_put_byte(&p, 7);
> + bytestream_put_be16(&p, 4); /* skip 3 header bytes */
>
> - nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
> + bytestream_put_byte(&p, stream->lpcm_header[0]);
> + bytestream_put_byte(&p, stream->lpcm_header[1]);
> + bytestream_put_byte(&p, stream->lpcm_header[2]);
[...]
> - if (startcode == PRIVATE_STREAM_1) {
> - put_byte(&ctx->pb, id);
> - if (id >= 0xa0) {
> - /* LPCM (XXX: check nb_frames) */
> - put_byte(&ctx->pb, 7);
> - put_be16(&ctx->pb, 4); /* skip 3 header bytes */
> - put_byte(&ctx->pb, stream->lpcm_header[0]);
> - put_byte(&ctx->pb, stream->lpcm_header[1]);
> - put_byte(&ctx->pb, stream->lpcm_header[2]);
this could be in a seperate patch
[...]
> -static int get_nb_frames(AVFormatContext *ctx, StreamInfo *stream, int len){
> +int ff_get_nb_frames(AVFormatContext *ctx, PESStream *stream, int len){
renames should be in a seperate patch
[...]
> + if (pes_flags & 0x80) /*write pts*/
> + put_timestamp(&ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
> + if (pes_flags & 0x40) /*write dts*/
> + put_timestamp(&ctx->pb, 0x01, dts);
>
> - put_byte(&ctx->pb, pes_flags); /* flags */
> - put_byte(&ctx->pb, header_len - 3 + stuffing_size);
> + if (pes_flags & 0x01) { /*write pes extension*/
> + put_byte(&ctx->pb, 0x10); /* flags */
>
> - if (pes_flags & 0x80) /*write pts*/
> - put_timestamp(&ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
> - if (pes_flags & 0x40) /*write dts*/
> - put_timestamp(&ctx->pb, 0x01, dts);
> -
> - if (pes_flags & 0x01) { /*write pes extension*/
> - put_byte(&ctx->pb, 0x10); /* flags */
cosmetic
[...]
> @@ -1000,31 +169,25 @@
> break;
> }
> stream->buffer_index -= pkt_desc->size;
> -
> stream->predecode_packet= pkt_desc->next;
> av_freep(&pkt_desc);
> }
> }
> -
> return 0;
cosmetic
[...]
> stream = ctx->streams[i]->priv_data;
> -
> assert(av_fifo_size(&stream->fifo) == 0);
cosmetic
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070629/df55d411/attachment.pgp>
More information about the ffmpeg-devel
mailing list