Hi guys.
  I am new to the libmpeg2,(0.51).

  I follow the sample2.c try to extract the first I-frame
 But I found the problem

when looping mpeg2_parse (decoder)
1.
  STATE_PICTURE   found
  I check the flag to see if it is an I frame
  pic_coding_type = info->current_picture->flags & PIC_MASK_CODING_TYPE;

2. STATE_SLICE  found
   then i try to extract the data ,but  info->display_fbuf is NULL,so I can
get nothing.

How can I extract the first I-frame to ppm data?

source

do {
    state = mpeg2_parse (decoder);
    switch (state) {
    case STATE_BUFFER:
        size = fread (buffer, 1, BUFFER_SIZE, mpgfile);
        mpeg2_buffer (decoder, buffer, buffer + size);
        break;
    case STATE_SEQUENCE:
        mpeg2_convert (decoder, mpeg2convert_rgb24, NULL);
        break;
    case STATE_PICTURE:
      pic_coding_type = info->current_picture->flags & PIC_MASK_CODING_TYPE;
      break;
    case STATE_SLICE:
    case STATE_END:
    case STATE_INVALID_END:
        if (info->display_fbuf  && pic_coding_type == PIC_FLAG_CODING_TYPE_I
)
        save_ppm (info->sequence->width, info->sequence->height,
              info->display_fbuf->buf[0], framenum++);
        break;
    default:
        break;
    }

thanks in advance
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Libmpeg2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel

Reply via email to