Changeset 6057 in orxonox.OLD for branches/avi_play/src/lib/graphics
- Timestamp:
- Dec 12, 2005, 1:07:57 AM (19 years ago)
- 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
r6049 r6057 42 42 current_frame = 0; 43 43 num_frames = 0; 44 frames_left = true; 44 45 45 46 if (filename != NULL) … … 77 78 SDL_Surface* MediaContainer::getFrame(int frame_number) 78 79 { 79 SDL_Surface* frame; 80 81 82 return frame; 80 83 81 } 84 82 85 83 SDL_Surface* MediaContainer::getNextFrame() 86 84 { 87 current_frame++; 88 return this->getFrame(current_frame); 85 /* get next frame */ 86 if(av_read_frame(format_context, &packet) >= 0) 87 { 88 frames_left = true; 89 current_frame++; 90 PRINTF(1)("current_frame: %i\n", current_frame); 91 92 93 /* work with the frame */ 94 /* packet -> SDL_Surface */ 95 96 97 98 99 } 100 else 101 frames_left = false; 102 89 103 } 90 104 … … 136 150 int MediaContainer::getHeight() 137 151 { 138 152 return codec_context->height; 139 153 } 140 154 141 155 int MediaContainer::getWidth() 142 156 { 143 157 return codec_context->width; 144 158 } 145 159 … … 153 167 154 168 } 169 170 bool MediaContainer::framesLeft() 171 { 172 return frames_left; 173 } 174 175 void MediaContainer::printMediaInformation() 176 { 177 PRINTF(1)("========================\n"); 178 PRINTF(1)("========================\n"); 179 PRINTF(1)("= MEDIACONTAINER =\n"); 180 PRINTF(1)("========================\n"); 181 PRINTF(1)("========================\n"); 182 PRINTF(1)("= AVFormatContext =\n"); 183 PRINTF(1)("========================\n"); 184 PRINTF(1)("filename: %s\n", format_context->filename); 185 PRINTF(1)("nb_streams: %i\n", format_context->nb_streams); 186 PRINTF(1)("duration: %fs\n", format_context->duration/1000000.); 187 PRINTF(1)("file_size: %ikb\n", format_context->file_size/1024); 188 PRINTF(1)("bit_rate: %ikb/s\n", format_context->bit_rate/1000); 189 PRINTF(1)("nb_frames: %i\n", format_context->streams[video_stream]->nb_frames); 190 //PRINTF(1)("r_frame_rate: %ifps\n", format_context->streams[video_stream]->r_frame_rate.num); 191 PRINTF(1)("========================\n"); 192 PRINTF(1)("= AVCodecContext =\n"); 193 PRINTF(1)("========================\n"); 194 PRINTF(1)("width: %i\n", codec_context->width); 195 PRINTF(1)("height: %i\n", codec_context->height); 196 PRINTF(1)("========================\n"); 197 PRINTF(1)("= AVCodec =\n"); 198 PRINTF(1)("========================\n"); 199 PRINTF(1)("codec name: %s\n", codec->name); 200 PRINTF(1)("========================\n"); 201 PRINTF(1)("========================\n"); 202 } -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6003 r6057 32 32 private: 33 33 34 char* filename;35 34 int current_frame; 36 35 int num_frames; … … 44 43 int num_bytes; 45 44 int video_stream; 45 bool frames_left; 46 46 47 47 public: … … 61 61 void getStream(/* stream */); 62 62 63 bool framesLeft(); 64 65 /* prints some information about the 66 media file for debug reasons */ 67 void printMediaInformation(); 68 63 69 }; 64 70
Note: See TracChangeset
for help on using the changeset viewer.