- /* load all the constituent chunks in the video packet */
- if (video_frame_size - video_frame_index < VIDEO_DATA_CHUNK_SIZE)
- bytes_to_copy = video_frame_size - video_frame_index;
- else
- bytes_to_copy = VIDEO_DATA_CHUNK_SIZE;
- if (video_frame_index < video_frame_size)
- memcpy(&pkt->data[video_frame_index],
- §or[VIDEO_DATA_HEADER_SIZE], bytes_to_copy);
-
-#ifdef PRINTSTUFF
-printf (" chunk %d/%d (bytes %d/%d), first 6 bytes = %02X %02X %02X %02X %02X %02X\n",
- current_video_sector, video_sector_count,
- video_frame_index, video_frame_size,
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 0],
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 1],
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 2],
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 3],
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 4],
- pkt->data[current_video_sector * VIDEO_DATA_CHUNK_SIZE + 5]);
-#endif
-
- video_frame_index += bytes_to_copy;
- /* must keep reading sectors until all current video sectors
- * are consumed */
- current_video_sector++;
- if (current_video_sector >= video_sector_count)
- packet_read = 1;
+ memcpy(pkt->data + current_sector*VIDEO_DATA_CHUNK_SIZE,
+ sector + VIDEO_DATA_HEADER_SIZE,
+ VIDEO_DATA_CHUNK_SIZE);
+
+ if (current_sector == sector_count-1) {
+ pkt->size= frame_size;
+ *ret_pkt = *pkt;
+ pkt->data= NULL;
+ pkt->size= -1;
+ pkt->buf = NULL;
+ return 0;
+ }