[FFmpeg-devel] MPEG TS encoding problem on change from stereo to mono, pay for fix

Michael Niedermayer michaelni
Thu Dec 2 01:38:33 CET 2010


On Wed, Dec 01, 2010 at 06:20:18PM +0100, Reimar D?ffinger wrote:
> On Wed, Dec 01, 2010 at 05:00:19PM +0100, Michael Niedermayer wrote:
> > On Wed, Dec 01, 2010 at 09:14:03AM +0100, Reimar D?ffinger wrote:
> > > On Wed, Dec 01, 2010 at 04:10:49AM +0100, Michael Niedermayer wrote:
> > > > On Wed, Nov 24, 2010 at 12:10:47AM +0100, Stefano Sabatini wrote:
> > > > > @@ -776,7 +779,7 @@ static void do_audio_out(AVFormatContext *s,
> > > > >      int64_t audio_out_size, audio_buf_size;
> > > > >      int64_t allocated_for_size= size;
> > > > >  
> > > > > -    int size_out, frame_bytes, ret;
> > > > > +    int size_out, frame_bytes, ret, resample_changed;
> > > > >      AVCodecContext *enc= ost->st->codec;
> > > > >      AVCodecContext *dec= ist->st->codec;
> > > > >      int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8;
> > > > > @@ -810,7 +813,28 @@ need_realloc:
> > > > 
> > > > 
> > > > >      if (enc->channels != dec->channels)
> > > >            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > >          ost->audio_resample = 1;
> > > > >  
> > > > > -    if (ost->audio_resample && !ost->resample) {
> > > > > +    resample_changed = ost->resample_sample_fmt  != dec->sample_fmt ||
> > > > > +                       ost->resample_channels    != dec->channels   ||
> > > > 
> > > > this looks redundant
> > > 
> > > Huh? One checks whether decoder output and encoder input differ,
> > > the other one checks whether the decoder output format changed...
> > 
> > they can differ and still not change?
> 
> I don't understand what is unclear here.

its not unclear, i just thought it would be simpler to drop the enc != dec
check and use the expected resampler input != dec for it by initially setting
it to the enc value
but i did not investigate this further at all it was just a thought from taking
a quick look


> There's a format the decoder outputs (1).
> There's a format that the resampler expects as output (2).
> There's a format that the resampler outputs (3).
> There's a format that the encoder expects (4).
> 
> One checks whether channel count differs between (1)
> and (4) and the other check is if they differ between
> (1) and (2). There is no relation between those.
>
> > btw, it might make more sense to have some function like sws_getCachedContext()
> 
> That as basically the original suggestion, but doing it properly
> is quite a mess and overkill for just this use-case, at least
> it seemed like it.
> Of course I don't mind it if someone wants, but a half-working
> public API function is not ok.

agree of course

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101202/72498183/attachment.pgp>



More information about the ffmpeg-devel mailing list