Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6003 in orxonox.OLD for branches/avi_play/src


Ignore:
Timestamp:
Dec 9, 2005, 6:07:05 PM (18 years ago)
Author:
hdavid
Message:

branches/avi_play: some init stuff

Location:
branches/avi_play/src
Files:
5 edited

Legend:

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

    r5975 r6003  
    4040  av_register_all();
    4141
     42        current_frame = 0;
     43        num_frames = 0;
     44
    4245  if (filename != NULL)
    4346    this->loadMedia(filename);
     
    5053MediaContainer::~MediaContainer()
    5154{
     55        //av_free(pFrameRGB);
     56
     57        /* Free the frame */
     58  av_free(frame);
     59
     60  /* Close the codec */
     61  avcodec_close(codec_context);
     62
     63  /* Close the video file */
     64  av_close_input_file(format_context);
    5265
    5366}
    5467
    55 GLuint MediaContainer::getFrame(int frame_number)
     68/*GLuint MediaContainer::getFrame(int frame_number)
    5669{
    5770
     
    6174{
    6275
     76}*/
     77
     78SDL_Surface* MediaContainer::getFrame(int frame_number)
     79{
     80        SDL_Surface* frame;
     81       
     82
     83        return frame;
     84}
     85
     86SDL_Surface* MediaContainer::getNextFrame()
     87{
     88        current_frame++;
     89        return this->getFrame(current_frame);
    6390}
    6491
     
    6895  if (av_open_input_file(&format_context, filename, NULL, 0, NULL) !=0 )
    6996    PRINTF(1)("Could not open %s\n", filename);
     97
     98        /* Retrieve stream information */
     99  if (av_find_stream_info(format_context) < 0)
     100        PRINTF(1)("Could not find stream information in %s\n", filename);
     101
     102  // Dump information about file onto standard error
     103  //dump_format(pFormatCtx, 0, argv[1], false);
     104
     105  /* Find the first video stream and take it */
     106  video_stream = -1;
     107  for(int i = 0; i < format_context->nb_streams; i++)
     108        {
     109                // NOTE: different code for the 0.4.9-pre1 release of ffmpeg (tardis)
     110                // if(format_context->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO)         
     111        if(format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO)
     112    {
     113        video_stream = i;
     114      break;
     115    }
     116        }
     117 
     118        if(video_stream == -1)
     119        PRINTF(1)("Could not find a video stream in %s\n", filename);
     120
     121        /* Get a pointer to the codec context for the video stream */
     122        // NOTE: different code for the 0.4.9-pre1 release of ffmpeg (tardis)
     123        // codec_context = &format_context->streams[video_stream]->codec;
     124  codec_context = format_context->streams[video_stream]->codec;
     125
     126        /* Find the decoder for the video stream */
     127  codec = avcodec_find_decoder(codec_context->codec_id);
     128  if (codec == NULL)
     129        PRINTF(1)("Could not find codec\n");
     130
     131        /* Open codec */
     132  if (avcodec_open(codec_context, codec) < 0)
     133                PRINTF(1)("Could not open codec\n");
     134
     135       
    70136
    71137}
  • branches/avi_play/src/lib/graphics/importer/media_container.h

    r5975 r6003  
    2424using namespace std;
    2525
     26/* Forward Declaration */
     27struct SDL_Surface;
     28
    2629class MediaContainer : public BaseObject
    2730{
     
    3134        char* filename;
    3235        int current_frame;
     36        int num_frames;
    3337
    3438        AVFormatContext* format_context;
     
    4650  ~MediaContainer();
    4751
    48         GLuint getFrame(int frame_number);
    49         GLuint getNextFrame();
     52        //GLuint getFrame(int frame_number);
     53        SDL_Surface* getFrame(int frame_number);
     54        //GLuint getNextFrame();
     55        SDL_Surface* getNextFrame();
    5056        void loadMedia(const char* filename);
    5157       
  • branches/avi_play/src/lib/sound/sound_engine.cc

    r5975 r6003  
    290290  // INITIALIZING THE DEVICE:
    291291#ifndef AL_VERSION_1_1
    292   ALCchar deviceName[] =
     292  ALubyte deviceName[] =
    293293#else
    294294  ALCchar deviceName[] =
  • branches/avi_play/src/subprojects/importer/importer.cc

    r4741 r6003  
    2222#include "objModel.h"
    2323#include "primitive_model.h"
     24#include "media_container.h"
    2425#include <stdlib.h>
    2526
     
    3031void Framework::moduleInit(int argc, char** argv)
    3132{
     33        //MediaContainer* test;
     34       
     35        //test = new MediaContainer(argv[1]);   
     36
     37
    3238  ResourceManager::getInstance()->addImageDir("./");
    3339
  • branches/avi_play/src/subprojects/importer/multitex.cc

    r5924 r6003  
    5656
    5757
    58   obj = new PrimitiveModel(PRIM_SPHERE, 10.0);
     58  obj = new PrimitiveModel(PRIM_PLANE, 10.0);
    5959
    6060  ResourceManager::getInstance()->debug();
     
    7373      switch (event->key.keysym.sym)
    7474        {
    75         case SDLK_i:
     75        case SDLK_1:
     76                                        obj = new PrimitiveModel(PRIM_CUBE, 10.0);
     77          break;
     78                                case SDLK_2:
     79                                        obj = new PrimitiveModel(PRIM_SPHERE, 10.0);
     80          break;
     81                                case SDLK_3:
     82                                        obj = new PrimitiveModel(PRIM_PLANE, 10.0);
    7683          break;
    7784        }
Note: See TracChangeset for help on using the changeset viewer.