[mythtv] libavformat doesn't handle multi-audio PS streamcorrectly

Mark Spieth mark at dclabs.com.au
Wed Oct 4 23:21:58 UTC 2006


>> Yup, it's myth specific.  That change cuts channel change time on DVB (or
>> anything using mpegts) considerably.
> So, would you object to my being a bit more inteligent with it?  My
> thought was to check the PS stream and determine how many streams
> should be present if audio_bound or a PSM are found, and to update
> nb_streams accordingly.  It won't be fool-proof, but will work for
> many more PS streams.

there is another optimization for startup speed as av_probe_input_format is 
called twice, once in CanHandle and once in AvFormatDecoder::OpenFile
probably should make CanHandle return fmt and pass it to the contructor.
a big hit for startup time is av_estimate_timings which is only really 
needed for those files which dont have full timing in the myth DB.
I also notice that the timestamp is not adjusted to 0 starttime for live and 
dvd. this was a fix for the mpeg timestamp wrap issue.

Im hoping this patch will allow us to get rid of av_estimate_timing for 
those with full position info but its untested as yet. it doesnt set 
end/duration but start for timestamp adjust is good enough.
av_estimate_timings can then be called after the test for full pos map if 
necessary.
it doesnt solve the initial bad stream detect due to data errors, etc

cheers
mark

--- utils.c     (revision 11430)
+++ utils.c     (working copy)
@@ -699,15 +699,26 @@
             pkt->dts= lsb2full(pkt->dts, st->cur_dts, st->pts_wrap_bits);
     }
 */
+    if(s->start_time == AV_NOPTS_VALUE) {
+        if(pkt->pts != AV_NOPTS_VALUE) {
+            if (st->start_time == AV_NOPTS_VALUE)
+                st->start_time = pkt->pts;
+            s->start_time = av_rescale_q(st->start_time, st->time_base, 
AV_TIME_BASE_Q);
+            //av_log(s, AV_LOG_DEBUG, "utils.c ts: %lld %lld %lld\n", st1, 
pkt->pts, pkt->dts);
+            printf("utils.c start time set at %lld 
%lld\n",s->start_time,pkt->pts);
+        }
+    }

     if(s->start_time != AV_NOPTS_VALUE){
         int64_t st1 = av_rescale(s->start_time,





More information about the mythtv-dev mailing list