Hi,
> Hmm... `bytes' is the distance between two items, and should be an
> integer multiple of the frame size.
But items also include the (sometime) non-aligned PES packet headers;
these are not deleted in audio_addpts. For those, the distance is
arbitrary, see the log output below.
> > By debugging :-) I noticed audio frames were written with size
> > 1184 even though 576 should have been the size always.
>
> Is it always 1184, or does the value differ?
Ok, I have just applied
--- dvbcut-orig/src/mpgfile.cpp~ Sun May 27 17:24:25 2007
+++ dvbcut-orig/src/mpgfile.cpp Mon May 28 12:15:51 2007
@@ -619,6 +619,7 @@
if (bytes>0)
{
pts_t pts=audiopts[a]-audiooffset[a];
+ fprintf(stderr, "mux.put audio %d %lld\n", bytes, pts);
mux.putpacket(audiostream(a),sd->getdata(),bytes,pts,pts,MUXER_FLAG_KEY);
sd->discard(bytes);
and I append the output for otherwise unchanged dvbcut-35
for a stream with unaligned audio.
Maybe you can make something out of it?
It doesn't include the case with false positive from mpaframe, though.
> No, if the error occurs once in a while, it must be something else.
I have two separate problems, but the one with false positive from
mpaframe() happens very rarely, and is handled by my patch.
> I think that should be handled inside the caller, i.e. audio_addpts().
> Actually, the whole syncing business should be handled there. ac3frame()
> and mpaframe() should just return the size of the frame, or 0 if there
> is no valid header.
Yes! That is exactly what my patch does.
> There is, by the way, an indicator for the most likely next position:
> `bufferposition'. But there is also another bug: If audio_addpts() finds
> a valid frame, it will insert a new item. But it's not an item for the
> frame itself because `bufferposition' has already been updated and
> points *after* the frame just checked. :-(
Yes! That is why I changed the {mpa,ac3}frame calling so this
can be handled correctly (in a followup patch).
> >>>but I thought that the buffer shifts through the
> >>>file with only the already framed data being discarded, so when
> >>>audio_addpts is called _again_ the last frame (which is now the first
> >>>frame) will be detected just fine?
> >>
> >>It should. Actually, it should be in sync as well. But it isn't :-(
> >
> >
> > Ok, IMHO the root of the problem is that potentially unaligned items
> > are used for framing the audio, and items with an artificial
> > STREAM_ITEM_FLAG_DATA_ALIGNMENT_INDICATOR are mixed in.
>
> We don't care about that flag any longer. You could as well remove it.
Ok..
> > Instead, we
> > should abandon using the PES packet headers for framing and create a
> > separate type of item (with a new flag STREAM_ITEM_FLAG_FRAME) for the
> > parsed frame boundaries. My next patch will do exactly this.
>
> Beware! The PES packet headers contain the PTS timestamps we need, and
> they're also required for file positioning.
I'm not deleting them, just not using them for audio output.
> Hmm. Doesn't that mean that your patch has no effect at all? Or, vice
> versa, that the original code worked fine even when there were sync
> problems now and then?
The patch just fixes the very rare false positive from mpaframe. It
doesn't solve the sync problem. I think I'll post my current complete
patch in another thread so maybe everything becomes clearer.
Regards,
Wolfram
========================================================================
mux.put audio 960 3721
mux.put audio 576 5881
mux.put audio 288 8041
mux.put audio 864 10201
mux.put audio 576 12361
mux.put audio 384 14521
mux.put audio 768 16681
mux.put audio 576 18841
mux.put audio 480 21001
mux.put audio 672 23161
mux.put audio 576 25321
mux.put audio 576 27481
mux.put audio 576 29641
mux.put audio 576 31801
mux.put audio 576 33961
mux.put audio 96 36121
mux.put audio 1056 38281
mux.put audio 576 40441
mux.put audio 192 42601
mux.put audio 960 44761
mux.put audio 576 46921
mux.put audio 288 49081
mux.put audio 864 51241
mux.put audio 576 53401
mux.put audio 384 55561
mux.put audio 768 57721
mux.put audio 576 59881
mux.put audio 480 62041
mux.put audio 672 64201
mux.put audio 576 66361
mux.put audio 576 68521
mux.put audio 576 70681
mux.put audio 576 72841
mux.put audio 576 75001
mux.put audio 96 77161
mux.put audio 1056 79321
mux.put audio 576 81481
mux.put audio 192 83641
mux.put audio 960 85801
mux.put audio 576 87961
mux.put audio 288 90121
mux.put audio 864 92281
mux.put audio 576 94441
mux.put audio 384 96601
mux.put audio 768 98761
mux.put audio 576 100921
mux.put audio 480 103081
mux.put audio 672 105241
mux.put audio 576 107401
mux.put audio 576 109561
mux.put audio 576 111721
mux.put audio 576 113881
mux.put audio 576 116041
mux.put audio 96 118201
mux.put audio 1056 120361
mux.put audio 576 122521
mux.put audio 192 124681
mux.put audio 960 126841
mux.put audio 576 129001
mux.put audio 288 131161
mux.put audio 864 133321
mux.put audio 576 135481
mux.put audio 384 137641
mux.put audio 768 139801
mux.put audio 576 141961
mux.put audio 480 144121
mux.put audio 672 146281
mux.put audio 576 148441
mux.put audio 576 150601
mux.put audio 576 152761
mux.put audio 576 154921
mux.put audio 576 157081
mux.put audio 96 159241
mux.put audio 1056 161401
mux.put audio 576 163561
mux.put audio 192 165721
mux.put audio 960 167881
mux.put audio 576 170041
mux.put audio 288 172201
mux.put audio 864 174361
mux.put audio 576 176521
mux.put audio 384 178681
mux.put audio 768 180841
mux.put audio 576 183001
mux.put audio 480 185161
mux.put audio 672 187321
mux.put audio 576 189481
mux.put audio 576 191641
mux.put audio 576 193801
mux.put audio 576 195961
mux.put audio 576 198121
mux.put audio 96 200281
mux.put audio 1056 202441
mux.put audio 576 204601
mux.put audio 192 206761
mux.put audio 960 208921
mux.put audio 576 211081
mux.put audio 288 213241
mux.put audio 864 215401
mux.put audio 576 217561
mux.put audio 384 219721
mux.put audio 768 221881
mux.put audio 576 224041
mux.put audio 480 226201
mux.put audio 672 228361
mux.put audio 576 230521
mux.put audio 576 232681
mux.put audio 576 234841
mux.put audio 576 237001
mux.put audio 576 239161
mux.put audio 96 241321
mux.put audio 1056 243481
mux.put audio 576 245641
mux.put audio 192 247801
mux.put audio 960 249961
mux.put audio 576 252121
mux.put audio 288 254281
mux.put audio 864 256441
mux.put audio 576 258601
mux.put audio 384 260761
mux.put audio 768 262921
mux.put audio 576 265081
mux.put audio 480 267241
mux.put audio 672 269401
mux.put audio 576 271561
mux.put audio 576 273721
mux.put audio 576 275881
mux.put audio 576 278041
mux.put audio 576 280201
mux.put audio 96 282361
mux.put audio 1056 284521
mux.put audio 576 286681
mux.put audio 192 288841
mux.put audio 960 291001
mux.put audio 576 293161
mux.put audio 288 295321
mux.put audio 864 297481
mux.put audio 576 299641
mux.put audio 384 301801
mux.put audio 768 303961
mux.put audio 576 306121
mux.put audio 480 308281
mux.put audio 672 310441
mux.put audio 576 312601
mux.put audio 576 314761
mux.put audio 576 316921
mux.put audio 576 319081
mux.put audio 576 321241
mux.put audio 96 323401
mux.put audio 1056 325561
mux.put audio 576 327721
mux.put audio 192 329881
mux.put audio 960 332041
...
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
DVBCUT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dvbcut-user