Advertisement
Guest User

Untitled

a guest
Sep 21st, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. frame_count = 0;
  2.     for(;;) {
  3.         avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
  4.         if (avpkt.size == 0)
  5.             break;
  6.         /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
  7.            and this is the only method to use them because you cannot
  8.            know the compressed data size before analysing it.
  9.            BUT some other codecs (msmpeg4, mpeg4) are inherently frame
  10.            based, so you must call them with all the data for one
  11.            frame exactly. You must also initialize 'width' and
  12.            'height' before initializing them. */
  13.         /* NOTE2: some codecs allow the raw parameters (frame size,
  14.            sample rate) to be changed at any frame. We handle this, so
  15.            you should also take care of it */
  16.         /* here, we use a stream based decoder (mpeg1video), so we
  17.            feed decoder and see if it could decode a frame */
  18.         avpkt.data = inbuf;
  19.         while (avpkt.size > 0)
  20.             if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0)
  21.                 exit(1);
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement