Пример #1
0
        public void HandleCommandsChanged(Element playbin)
        {
            InDvdMenu = false;
            // Get available command to know if player is in menu
            // FIXME: GlobalVideo should be Gst.Video.Global
            Gst.Query query = Global.NavigationQueryNewCommands();

            NavigationCommand[] cmds;
            if (Navigation == null)
            {
                FindNavigation(playbin);
            }
            if (!(NavigationElement.Query(query) && NavigationAdapter.ParseCommands(query, out cmds)))
            {
                return;
            }
            foreach (NavigationCommand cmd in cmds)
            {
                switch (cmd)
                {
                case NavigationCommand.Activate:
                case NavigationCommand.Left:
                case NavigationCommand.Right:
                case NavigationCommand.Up:
                case NavigationCommand.Down:
                    InDvdMenu = true;
                    break;

                default:
                    break;
                }
            }
        }
        public static bool ParseCommands(Gst.Query query, out Gst.Interfaces.NavigationCommand[] cmds)
        {
            uint len;

            cmds = null;
            if (!gst_navigation_query_parse_commands_length(query.Handle, out len))
            {
                return(false);
            }

            cmds = new Gst.Interfaces.NavigationCommand[len];

            for (uint i = 0; i < len; i++)
            {
                int cmd;

                if (!gst_navigation_query_parse_commands_nth(query.Handle, i, out cmd))
                {
                    return(false);
                }
                cmds[i] = (Gst.Interfaces.NavigationCommand)cmd;
            }

            return(true);
        }
        public static Gst.Interfaces.NavigationQueryType QueryGetType(Gst.Query query)
        {
            int raw_ret = gst_navigation_query_get_type(query == null ? IntPtr.Zero : query.Handle);

            Gst.Interfaces.NavigationQueryType ret = (Gst.Interfaces.NavigationQueryType)raw_ret;
            return(ret);
        }
Пример #4
0
        public void HandleCommandsChanged(PlayBin2 playbin)
        {
            InDvdMenu = false;
            // Get available command to know if player is in menu
            Gst.Query query = NavigationQuery.NewCommands();

            NavigationCommand[] cmds;
            if (Navigation == null)
            {
                FindNavigation(playbin);
            }
            if (!(((Element)Navigation).Query(query) && NavigationQuery.ParseCommands(query, out cmds)))
            {
                return;
            }
            foreach (NavigationCommand cmd in cmds)
            {
                switch (cmd)
                {
                case NavigationCommand.Activate:
                case NavigationCommand.Left:
                case NavigationCommand.Right:
                case NavigationCommand.Up:
                case NavigationCommand.Down:
                    InDvdMenu = true;
                    break;

                default:
                    break;
                }
            }
        }
        public static void SetAngles(Gst.Query query, uint cur_angle, uint n_angles)
        {
            if (!query.IsWritable)
            {
                throw new ApplicationException();
            }

            gst_navigation_query_set_angles(query.Handle, cur_angle, n_angles);
        }
        public static void SetCommands(Gst.Query query, Gst.Interfaces.NavigationCommand[] cmds)
        {
            if (!query.IsWritable)
            {
                throw new ApplicationException();
            }

            int[] raw_cmds = new int[cmds.Length];
            for (int i = 0; i < cmds.Length; i++)
            {
                raw_cmds[i] = (int)cmds[i];
            }

            gst_navigation_query_set_commandsv(query.Handle, (uint)raw_cmds.Length, raw_cmds);
        }
        static bool RefreshUI()
        {
            var query = new Query (Format.Percent);
            if (Pipeline.Query (query)) {
                var graph = new StringBuilder (GraphLength);
                long position = 0, duration = 0;

                var nRanges = query.NBufferingRanges;
                for (uint range = 0; range < nRanges; range++) {
                    long start, stop;
                    query.ParseNthBufferingRange (range, out start, out stop);
                    start = start * GraphLength / (stop - start);
                    stop = stop * GraphLength / (stop - start);
                    for (int i = (int)start; i < stop; i++)
                        graph.Insert (i, '-');
                }
                if (Pipeline.QueryPosition (Format.Time, out position) && position >= 0
                    && Pipeline.QueryDuration (Format.Time, out duration) && duration >= 0) {
                    var i = (int)(GraphLength * (double)position / (double)(duration + 1));
                    graph [i] = BufferingLevel < 100 ? 'X' : '>';
                }
                Console.WriteLine ("[{0}]", graph);
                if (BufferingLevel < 100) {
                    Console.WriteLine (" Buffering: {0}", BufferingLevel);
                } else {
                    Console.WriteLine ("                ");
                }
                Console.WriteLine ();
            }
            return true;
        }
 public static Gst.Query NewAngles()
 {
     Gst.Query query = (Gst.Query)Gst.MiniObject.GetObject(gst_navigation_query_new_angles(), true);
     return(query);
 }
 public static bool ParseAngles(Gst.Query query, out uint cur_angle, out uint n_angles)
 {
     return(gst_navigation_query_parse_angles(query.Handle, out cur_angle, out n_angles));
 }