[FFmpeg-soc] [soc]: r489 - in dvbmuxer: mpeg_pes.h mpeg_pes_enc.c pes.diff

realsun subversion at mplayerhq.hu
Thu Jul 19 13:52:30 CEST 2007


Author: realsun
Date: Thu Jul 19 13:52:30 2007
New Revision: 489

Log:
fix a bug to pass regression test.

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	Thu Jul 19 13:52:30 2007
@@ -116,7 +116,7 @@ void ff_pes_write_packet(AVFormatContext
  * @param[out] best_i      index of stream to be muxed
  * @return  On error a negative or zero value is returned, on success 1 is returned.
  */
-int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t scr, int* best_i);
+int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t *scr, int* best_i);
 
 /**
  * Get total number of frames that have been muxed.

Modified: dvbmuxer/mpeg_pes_enc.c
==============================================================================
--- dvbmuxer/mpeg_pes_enc.c	(original)
+++ dvbmuxer/mpeg_pes_enc.c	Thu Jul 19 13:52:30 2007
@@ -180,7 +180,7 @@ 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 ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t *scr, int* best_i)
 {
     int i, avail_space;
     int best_score= INT_MIN;
@@ -208,7 +208,7 @@ retry:
         if(space < packet_size && !ignore_constraints)
             continue;
 
-        if(next_pkt && next_pkt->dts - scr > max_delay)
+        if(next_pkt && next_pkt->dts - *scr > max_delay)
             continue;
 
         if(rel_space > best_score){
@@ -236,12 +236,12 @@ retry:
         if(best_dts == INT64_MAX)
             return 0;
 
-        if(scr >= best_dts+1 && !ignore_constraints){
+        if(*scr >= best_dts+1 && !ignore_constraints){
             av_log(ctx, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n");
             ignore_constraints= 1;
         }
-        scr= FFMAX(best_dts+1, scr);
-        if(ff_pes_remove_decoded_packets(ctx, scr) < 0)
+        *scr= FFMAX(best_dts+1, *scr);
+        if(ff_pes_remove_decoded_packets(ctx, *scr) < 0)
             return -1;
         goto retry;
     }
@@ -272,8 +272,8 @@ void ff_pes_write_packet(AVFormatContext
         stream->next_packet = &stream->premux_packet;
     *stream->next_packet=
     pkt_desc= av_mallocz(sizeof(PacketDesc));
-    pkt_desc->pts= pkt->pts;
-    pkt_desc->dts= pkt->dts;
+    pkt_desc->pts= pts;
+    pkt_desc->dts= dts;
     pkt_desc->unwritten_size=
     pkt_desc->size= size;
     if(!stream->predecode_packet)

Modified: dvbmuxer/pes.diff
==============================================================================
--- dvbmuxer/pes.diff	(original)
+++ dvbmuxer/pes.diff	Thu Jul 19 13:52:30 2007
@@ -1015,7 +1015,7 @@ Index: mpeg_pes_enc.c
 -    int i, avail_space, es_size, trailer_size;
 -    int best_i= -1;
 +
-+int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t scr, int* best_i)
++int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t *scr, int* best_i)
 +{
 +    int i, avail_space;
      int best_score= INT_MIN;
@@ -1032,7 +1032,7 @@ Index: mpeg_pes_enc.c
          const int avail_data=  av_fifo_size(&stream->fifo);
          const int space= stream->max_buffer_size - stream->buffer_index;
          int rel_space= 1024*space / stream->max_buffer_size;
-@@ -1032,14 +198,14 @@
+@@ -1032,32 +198,32 @@
  
          /* for subtitle, a single PES packet must be generated,
             so we flush after every single subtitle packet */
@@ -1048,8 +1048,9 @@ Index: mpeg_pes_enc.c
 +        if(space < packet_size && !ignore_constraints)
              continue;
  
-         if(next_pkt && next_pkt->dts - scr > max_delay)
-@@ -1047,17 +213,17 @@
+-        if(next_pkt && next_pkt->dts - scr > max_delay)
++        if(next_pkt && next_pkt->dts - *scr > max_delay)
+             continue;
  
          if(rel_space > best_score){
              best_score= rel_space;
@@ -1070,12 +1071,19 @@ Index: mpeg_pes_enc.c
              PacketDesc *pkt_desc= stream->predecode_packet;
              if(pkt_desc && pkt_desc->dts < best_dts)
                  best_dts= pkt_desc->dts;
-@@ -1075,75 +241,25 @@
+@@ -1070,80 +236,30 @@
+         if(best_dts == INT64_MAX)
+             return 0;
+ 
+-        if(scr >= best_dts+1 && !ignore_constraints){
++        if(*scr >= best_dts+1 && !ignore_constraints){
+             av_log(ctx, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n");
              ignore_constraints= 1;
          }
-         scr= FFMAX(best_dts+1, scr);
+-        scr= FFMAX(best_dts+1, scr);
 -        if(remove_decoded_packets(ctx, scr) < 0)
-+        if(ff_pes_remove_decoded_packets(ctx, scr) < 0)
++        *scr= FFMAX(best_dts+1, *scr);
++        if(ff_pes_remove_decoded_packets(ctx, *scr) < 0)
              return -1;
          goto retry;
      }
@@ -1151,17 +1159,6 @@ Index: mpeg_pes_enc.c
  
      pts= pkt->pts;
      dts= pkt->dts;
-@@ -1156,8 +272,8 @@
-         stream->next_packet = &stream->premux_packet;
-     *stream->next_packet=
-     pkt_desc= av_mallocz(sizeof(PacketDesc));
--    pkt_desc->pts= pts;
--    pkt_desc->dts= dts;
-+    pkt_desc->pts= pkt->pts;
-+    pkt_desc->dts= pkt->dts;
-     pkt_desc->unwritten_size=
-     pkt_desc->size= size;
-     if(!stream->predecode_packet)
 @@ -1165,126 +281,19 @@
      stream->next_packet= &pkt_desc->next;
  
@@ -1294,7 +1291,7 @@ Index: mpeg_pes_enc.c
 -#endif
 Index: Makefile
 ===================================================================
---- Makefile	(revision 9693)
+--- Makefile	(revision 9756)
 +++ Makefile	(working copy)
 @@ -84,13 +84,13 @@
  OBJS-$(CONFIG_MP3_MUXER)                 += mp3.o
@@ -1317,7 +1314,7 @@ Index: Makefile
  OBJS-$(CONFIG_MPEGTSRAW_DEMUXER)         += mpegts.o
 Index: mpeg.c
 ===================================================================
---- mpeg.c	(revision 9693)
+--- mpeg.c	(revision 9756)
 +++ mpeg.c	(working copy)
 @@ -21,6 +21,7 @@
  
@@ -1347,7 +1344,7 @@ Index: mpeg.c
      }
 Index: mpeg.h
 ===================================================================
---- mpeg.h	(revision 9693)
+--- mpeg.h	(revision 9756)
 +++ mpeg.h	(working copy)
 @@ -55,6 +55,5 @@
  #define STREAM_TYPE_AUDIO_AC3       0x81
@@ -1358,7 +1355,7 @@ Index: mpeg.h
  #endif /* AVFORMAT_MPEG_H */
 Index: mpegenc.c
 ===================================================================
---- mpegenc.c	(revision 9693)
+--- mpegenc.c	(revision 9756)
 +++ mpegenc.c	(working copy)
 @@ -22,8 +22,10 @@
  #include "avformat.h"
@@ -1763,7 +1760,7 @@ Index: mpegenc.c
 -        const int space= stream->max_buffer_size - stream->buffer_index;
 -        int rel_space= 1024*space / stream->max_buffer_size;
 -        PacketDesc *next_pkt= stream->premux_packet;
-+    if((result = ff_pes_find_beststream(ctx, s->packet_size, flush, scr, &best_i)) <= 0)
++    if((result = ff_pes_find_beststream(ctx, s->packet_size, flush, &scr, &best_i)) <= 0)
 +        return result;
  
 -        /* for subtitle, a single PES packet must be generated,
@@ -2052,7 +2049,7 @@ Index: mpeg_pes.h
 + * @param[out] best_i      index of stream to be muxed
 + * @return  On error a negative or zero value is returned, on success 1 is returned.
 + */
-+int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t scr, int* best_i);
++int ff_pes_find_beststream(AVFormatContext *ctx, int packet_size, int flush, int64_t *scr, int* best_i);
 +
 +/**
 + * Get total number of frames that have been muxed.



More information about the FFmpeg-soc mailing list