diff options
author | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-09 01:42:52 +0000 |
---|---|---|
committer | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-09 01:42:52 +0000 |
commit | f037400b745b5b0e28259ffd034981b7347eac84 (patch) | |
tree | bd84c843cc5d213ef7e989397d4bc403656391e5 /libmpdemux | |
parent | 0aaab951eeec66cadd1aa4aabbdaa262c8277e8e (diff) |
Changed code that used pts=0 in demux packets to indicate "not known".
Now demux_real should be usable with -correct-pts.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20810 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_real.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c index 60a2c585fd..07906ba26f 100644 --- a/libmpdemux/demux_real.c +++ b/libmpdemux/demux_real.c @@ -689,7 +689,8 @@ got_audio: for (i = 0; i < sub_packets; i++) { demux_packet_t *dp = new_demux_packet(sub_packet_lengths[i]); stream_read(demuxer->stream, dp->buffer, sub_packet_lengths[i]); - dp->pts = (priv->a_pts == timestamp) ? 0 : (timestamp / 1000.0f); + if (priv->a_pts != timestamp) + dp->pts = timestamp / 1000.0f; priv->a_pts = timestamp; dp->pos = demuxer->filepos; ds_add_packet(ds, dp); @@ -746,7 +747,7 @@ got_audio: break; } priv->audio_need_keyframe = 0; - priv->audio_timestamp[priv->sub_packet_cnt] = (priv->a_pts==timestamp) ? 0 : (timestamp/1000.0f); + priv->audio_timestamp[priv->sub_packet_cnt] = (priv->a_pts==timestamp) ? (correct_pts ? MP_NOPTS_VALUE : 0) : (timestamp/1000.0f); priv->a_pts = timestamp; if (priv->sub_packet_cnt == 0) priv->audio_filepos = demuxer->filepos; @@ -761,7 +762,8 @@ got_audio: dp = new_demux_packet(apk_usize); memcpy(dp->buffer, priv->audio_buf + x * apk_usize, apk_usize); /* Put timestamp only on packets that correspond to original audio packets in file */ - dp->pts = (x * apk_usize % w) ? 0 : priv->audio_timestamp[x * apk_usize / w]; + if (x * apk_usize % w == 0) + dp->pts = priv->audio_timestamp[x * apk_usize / w]; dp->pos = priv->audio_filepos; // all equal dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe ds_add_packet(ds, dp); @@ -803,10 +805,9 @@ got_audio: } #endif if (priv->audio_need_keyframe == 1) { - dp->pts = 0; priv->audio_need_keyframe = 0; - }else - dp->pts = (priv->a_pts==timestamp) ? 0 : (timestamp/1000.0f); + } else if(priv->a_pts != timestamp) + dp->pts = timestamp/1000.0; priv->a_pts=timestamp; dp->pos = demuxer->filepos; dp->flags = (flags & 0x2) ? 0x10 : 0; @@ -931,8 +932,8 @@ got_video: priv->kf_base = 0; priv->kf_pts = dp_hdr->timestamp; priv->video_after_seek = 0; - } else - dp->pts=(dp_hdr->len<3)?0: + } else if (dp_hdr->len >= 3) + dp->pts = real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); ds_add_packet(ds,dp); ds->asf_packet=NULL; @@ -968,8 +969,8 @@ got_video: priv->kf_base = 0; priv->kf_pts = dp_hdr->timestamp; priv->video_after_seek = 0; - } else - dp->pts=(dp_hdr->len<3)?0: + } else if (dp_hdr->len >= 3) + dp->pts = real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); ds_add_packet(ds,dp); ds->asf_packet=NULL; @@ -989,7 +990,6 @@ got_video: // create new packet! dp = new_demux_packet(sizeof(dp_hdr_t)+vpkg_length+8*(1+2*(vpkg_header&0x3F))); // the timestamp seems to be in milliseconds - dp->pts = 0; // timestamp/1000.0f; //timestamp=0; dp->pos = demuxer->filepos; dp->flags = (flags & 0x2) ? 0x10 : 0; ds->asf_seq = vpkg_seqnum; @@ -1025,8 +1025,8 @@ got_video: priv->kf_base = 0; priv->kf_pts = dp_hdr->timestamp; priv->video_after_seek = 0; - } else - dp->pts=(dp_hdr->len<3)?0: + } else if (dp_hdr->len >= 3) + dp->pts = real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); ds_add_packet(ds,dp); |