[MPlayer-dev-eng] patch related to bug 1786 unable to set xvidenc flag XVID_VOP_TOPFIELDFIRST

Jarek Czekalski jarekczek at poczta.onet.pl
Tue Sep 14 21:19:13 CEST 2010


  Hi

I'm working on the bug described on bugzilla:
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1786

I found some issues in handling mpi->fields by mencoder, so first I'd 
like to make them visible and easy to debug. Could you commit such a 
change? It's described at bugzilla as:

D. make it possible that mplayer shows scan type (interlacing) flags 
when playing back. Few tools show it
and some video forum people even deny the existance of them.

Is it ok?

Best regards
Jarek Czekalski

Index: libmpcodecs/dec_video.c
===================================================================
--- libmpcodecs/dec_video.c    (revision 32226)
+++ libmpcodecs/dec_video.c    (working copy)
@@ -52,10 +52,40 @@

  int field_dominance = -1;

+//! \brief To enable some extra info after decoding the first frame
+/** It should be set by mplayer/mencoder after opening the file */
+int print_info_on_next_decode = 0;
+
  int divx_quality = 0;

  const vd_functions_t *mpvdec = NULL;

+//! Print some verbose info after decoding a frame
+/** Run only once for a file
+  * \param mpi returned by decode_video */
+void print_decode_info(const mp_image_t *mpi)
+{
+    const char* header = "[video decoder] Scan type:";
+
+    // report scan type
+    int is_unknown = !(mpi->fields & MP_IMGFIELD_ORDERED);
+    int is_interlaced = ((mpi->fields & MP_IMGFIELD_INTERLACED) != 0);
+    if (is_unknown) {
+        mp_msg(MSGT_DECVIDEO, MSGL_V, "%s unknown\n", header);
+        }
+    else {
+        if (is_interlaced) {
+            mp_msg(MSGT_DECVIDEO, MSGL_V, "%s interlaced, %s\n", header,
+                   (mpi->fields & MP_IMGFIELD_TOP_FIRST) ? "tff" : "bff");
+            }
+        else { // progressive
+            mp_msg(MSGT_DECVIDEO, MSGL_V, "%s progressive\n", header);
+            }
+        }
+
+    print_info_on_next_decode = 0;
+}
+
  int get_video_quality_max(sh_video_t *sh_video)
  {
      vf_instance_t *vf = sh_video->vfilter;
@@ -467,6 +497,9 @@
                  sh_video->num_buffered_pts = delay;
          }
      }
+
+    if (print_info_on_next_decode) print_decode_info(mpi);
+
      return mpi;
  }

Index: libmpcodecs/dec_video.h
===================================================================
--- libmpcodecs/dec_video.h    (revision 32226)
+++ libmpcodecs/dec_video.h    (working copy)
@@ -22,6 +22,7 @@
  #include "libmpdemux/stheader.h"

  extern int field_dominance;
+extern int print_info_on_next_decode;

  // dec_video.c:
  void vfm_help(void);
Index: mplayer.c
===================================================================
--- mplayer.c    (revision 32226)
+++ mplayer.c    (working copy)
@@ -3815,6 +3815,7 @@
  if(mpctx->loop_times==1) mpctx->loop_times = -1;

  mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);
+print_info_on_next_decode = 1;

  total_time_usage_start=GetTimer();
  audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
Index: mencoder.c
===================================================================
--- mencoder.c    (revision 32226)
+++ mencoder.c    (working copy)
@@ -686,6 +686,7 @@
    m_config_push(mconfig);
    m_entry_set_options(mconfig,&filelist[curfile]);
    filename = filelist[curfile].name;
+  print_info_on_next_decode = 1;

  #ifdef CONFIG_ASS
    ass_library = ass_init();


More information about the MPlayer-dev-eng mailing list