changeset 737:119ac74d1c49 libavformat

PIX_FMT_NONE and related fixes
author michael
date Mon, 25 Apr 2005 18:29:06 +0000
parents 82c34355e466
children dad78387544a
files img2.c utils.c
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/img2.c	Sun Apr 24 22:08:31 2005 +0000
+++ b/img2.c	Mon Apr 25 18:29:06 2005 +0000
@@ -222,7 +222,7 @@
         st->codec.codec_type = CODEC_TYPE_VIDEO;
         st->codec.codec_id = av_str2id(img_tags, s->path);
     }
-    if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt)
+    if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)
         st->codec.pix_fmt = ap->pix_fmt;
 
     return 0;
--- a/utils.c	Sun Apr 24 22:08:31 2005 +0000
+++ b/utils.c	Mon Apr 25 18:29:06 2005 +0000
@@ -1682,7 +1682,7 @@
         val = enc->sample_rate;
         break;
     case CODEC_TYPE_VIDEO:
-        val = enc->width;
+        val = enc->width && enc->pix_fmt != PIX_FMT_NONE;
         break;
     default:
         val = 1;
@@ -1704,6 +1704,8 @@
     ret = avcodec_open(&st->codec, codec);
     if (ret < 0)
         return ret;
+
+  if(!has_codec_parameters(&st->codec)){
     switch(st->codec.codec_type) {
     case CODEC_TYPE_VIDEO:
         ret = avcodec_decode_video(&st->codec, &picture, 
@@ -1720,6 +1722,7 @@
     default:
         break;
     }
+  }
  fail:
     avcodec_close(&st->codec);
     return ret;
@@ -1739,6 +1742,7 @@
  *
  * @param ic media file handle
  * @return >=0 if OK. AVERROR_xxx if error.  
+ * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need
  */
 int av_find_stream_info(AVFormatContext *ic)
 {
@@ -1841,7 +1845,7 @@
            decompress the frame. We try to avoid that in most cases as
            it takes longer and uses more memory. For MPEG4, we need to
            decompress for Quicktime. */
-        if (!has_codec_parameters(&st->codec) &&
+        if (!has_codec_parameters(&st->codec) /*&&
             (st->codec.codec_id == CODEC_ID_FLV1 ||
              st->codec.codec_id == CODEC_ID_H264 ||
              st->codec.codec_id == CODEC_ID_H263 ||
@@ -1855,7 +1859,7 @@
              st->codec.codec_id == CODEC_ID_PBM ||
              st->codec.codec_id == CODEC_ID_PPM ||
              st->codec.codec_id == CODEC_ID_SHORTEN ||
-             (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing)))
+             (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
             try_decode_frame(st, pkt->data, pkt->size);
         
         if (st->codec_info_duration >= MAX_STREAM_DURATION) {