Author: fejj
Date: 2008-01-23 16:24:07 -0500 (Wed, 23 Jan 2008)
New Revision: 93715

Modified:
   trunk/moon/src/pipeline.cpp
   trunk/moon/src/pipeline.h
Log:
consistently use int64_t for pts values

Modified: trunk/moon/src/pipeline.cpp
===================================================================
--- trunk/moon/src/pipeline.cpp 2008-01-23 21:16:11 UTC (rev 93714)
+++ trunk/moon/src/pipeline.cpp 2008-01-23 21:24:07 UTC (rev 93715)
@@ -194,7 +194,7 @@
 }
 
 MediaResult
-Media::Seek (uint64_t pts)
+Media::Seek (int64_t pts)
 {
        if (demuxer)
                return demuxer->Seek (pts);
@@ -203,7 +203,7 @@
 }
 
 MediaResult
-Media::SeekAsync (uint64_t pts)
+Media::SeekAsync (int64_t pts)
 {
        if (demuxer == NULL)
                return MEDIA_FAIL;
@@ -649,7 +649,7 @@
 }
 
 MediaResult
-ASFDemuxer::Seek (uint64_t pts)
+ASFDemuxer::Seek (int64_t pts)
 {
        if (reader == NULL)
                reader = new ASFFrameReader (parser);
@@ -679,7 +679,7 @@
        List *markers = media->GetMarkers ();
        //guint64 preroll = parser->file_properties->preroll;
        const char *type;
-       uint64_t pts;
+       int64_t pts;
        char *text;
        int i = -1;
        
@@ -697,23 +697,24 @@
                }
        }
        
-       i = -1;
-       while (commands != NULL && commands [++i] != NULL) {
-               asf_script_command_entry *entry = commands [i];
-               
-               text = entry->get_name ();
-               pts = entry->pts; //(entry->pts - preroll) * 10000;
-               
-               if (entry->type_index + 1 <= command->command_type_count)
-                       type = command_types [entry->type_index];
-               else
-                       type = "";
-               
-               markers->Append (new MediaMarker::Node (new MediaMarker (type, 
text, pts)));
-               
-               //printf ("MediaElement::ReadMarkers () Added script command at 
%llu (text: %s, type: %s)\n", pts, text, type);
-               
-               g_free (text);
+       if (commands != NULL) {
+               for (i = 0; commands[i]; i++) {
+                       asf_script_command_entry *entry = commands [i];
+                       
+                       text = entry->get_name ();
+                       pts = entry->pts; //(entry->pts - preroll) * 10000;
+                       
+                       if (entry->type_index + 1 <= 
command->command_type_count)
+                               type = command_types [entry->type_index];
+                       else
+                               type = "";
+                       
+                       markers->Append (new MediaMarker::Node (new MediaMarker 
(type, text, pts)));
+                       
+                       //printf ("MediaElement::ReadMarkers () Added script 
command at %llu (text: %s, type: %s)\n", pts, text, type);
+                       
+                       g_free (text);
+               }
        }
        
        // Read the MARKERs
@@ -1246,7 +1247,7 @@
 }
 
 void
-Mp3FrameReader::AddFrameIndex (int64_t offset, uint64_t pts, uint32_t dur, 
int32_t bit_rate)
+Mp3FrameReader::AddFrameIndex (int64_t offset, int64_t pts, uint32_t dur, 
int32_t bit_rate)
 {
        if (used == avail) {
                avail += MPEG_JUMP_TABLE_GROW_SIZE;
@@ -1279,9 +1280,9 @@
 #define MID(lo, hi) (lo + ((hi - lo) >> 1))
 
 uint32_t
-Mp3FrameReader::MpegFrameSearch (uint64_t pts)
+Mp3FrameReader::MpegFrameSearch (int64_t pts)
 {
-       uint64_t start, end;
+       int64_t start, end;
        uint32_t hi = used - 1;
        uint32_t m = hi >> 1;
        uint32_t lo = 0;
@@ -1310,11 +1311,11 @@
 }
 
 bool
-Mp3FrameReader::Seek (uint64_t pts)
+Mp3FrameReader::Seek (int64_t pts)
 {
        int64_t offset = stream->GetPosition ();
        int32_t bit_rate = this->bit_rate;
-       uint64_t cur_pts = this->cur_pts;
+       int64_t cur_pts = this->cur_pts;
        uint32_t frame;
        
        if (pts == cur_pts)
@@ -1510,7 +1511,7 @@
 }
 
 MediaResult
-Mp3Demuxer::Seek (uint64_t pts)
+Mp3Demuxer::Seek (int64_t pts)
 {
        if (reader && reader->Seek (pts))
                return MEDIA_SUCCESS;
@@ -2438,7 +2439,7 @@
  * MediaMarker
  */ 
 
-MediaMarker::MediaMarker (const char *type, const char *text, uint64_t pts)
+MediaMarker::MediaMarker (const char *type, const char *text, int64_t pts)
 {
        this->type = g_strdup (type);
        this->text = g_strdup (text);

Modified: trunk/moon/src/pipeline.h
===================================================================
--- trunk/moon/src/pipeline.h   2008-01-23 21:16:11 UTC (rev 93714)
+++ trunk/moon/src/pipeline.h   2008-01-23 21:24:07 UTC (rev 93715)
@@ -209,7 +209,7 @@
        public:
                MediaFrame *frame;
                uint16_t states;
-               uint64_t seek_pts; // Seek to this pts. If frame is NULL, then 
this is valid and what the FrameReaderLoop should do
+               int64_t seek_pts; // Seek to this pts. If frame is NULL, then 
this is valid and what the FrameReaderLoop should do
                WorkNode () : frame (NULL), states (0), seek_pts (0) {}
        };
        
@@ -263,8 +263,8 @@
        MediaResult Open (IMediaSource *source); // Called if you have your own 
source
        
        // Seeks to the specified pts (if seekable).
-       MediaResult Seek (uint64_t pts);
-       MediaResult SeekAsync (uint64_t pts);
+       MediaResult Seek (int64_t pts);
+       MediaResult SeekAsync (int64_t pts);
        
        //      Reads the next frame from the demuxer
        //      Requests the decoder to decode the frame
@@ -324,7 +324,7 @@
        
        IMediaStream *stream;
        void *decoder_specific_data; // data specific to the decoder
-       uint64_t pts; // Set by the demuxer
+       int64_t pts; // Set by the demuxer
        uint64_t duration; // Set by the demuxer
        
        uint16_t state; // Current state of the frame
@@ -343,7 +343,7 @@
 };
 
 class MediaMarker {
-       uint64_t pts;
+       int64_t pts;
        char *type;
        char *text;
        
@@ -355,12 +355,12 @@
                MediaMarker *marker;
        };
        
-       MediaMarker (const char *type, const char *text, uint64_t pts);
+       MediaMarker (const char *type, const char *text, int64_t pts);
        ~MediaMarker ();
        
        const char *Type () { return type; }
        const char *Text () { return text; }
-       uint64_t Pts () { return pts; }
+       int64_t Pts () { return pts; }
 };
 
 // Interfaces
@@ -436,7 +436,7 @@
        virtual MediaResult ReadHeader () = 0;
        // Fills the uncompressed_data field in the frame with data.
        virtual MediaResult ReadFrame (MediaFrame *frame) = 0;
-       virtual MediaResult Seek (guint64 pts) = 0;
+       virtual MediaResult Seek (int64_t pts) = 0;
        int GetStreamCount () { return stream_count; }
        IMediaStream *GetStream (int index)
        {
@@ -609,7 +609,7 @@
        IImageConverter *converter; // This stream has the ownership of the 
converter, it will be deleted upon destruction.
        uint32_t bits_per_sample;
        uint32_t msec_per_frame;
-       uint64_t initial_pts;
+       int64_t initial_pts;
        uint32_t height;
        uint32_t width;
        
@@ -648,7 +648,7 @@
        
        virtual MediaResult ReadHeader ();
        virtual MediaResult ReadFrame (MediaFrame *frame);
-       virtual MediaResult Seek (uint64_t pts);
+       virtual MediaResult Seek (int64_t pts);
        
        ASFParser *GetParser () { return parser; }
 };
@@ -686,8 +686,8 @@
 
 struct MpegFrame {
        int64_t offset;
-       uint64_t pts;
        uint32_t dur;
+       int64_t pts;
        
        // this is needed in case this frame did not specify it's own
        // bit rate which is possible for MPEG-1 Layer 3 audio.
@@ -697,15 +697,15 @@
 class Mp3FrameReader {
        IMediaSource *stream;
        int64_t stream_start;
-       uint64_t cur_pts;
        int32_t bit_rate;
+       int64_t cur_pts;
        
        MpegFrame *jmptab;
        uint32_t avail;
        uint32_t used;
        
-       uint32_t MpegFrameSearch (uint64_t pts);
-       void AddFrameIndex (int64_t offset, uint64_t pts, uint32_t dur, int32_t 
bit_rate);
+       uint32_t MpegFrameSearch (int64_t pts);
+       void AddFrameIndex (int64_t offset, int64_t pts, uint32_t dur, int32_t 
bit_rate);
        
        bool SkipFrame ();
        
@@ -713,7 +713,7 @@
        Mp3FrameReader (IMediaSource *source, int64_t start);
        ~Mp3FrameReader ();
        
-       bool Seek (uint64_t pts);
+       bool Seek (int64_t pts);
        
        MediaResult ReadFrame (MediaFrame *frame);
 };
@@ -727,7 +727,7 @@
        
        virtual MediaResult ReadHeader ();
        virtual MediaResult ReadFrame (MediaFrame *frame);
-       virtual MediaResult Seek (uint64_t pts);
+       virtual MediaResult Seek (int64_t pts);
 };
 
 class Mp3DemuxerInfo : public DemuxerInfo {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to