title: AVCodecContex returns zero for width and height in android
body: <p>Not sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android. </p>
  
  <p>QUESTION:
  <strong>Why Width and Height of the CodecContext gives me always zero ?..</strong> </p>
  
  <pre><code>int main(int argc, char *argv[])
  {
  
      int flags;
      flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
  
      if (SDL_Init (flags)) {
          LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());
      }
      else 
          LOGD (" SUCCESS: SDL_Init ");
  
      // ffmpeg Register all services..
      ffmpeg_register_all (); 
  
  
      pFrame = avcodec_alloc_frame ();
      context = avformat_alloc_context();
  
      err = avformat_open_input (&amp;context, "rtsp:ip:port", NULL, NULL);
      if ( err &lt; 0) {
          __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");
  
          return -1;
      }
  
      for (i = 0; i &lt; context-&gt;nb_streams; i++)
      {               
          // Find the Decoder.
          codec = avcodec_find_decoder(context-&gt;streams[i]-&gt;codec-&gt;codec_id);
          if (codec-&gt;type  == AVMEDIA_TYPE_VIDEO ) {
              __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming..  ");
              videoStreamIndex = i;
  
          }
      }
  
      // Play RTSP
      av_read_play(context);
  
      // Get Codec Context.
      pCodecCtx = context-&gt;streams[videoStreamIndex]-&gt;codec;
      if ( pCodecCtx == NULL )
          __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL&gt;&gt;&gt; ");
      else
          __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is &lt;&lt;&lt;OK&gt;&gt;&gt; ");
  
  
      //Find the Decoder.
      pCodec = avcodec_find_decoder (pCodecCtx-&gt;codec_id);
      avcodec_open2 (pCodecCtx, pCodec, NULL);
  
  
      int w = pCodecCtx-&gt;width;  // Why me getting 0 ? 
      int h = pCodecCtx-&gt;height;
  
      window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);
      // What this HIGHDPI Means ??
  
      if ( window != NULL ) 
      {
          LOGD (" WINDOW CREATED.. , create Renderer ..");
          renderer = SDL_CreateRenderer (window, -1, 0);  
      }
      else
      {
          LOGD (" Invalid SDL Window ");  
      }
  __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h); 
      return 0;
  }
  </code></pre>