[Redbutton-devel] SF.net SVN: redbutton: [42] redbutton-browser/trunk/mpegts.c
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-05-02 15:02:17
|
Revision: 42 Author: skilvington Date: 2006-05-02 08:02:06 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=42&view=rev Log Message: ----------- return the correct PTS Modified Paths: -------------- redbutton-browser/trunk/mpegts.c Modified: redbutton-browser/trunk/mpegts.c =================================================================== --- redbutton-browser/trunk/mpegts.c 2006-05-02 13:02:15 UTC (rev 41) +++ redbutton-browser/trunk/mpegts.c 2006-05-02 15:02:06 UTC (rev 42) @@ -116,20 +116,8 @@ if((pes = add_pes_stream(ctx, packet.stream_index)) == NULL) fatal("mpegts_demux_frame: internal error"); /* is it the first packet of the next frame */ - if(ctx->is_start != 0) + if(ctx->is_start == 0) { - /* a new frame, remember its PTS (or calc from the previous one) */ - if(packet.pts == AV_NOPTS_VALUE && pes->frame_pts != AV_NOPTS_VALUE) - pes->frame_pts += 3600; - else - pes->frame_pts = packet.pts; - if(packet.dts == AV_NOPTS_VALUE && pes->frame_dts != AV_NOPTS_VALUE) - pes->frame_dts += 3600; - else - pes->frame_dts = packet.dts; - } - else - { /* not a new frame, add data to the exisiting one */ pes->frame_data = safe_realloc(pes->frame_data, pes->frame_size + packet.size); memcpy(pes->frame_data + pes->frame_size, packet.data, packet.size); @@ -141,7 +129,9 @@ /* * pes->frame_data contains the last frame + * copy it into the output packet * packet contains the first packet of the next frame + * copy it into the PES context for the stream */ if(av_new_packet(frame, pes->frame_size) != 0) return -1; @@ -156,6 +146,16 @@ pes->frame_size = packet.size; memcpy(pes->frame_data, packet.data, packet.size); + /* remember the new frame's PTS (or calc from the previous one) */ + if(packet.pts == AV_NOPTS_VALUE && pes->frame_pts != AV_NOPTS_VALUE) + pes->frame_pts += 3600; + else + pes->frame_pts = packet.pts; + if(packet.dts == AV_NOPTS_VALUE && pes->frame_dts != AV_NOPTS_VALUE) + pes->frame_dts += 3600; + else + pes->frame_dts = packet.dts; + av_free_packet(&packet); return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |