[Ffmpeg-devel] [FWD] [PATCH] immediate decoding of dvd stills
Michael Niedermayer
michaelni
Wed Nov 29 00:01:36 CET 2006
Hi
On Tue, Nov 28, 2006 at 11:30:54PM +0100, Nico Sabbi wrote:
> Nico Sabbi wrote:
> >Michael Niedermayer wrote:
> >
> >>something like:
> >>
> >>- if (buf_size == 0) {
> >>+ if (buf_size == 0 || !memcmp(buf, (char[]){0,0,1,BF}, 4) {
> >> /* special case for last picture */
> >> if (s2->low_delay==0 && s2->next_picture_ptr) {
> >>
> >>[...]
> >
> >
> >
> >updated
> >
> >- if (buf_size == 0) {
> >+ if(!memcmp(buf, (char[]){0,0,1,0xB7}, 4))
> >+ endsequence = 1;
>
> idiot me; patch fixed.
> No regression reported by make test
> Index: libavcodec/mpeg12.c
> ===================================================================
> --- libavcodec/mpeg12.c (revisione 7167)
> +++ libavcodec/mpeg12.c (copia locale)
> @@ -3037,6 +3037,12 @@
> }
> }
> }
> + }else{
> + /* look for SEQ_END_CODE at the last data in this buffer*/
> + /* dvd's won't send the next frame start on still images*/
> + /* SEQ_END_CODE will have to stay at the beginning of a frame*/
> + if(state == SEQ_END_CODE)
> + return i-3;
> }
> pc->state= state;
> return END_NOT_FOUND;
> @@ -3054,9 +3060,11 @@
> int ret, input_size;
> AVFrame *picture = data;
> MpegEncContext *s2 = &s->mpeg_enc_ctx;
> + int endsequence = 0;
> dprintf("fill_buffer\n");
>
> - if (buf_size == 0) {
> + endsequence = (buf_size > 3 && !memcmp(buf, (char[]){0,0,1,0xB7}, 4));
> + if (buf_size == 0 || endsequence) {
> /* special case for last picture */
> if (s2->low_delay==0 && s2->next_picture_ptr) {
> *picture= *(AVFrame*)s2->next_picture_ptr;
> @@ -3064,7 +3072,7 @@
>
> *data_size = sizeof(AVFrame);
> }
> - return 0;
> + return endsequence ? 4 : 0;
is there a problem with return buf_size; ?
if not then if (buf_size == 0 || !memcmp(buf, (char[]){0,0,1,0xB7}, 4))
can be used and the code is a little simpler (note if buf_size>0) then
there always need to be at least FF_INPUT_BUFFER_PADDING_SIZE bytes allocated
so no need to check for >= 4
except that patch ok if it works
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list