[MPlayer-cvslog] r32563 - in trunk: Changelog DOCS/man/en/mplayer.1 cfg-mencoder.h libmpcodecs/ve.c libmpcodecs/ve.h

cigaes subversion at mplayerhq.hu
Fri Oct 29 15:50:05 CEST 2010


Author: cigaes
Date: Fri Oct 29 15:50:05 2010
New Revision: 32563

Log:
Add the -force-key-frames option.

Modified:
   trunk/Changelog
   trunk/cfg-mencoder.h
   trunk/libmpcodecs/ve.c
   trunk/libmpcodecs/ve.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Fri Oct 29 15:48:12 2010	(r32562)
+++ trunk/Changelog	Fri Oct 29 15:50:05 2010	(r32563)
@@ -8,6 +8,9 @@ MPlayer (1.0)
     * experimental support for PGS (BluRay-compatible), DVB and XSUB subtitles.
     * experimental af_cmdline slave command to change e.g. audio equalizer options at runtime.
 
+    MEncoder:
+    * -force-key-frames option to set explicit seek points.
+
   rc4: "Yes We Can"
 
     GUI: Changes towards removing the GUI

Modified: trunk/cfg-mencoder.h
==============================================================================
--- trunk/cfg-mencoder.h	Fri Oct 29 15:48:12 2010	(r32562)
+++ trunk/cfg-mencoder.h	Fri Oct 29 15:50:05 2010	(r32563)
@@ -220,6 +220,8 @@ const m_option_t mencoder_opts[]={
     // info header strings
     {"info", info_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
 
+    {"force-key-frames", parse_forced_key_frames, CONF_TYPE_FUNC_PARAM, CONF_GLOBAL, 0, 0, NULL},
+
 #ifdef CONFIG_MP3LAME
     {"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
 #endif

Modified: trunk/libmpcodecs/ve.c
==============================================================================
--- trunk/libmpcodecs/ve.c	Fri Oct 29 15:48:12 2010	(r32562)
+++ trunk/libmpcodecs/ve.c	Fri Oct 29 15:50:05 2010	(r32563)
@@ -26,6 +26,7 @@
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
+#include "ve.h"
 
 extern const vf_info_t ve_info_lavc;
 extern const vf_info_t ve_info_vfw;
@@ -73,3 +74,56 @@ vf_instance_t* vf_open_encoder(vf_instan
     char* vf_args[] = { "_oldargs_", args, NULL };
     return vf_open_plugin(encoder_list,next,name,vf_args);
 }
+
+static double *forced_key_frames_ts;
+static int forced_key_frames_number;
+static int forced_key_frames_idx;
+
+int parse_forced_key_frames(const m_option_t *opt, const char *arg)
+{
+    double ts;
+    const char *p;
+    int nts = 1, idx = 0, len;
+
+    for (p = arg; *p; p++)
+        nts += *p == ',';
+    free(forced_key_frames_ts);
+    forced_key_frames_ts = calloc(sizeof(*forced_key_frames_ts), nts);
+    p = arg;
+    while (1) {
+        len = parse_timestring(p, &ts, ',');
+        if (!len) {
+            mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+                   "Option force-key-frames: invalid time: '%s'\n", p);
+            return M_OPT_INVALID;
+        }
+        forced_key_frames_ts[idx++] = ts;
+        if (!p[len])
+            break;
+        p += len + 1;
+    }
+    forced_key_frames_number = idx;
+    forced_key_frames_idx = 0;
+    for (idx = 1; idx < forced_key_frames_number; idx++) {
+        if (forced_key_frames_ts[idx - 1] >= forced_key_frames_ts[idx]) {
+            mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option force-key-frames: "
+                   "timestamps are not in ascending order\n");
+            return M_OPT_INVALID;
+        }
+    }
+    return 0;
+}
+
+int is_forced_key_frame(double pts)
+{
+    if (forced_key_frames_idx < forced_key_frames_number &&
+        pts >= forced_key_frames_ts[forced_key_frames_idx]) {
+        forced_key_frames_idx++;
+        if (forced_key_frames_idx >= forced_key_frames_number) {
+            free(forced_key_frames_ts);
+            forced_key_frames_number = 0;
+        }
+        return 1;
+    }
+    return 0;
+}

Modified: trunk/libmpcodecs/ve.h
==============================================================================
--- trunk/libmpcodecs/ve.h	Fri Oct 29 15:48:12 2010	(r32562)
+++ trunk/libmpcodecs/ve.h	Fri Oct 29 15:50:05 2010	(r32563)
@@ -31,4 +31,7 @@ extern int   lavc_param_abitrate;
 extern int   lavc_param_atag;
 extern int   lavc_param_audio_global_header;
 
+int parse_forced_key_frames(const m_option_t *opt, const char *arg);
+int is_forced_key_frame(double pts);
+
 #endif /* MPLAYER_VE_H */


More information about the MPlayer-cvslog mailing list