[FFmpeg-soc] [soc]: r432 - in dvbmuxer: mpeg_pes.h mpeg_pes_enc.c pes.diff
realsun
subversion at mplayerhq.hu
Sun Jul 15 09:48:28 CEST 2007
Author: realsun
Date: Sun Jul 15 09:48:28 2007
New Revision: 432
Log:
changed ff_lpcm_freq_tab to ff_dvd_lpcm_freq_tab and some other small changes.
Modified:
dvbmuxer/mpeg_pes.h
dvbmuxer/mpeg_pes_enc.c
dvbmuxer/pes.diff
Modified: dvbmuxer/mpeg_pes.h
==============================================================================
--- dvbmuxer/mpeg_pes.h (original)
+++ dvbmuxer/mpeg_pes.h Sun Jul 15 09:48:28 2007
@@ -154,7 +154,7 @@ int ff_pes_muxer_write(AVFormatContext *
*/
int ff_pes_remove_decoded_packets(AVFormatContext *ctx, int64_t scr);
-/*
+/**
* Insert a timestamp into the ByteIOContext.
* @param[in] pb the ByteIOContext to be written to
* @param[in] id stream ID
Modified: dvbmuxer/mpeg_pes_enc.c
==============================================================================
--- dvbmuxer/mpeg_pes_enc.c (original)
+++ dvbmuxer/mpeg_pes_enc.c Sun Jul 15 09:48:28 2007
@@ -30,7 +30,7 @@ int ff_pes_muxer_init(AVFormatContext *c
for(i=0;i<ctx->nb_streams;i++) {
st = ctx->streams[i];
- stream = (PESStream*)st->priv_data;
+ stream = st->priv_data;
av_set_pts_info(st, 64, 1, 90000);
switch(st->codec->codec_type) {
@@ -138,10 +138,10 @@ int ff_pes_muxer_write(AVFormatContext *
/* special stuffing byte that is always written
to prevent accidental generation of startcodes. */
- put_byte(&ctx->pb, 0xff);
+ put_byte(&ctx->pb, 0xff);
- for(i=0;i<stuffing_size;i++)
- put_byte(&ctx->pb, 0xff);
+ for(i=0;i<stuffing_size;i++)
+ put_byte(&ctx->pb, 0xff);
put_buffer(&ctx->pb, pes_content, pes_content_len);
@@ -182,9 +182,9 @@ int ff_pes_remove_decoded_packets(AVForm
int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t scr, int* best_i)
{
- int best_score = INT_MIN;
- int i, avail_space = 0;
- int ignore_constraints = 0;
+ int i, avail_space;
+ int best_score= INT_MIN;
+ int ignore_constraints=0;
const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE);
retry:
@@ -253,12 +253,12 @@ retry:
void ff_pes_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
int stream_index= pkt->stream_index;
- AVStream *st = ctx->streams[stream_index];
- PESStream *stream = st->priv_data;
- PacketDesc *pkt_desc;
int size= pkt->size;
uint8_t *buf= pkt->data;
+ AVStream *st = ctx->streams[stream_index];
+ PESStream *stream = st->priv_data;
int64_t pts, dts;
+ PacketDesc *pkt_desc;
const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
pts= pkt->pts;
@@ -267,6 +267,7 @@ void ff_pes_write_packet(AVFormatContext
if(pts != AV_NOPTS_VALUE) pts += preload;
if(dts != AV_NOPTS_VALUE) dts += preload;
+//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
if (!stream->premux_packet)
stream->next_packet = &stream->premux_packet;
*stream->next_packet=
Modified: dvbmuxer/pes.diff
==============================================================================
--- dvbmuxer/pes.diff (original)
+++ dvbmuxer/pes.diff Sun Jul 15 09:48:28 2007
@@ -322,7 +322,7 @@ Index: mpeg_pes_enc.c
- goto fail;
- st->priv_data = stream;
-
-+ stream = (PESStream*)st->priv_data;
++ stream = st->priv_data;
av_set_pts_info(st, 64, 1, 90000);
switch(st->codec->codec_type) {
@@ -889,15 +889,12 @@ Index: mpeg_pes_enc.c
- if (s->is_mpeg2) {
/* special stuffing byte that is always written
- to prevent accidental generation of start codes. */
-- put_byte(&ctx->pb, 0xff);
+ to prevent accidental generation of startcodes. */
-+ put_byte(&ctx->pb, 0xff);
+ put_byte(&ctx->pb, 0xff);
-- for(i=0;i<stuffing_size;i++)
-- put_byte(&ctx->pb, 0xff);
+ for(i=0;i<stuffing_size;i++)
+ put_byte(&ctx->pb, 0xff);
- }
-+ for(i=0;i<stuffing_size;i++)
-+ put_byte(&ctx->pb, 0xff);
- if (startcode == PRIVATE_STREAM_1) {
- put_byte(&ctx->pb, id);
@@ -1017,16 +1014,14 @@ Index: mpeg_pes_enc.c
- StreamInfo *stream;
- int i, avail_space, es_size, trailer_size;
- int best_i= -1;
-- int best_score= INT_MIN;
-- int ignore_constraints=0;
-- int64_t scr= s->last_scr;
-- PacketDesc *timestamp_packet;
+
+int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t scr, int* best_i)
+{
-+ int best_score = INT_MIN;
-+ int i, avail_space = 0;
-+ int ignore_constraints = 0;
++ int i, avail_space;
+ int best_score= INT_MIN;
+ int ignore_constraints=0;
+- int64_t scr= s->last_scr;
+- PacketDesc *timestamp_packet;
const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE);
retry:
@@ -1144,26 +1139,19 @@ Index: mpeg_pes_enc.c
{
- MpegMuxContext *s = ctx->priv_data;
int stream_index= pkt->stream_index;
-+ AVStream *st = ctx->streams[stream_index];
-+ PESStream *stream = st->priv_data;
-+ PacketDesc *pkt_desc;
int size= pkt->size;
uint8_t *buf= pkt->data;
-- AVStream *st = ctx->streams[stream_index];
+ AVStream *st = ctx->streams[stream_index];
- StreamInfo *stream = st->priv_data;
++ PESStream *stream = st->priv_data;
int64_t pts, dts;
-- PacketDesc *pkt_desc;
+ PacketDesc *pkt_desc;
const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
- const int is_iframe = st->codec->codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
pts= pkt->pts;
dts= pkt->dts;
-@@ -1151,13 +267,12 @@
- if(pts != AV_NOPTS_VALUE) pts += preload;
- if(dts != AV_NOPTS_VALUE) dts += preload;
-
--//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
- if (!stream->premux_packet)
+@@ -1156,8 +272,8 @@
stream->next_packet = &stream->premux_packet;
*stream->next_packet=
pkt_desc= av_mallocz(sizeof(PacketDesc));
@@ -1174,7 +1162,7 @@ Index: mpeg_pes_enc.c
pkt_desc->unwritten_size=
pkt_desc->size= size;
if(!stream->predecode_packet)
-@@ -1165,126 +280,19 @@
+@@ -1165,126 +281,19 @@
stream->next_packet= &pkt_desc->next;
av_fifo_realloc(&stream->fifo, av_fifo_size(&stream->fifo) + size + 1);
@@ -1306,7 +1294,7 @@ Index: mpeg_pes_enc.c
-#endif
Index: Makefile
===================================================================
---- Makefile (revision 9635)
+--- Makefile (revision 9682)
+++ Makefile (working copy)
@@ -84,13 +84,13 @@
OBJS-$(CONFIG_MP3_MUXER) += mp3.o
@@ -1326,10 +1314,10 @@ Index: Makefile
+OBJS-$(CONFIG_MPEG2VOB_MUXER) += mpegenc.o mpeg_pes_enc.o
OBJS-$(CONFIG_MPEGPS_DEMUXER) += mpeg.o
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpegts.o
- OBJS-$(CONFIG_MPEGTS_MUXER) += mpegtsenc.o
+ OBJS-$(CONFIG_MPEGTSRAW_DEMUXER) += mpegts.o
Index: mpeg.c
===================================================================
---- mpeg.c (revision 9635)
+--- mpeg.c (revision 9682)
+++ mpeg.c (working copy)
@@ -21,6 +21,7 @@
@@ -1343,7 +1331,7 @@ Index: mpeg.c
#define MAX_SYNC_SIZE 100000
-+extern const int ff_lpcm_freq_tab[4];
++extern const int ff_dvb_lpcm_freq_tab[4];
+
static int cdxa_probe(AVProbeData *p)
{
@@ -1353,13 +1341,13 @@ Index: mpeg.c
len -= 3;
freq = (b1 >> 4) & 3;
- st->codec->sample_rate = lpcm_freq_tab[freq];
-+ st->codec->sample_rate = ff_lpcm_freq_tab[freq];
++ st->codec->sample_rate = ff_dvb_lpcm_freq_tab[freq];
st->codec->channels = 1 + (b1 & 7);
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
}
Index: mpeg.h
===================================================================
---- mpeg.h (revision 9635)
+--- mpeg.h (revision 9682)
+++ mpeg.h (working copy)
@@ -55,6 +55,5 @@
#define STREAM_TYPE_AUDIO_AC3 0x81
@@ -1370,7 +1358,7 @@ Index: mpeg.h
#endif /* AVFORMAT_MPEG_H */
Index: mpegenc.c
===================================================================
---- mpegenc.c (revision 9635)
+--- mpegenc.c (revision 9682)
+++ mpegenc.c (working copy)
@@ -22,8 +22,10 @@
#include "avformat.h"
@@ -1420,7 +1408,7 @@ Index: mpegenc.c
} MpegMuxContext;
-+const int ff_lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000};
++const int ff_dvb_lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000};
+
static int put_pack_header(AVFormatContext *ctx,
uint8_t *buf, int64_t timestamp)
@@ -1460,16 +1448,16 @@ Index: mpegenc.c
}
}
}
-@@ -332,7 +326,7 @@
+@@ -334,7 +328,7 @@
} else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for(j = 0; j < 4; j++) {
- if (lpcm_freq_tab[j] == st->codec->sample_rate)
-+ if (ff_lpcm_freq_tab[j] == st->codec->sample_rate)
++ if (ff_dvb_lpcm_freq_tab[j] == st->codec->sample_rate)
break;
}
if (j == 4)
-@@ -346,44 +340,30 @@
+@@ -348,37 +342,23 @@
} else {
stream->id = mpa_id++;
}
@@ -1511,15 +1499,7 @@ Index: mpegenc.c
bitrate = 0;
audio_bitrate = 0;
video_bitrate = 0;
- for(i=0;i<ctx->nb_streams;i++) {
- int codec_rate;
- st = ctx->streams[i];
-- stream = (StreamInfo*) st->priv_data;
-+ stream = st->priv_data;
-
- if(st->codec->rc_max_rate || stream->id==VIDEO_ID)
- codec_rate= st->codec->rc_max_rate;
-@@ -476,17 +456,6 @@
+@@ -478,17 +458,6 @@
return AVERROR(ENOMEM);
}
@@ -1537,7 +1517,7 @@ Index: mpegenc.c
/* return the number of padding bytes that should be inserted into
the multiplexed stream.*/
static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts)
-@@ -615,35 +584,24 @@
+@@ -617,35 +586,24 @@
put_byte(pb, 0xff);
}
@@ -1578,7 +1558,7 @@ Index: mpegenc.c
id = stream->id;
-@@ -780,7 +738,7 @@
+@@ -782,7 +740,7 @@
startcode = 0x100 + id;
}
@@ -1587,7 +1567,7 @@ Index: mpegenc.c
// first byte does not fit -> reset pts/dts + stuffing
if(payload_size <= trailer_size && pts != AV_NOPTS_VALUE){
-@@ -821,94 +779,54 @@
+@@ -823,94 +781,54 @@
payload_size -= stuffing_size;
stuffing_size = 0;
}
@@ -1711,7 +1691,7 @@ Index: mpegenc.c
stream->bytes_to_iframe -= payload_size - stuffing_size;
}else{
payload_size=
-@@ -931,6 +849,16 @@
+@@ -933,6 +851,16 @@
if (!general_pack)
stream->packet_number++;
@@ -1728,7 +1708,7 @@ Index: mpegenc.c
return payload_size - stuffing_size;
}
-@@ -981,105 +909,19 @@
+@@ -983,105 +911,19 @@
}
#endif
@@ -1839,7 +1819,7 @@ Index: mpegenc.c
assert(best_i >= 0);
st = ctx->streams[best_i];
-@@ -1087,8 +929,6 @@
+@@ -1089,8 +931,6 @@
assert(av_fifo_size(&stream->fifo) > 0);
@@ -1848,7 +1828,7 @@ Index: mpegenc.c
timestamp_packet= stream->premux_packet;
if(timestamp_packet->unwritten_size == timestamp_packet->size){
trailer_size= 0;
-@@ -1116,17 +956,9 @@
+@@ -1118,17 +958,9 @@
}
}
@@ -1867,7 +1847,7 @@ Index: mpegenc.c
return -1;
return 1;
-@@ -1136,39 +968,18 @@
+@@ -1138,39 +970,18 @@
{
MpegMuxContext *s = ctx->priv_data;
int stream_index= pkt->stream_index;
@@ -1912,7 +1892,7 @@ Index: mpegenc.c
stream->align_iframe = 1;
stream->vobu_start_pts = pts;
} else {
-@@ -1176,7 +987,6 @@
+@@ -1178,7 +989,6 @@
}
}
@@ -1920,7 +1900,7 @@ Index: mpegenc.c
for(;;){
int ret= output_packet(ctx, 0);
-@@ -1187,10 +997,6 @@
+@@ -1189,10 +999,6 @@
static int mpeg_mux_end(AVFormatContext *ctx)
{
@@ -1931,7 +1911,7 @@ Index: mpegenc.c
for(;;){
int ret= output_packet(ctx, 1);
if(ret<0)
-@@ -1199,18 +1005,13 @@
+@@ -1201,18 +1007,13 @@
break;
}
@@ -2112,7 +2092,7 @@ Index: mpeg_pes.h
+ */
+int ff_pes_remove_decoded_packets(AVFormatContext *ctx, int64_t scr);
+
-+/*
++/**
+ * Insert a timestamp into the ByteIOContext.
+ * @param[in] pb the ByteIOContext to be written to
+ * @param[in] id stream ID
More information about the FFmpeg-soc
mailing list