[MPlayer-dev-eng] Patch - get_property chapters

Kevin DeKorte kdekorte at gmail.com
Tue Sep 16 20:27:18 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Can you please apply this patch to get the number of chapters from the
media file. This is my first patch, so I hope this is correct. It
appears to work properly with mkv files. dvd:// and dvdnav:// don't
appear to set the num_chapters variable in the demuxer structure. This
property can be useful for applications like gnome-mplayer so it can
determine if it should load the gui elements for chapter seeking or not.

Thanks,

Kevin


Index: command.c
===================================================================
- --- command.c   (revision 27630)
+++ command.c   (working copy)
@@ -447,6 +447,15 @@
~     return M_PROPERTY_OK;
~ }

+/// Number of chapters in file
+static int mp_property_chapters(m_option_t *prop, int action, void *arg,
+                               MPContext *mpctx)
+{
+    if (!mpctx->demuxer)
+       return M_PROPERTY_UNAVAILABLE;
+    return m_property_int_ro(prop, action, arg,
mpctx->demuxer->num_chapters);
+}
+
~ /// Current dvd angle (RW)
~ static int mp_property_angle(m_option_t *prop, int action, void *arg,
~                                MPContext *mpctx)
@@ -1983,6 +1992,8 @@
~      M_OPT_MIN, 0, 0, NULL },
~     { "chapter", mp_property_chapter, CONF_TYPE_INT,
~      M_OPT_MIN, 1, 0, NULL },
+    { "chapters", mp_property_chapters, CONF_TYPE_INT,
+     0, 0, 0, NULL },
~     { "angle", mp_property_angle, CONF_TYPE_INT,
~      CONF_RANGE, -2, 10, NULL },
~     { "metadata", mp_property_metadata, CONF_TYPE_STRING_LIST,


- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIz/qG6w2kMH0L1dERAvxcAJ9jkc+BdM7YEqvqbvcIuoP3t2qMFQCeM9oS
knVCoXdTX84QkIW1gcc5UEw=
=P42f
-----END PGP SIGNATURE-----



More information about the MPlayer-dev-eng mailing list