[soc]: r4555 - in concat/libavformat: m3u.c playlist.c
Author: gkovacs Date: Wed Jul 1 03:25:57 2009 New Revision: 4555 Log: forcing intermediate double for ff_conv_stream_time to yield nonzero result Modified: concat/libavformat/m3u.c concat/libavformat/playlist.c Modified: concat/libavformat/m3u.c ============================================================================== --- concat/libavformat/m3u.c Wed Jul 1 02:56:28 2009 (r4554) +++ concat/libavformat/m3u.c Wed Jul 1 03:25:57 2009 (r4555) @@ -116,23 +116,27 @@ static int m3u_read_packet(AVFormatConte } } // TODO switch from AVERROR_EOF to AVERROR_EOS - else if (ret == AVERROR_EOF && playld->pe_curidx < playld->pelist_size - 1) { + // -32 AVERROR_EOF for avi, -51 for ogg + else if (ret < 0 && playld->pe_curidx < playld->pelist_size - 1) { // TODO account for out-of-sync audio/video by using per-stream offsets // using streams[]->duration slightly overestimates offset // playld->dts_offset += ic->streams[0]->duration; // using streams[]->cur_dts slightly overestimates offset // playld->dts_offset += ic->streams[0]->cur_dts; // playld->dts_offset += playld->dts_prevpacket; + printf("switching streams\n"); for (i = 0; i < ic->nb_streams && i < playld->time_offsets_size; ++i) { playld->time_offsets[i] += ff_get_duration(ic, i); } -// playld->dts_offset += ff_get_duration(ic, pkt->stream_index); ++playld->pe_curidx; // pkt->destruct(pkt); pkt = av_malloc(sizeof(AVPacket)); ff_playlist_populate_context(playld, s); goto retr; } + else { + printf("avpacket ret is %d\n", ret); + } return ret; } Modified: concat/libavformat/playlist.c ============================================================================== --- concat/libavformat/playlist.c Wed Jul 1 02:56:28 2009 (r4554) +++ concat/libavformat/playlist.c Wed Jul 1 03:25:57 2009 (r4555) @@ -247,12 +247,12 @@ int64_t ff_conv_stream_time(AVFormatCont { int64_t durn; durn = (int64_t)( - avt_duration / - AV_TIME_BASE * - ic->streams[stream_index]->time_base.den / - ic->streams[stream_index]->time_base.num) - ; - printf("conv stream time from %ld to %ld/%ld is %ld\n", avt_duration, ic->streams[stream_index]->time_base.num, ic->streams[stream_index]->time_base.den, durn); + (double)avt_duration / //double casting may be unnecessary + ic->streams[stream_index]->time_base.num / + (AV_TIME_BASE / // 10^6 + ic->streams[stream_index]->time_base.den) + ); + printf("%s conv stream time from %ld to %ld/%ld is %ld\n", ic->iformat->name, avt_duration, ic->streams[stream_index]->time_base.num, ic->streams[stream_index]->time_base.den, durn); return durn; } @@ -271,8 +271,7 @@ int64_t ff_get_duration(AVFormatContext // h264 and mpeg1: pkt->dts values incorrect int64_t durn; durn = ic->duration; -// durn = (ic->duration / ic->streams[stream_index]->time_base.den) * -// (ic->streams[stream_index]->time_base.num / AV_TIME_BASE); +// durn = ic->streams[stream_index]->duration; // ogg gives wrong value printf("duration is %ld\n", durn); return durn; }
participants (1)
-
gkovacs