[mythtv] [BUG?] mythmusic seeking in WMA files

Steven mythmail at richardstraat.homedns.org
Thu Jan 27 04:49:15 EST 2005


Andy McMullan wrote:
>>Haven't investigated as I don't have much WMA stuff.
> 
> 
> Ok, decided to take a quick look at this. Haven't determined the
> underlying cause, but I've got a quick hack for anyone who needs it.
> This problem code path seems to be in libavformat/utils.c, in the
> av_find_stream_info() function:
> 
>         ret = av_read_frame_internal(ic, &pkt1);
>         if (ret < 0) {
>             /* EOF or error */
>             ret = -1; /* we could not have all the codec parameters
> before EOF */
>             if ((ic->ctx_flags & AVFMTCTX_NOHEADER) &&
>                 i == ic->nb_streams)
>                 ret = 0;
>             break;
>         }
> 
> av_read_frame_internal returns an error (-2 IIRC), ret is set to -1,
> the if( ic->ctx_flags ... ) clause isn't true, so ret stays as -1 and
> gets propagated back to avfDecoder::initialise, which then fails.
> 
> The hack is to comment out the if clause, meaning ret gets set to 0.
> In other words, pretend we didn't get an error. With this hack, WMA
> playback works fine.
> 
> Obviously this isn't a fix - maybe someone who knows the code will
> easily spot what's wrong here. My guess is that we're hitting an EOF
> condition, but interpreting it as an error rather than a EOF. Maybe in
> an earlier version of this code, the if( ic->ctx_flags ... )
> expression evaluated to true, but now it doesn't. FYI the values of
> the components of the expression are:
> 
> ic->ctx_flags = 0
> i = 0
> ic->nb_streams = 1
> 
> Hope that helps somebody.
> 
> Andy
> 

Wouldn't this hack cause playback issues with other fileformats?
Other applications using the same ffmpeg libs and the exactly the same 
code you posted play WMA files (with seek functions) just fine.

Steven


More information about the mythtv-dev mailing list