Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6127 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer


Ignore:
Timestamp:
Dec 15, 2005, 11:54:48 PM (19 years ago)
Author:
hdavid
Message:

branches/avi_play: MediaContainer::getFPS() works

Location:
branches/avi_play/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/graphics/importer/media_container.cc

    r6112 r6127  
    4040  av_register_all();
    4141
    42   current_frame = 0;
     42  fps = 0;
    4343
    4444  if (filename != NULL)
     
    8989      if(frame_finished)
    9090      {
    91         current_frame++;
    92         PRINTF(1)("current_frame: %i\n", current_frame);
    93 
    94                     // Convert the image from its native format to RGB
     91        PRINTF(1)("frame_number: %i\n", codec_context->frame_number);
     92
     93        // Convert the image from its native format to RGB
    9594        img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame, codec_context->pix_fmt,
    9695                                        codec_context->width, codec_context->height);
     
    145144
    146145  // Open file
    147   sprintf(filename, "frame%i.ppm", current_frame);
     146  sprintf(filename, "frame%i.ppm", codec_context->frame_number);
    148147  file = fopen(filename, "wb");
    149148  if(file == NULL)
     
    215214  avpicture_fill((AVPicture *)RGB_frame, buffer, PIX_FMT_RGB24, codec_context->width, codec_context->height);
    216215
     216  // Calculate fps
     217  fps = av_q2d(format_context->streams[video_stream]->r_frame_rate);
    217218}
    218219
     
    227228}
    228229
    229 int MediaContainer::getCurrentFrame()
    230 {
    231   return this->current_frame;
    232 }
    233 
    234 int MediaContainer::getFrameRate()
    235 {
    236 
    237 }
    238 
    239 void MediaContainer::getStream(/* stream */)
    240 {
    241 
     230int MediaContainer::getFrameNumber()
     231{
     232  return codec_context->frame_number;
     233}
     234
     235double MediaContainer::getFPS()
     236{
     237  return this->fps;
    242238}
    243239
     
    258254  PRINTF(1)("nb_frames: %i\n", format_context->streams[video_stream]->nb_frames);
    259255  PRINTF(1)("r_frame_rate: %i\n", format_context->streams[video_stream]->r_frame_rate.num);
     256  PRINTF(1)("FPS: %f\n", av_q2d(format_context->streams[video_stream]->r_frame_rate));
    260257  PRINTF(1)("========================\n");
    261258  PRINTF(1)("=    AVCodecContext    =\n");
     
    263260  PRINTF(1)("width: %i\n", codec_context->width);
    264261  PRINTF(1)("height: %i\n", codec_context->height);
     262  PRINTF(1)("time_base.den: %i\n", codec_context->time_base.den);
     263  PRINTF(1)("time_base.num: %i\n", codec_context->time_base.num);
    265264  PRINTF(1)("========================\n");
    266265  PRINTF(1)("=       AVCodec        =\n");
     
    286285  PRINTF(1)("========================\n");
    287286}
     287
     288
     289//pts = av_q2d(is->video_st->time_base)*pkt->dts;
     290//pkt = packet
     291//avstrream = viedo_st
     292//pts = double
  • branches/avi_play/src/lib/graphics/importer/media_container.h

    r6112 r6127  
    2929private:
    3030
    31   int current_frame;
    32   int num_frames;
     31  double fps;
    3332  GLuint texture;
    3433  uint8_t* data;
     
    5756  int getHeight();
    5857  int getWidth();
    59   int getCurrentFrame();
    60   int getFrameRate();
    61   void getStream(/* stream */);
     58  int getFrameNumber();
     59  double getFPS();
    6260
    6361  /* prints some information about the
Note: See TracChangeset for help on using the changeset viewer.