IPlayer.cs

From VideoLAN Wiki
Revision as of 19:32, 1 January 2007 by J-b (talk | contribs) (IPlayer moved to IPlayer.cs)
Jump to navigation Jump to search
/*****************************************************************************
 * IPlayer.cs: IPlayer, IPlayer2 interface definitions
 *****************************************************************************
 * Copyright (C) 2006 Chris Meadowcroft
 *
 * Authors: Chris Meadowcroft
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

using System;
using System.Drawing;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace VLanControl
{
	[ComVisible(true)]
	public struct TrackPosition : IComparable<TrackPosition>
	{
		public int time;
		public double position;

		public TrackPosition(int time, double position)
		{
			this.time = time;
			this.position = position;
		}

		public TrackPosition(TrackPosition other)
		{
			this.time = other.time;
			this.position = other.position;
		}

		#region IComparable<TrackPosition> Members

		public int CompareTo(TrackPosition other)
		{
			return this.time.CompareTo(other.time);
		}

		#endregion
	}

	[ComVisible(true)]
	public enum PlayerState
	{
		None = 0,
		Playing = 1,
		Paused = 2,
	}

	[ComVisible(true)]
	public interface IPlayer : IDisposable
	{
		bool Visible { get; set; }
		Control Parent { get; set; }
		Rectangle Bounds { get; set; }
		Point Location { get; set; }
		Size Size { get; set; }
		Size VideoSize { get; }
		int Time { get; }
		double Position { get; }
		void MoveToPosition(TrackPosition newTrackPosition);
		int Volume { get; set; }
		int Rate { get; set; }
		void GetRates(out int minRate, out int maxRate, out int normalRate);
		bool IsPlaying { get; }
		bool IsPaused { get; }
		bool IsMute { get; }
		int Length { get; set; }
		PlayerState State { get; }
		double TimeScaling { get; set; }

		void Play();
		void ToggleMute();
		void TogglePause();
		void RotateSubtitles();
		void RotateAudioTrack();
		void RotateDeinterlaceMode();
		void RotateAspectRatio();
		void RotateCropModes();
		bool UseMpegVbrOffset { get; set; }
		void CropTop();
		void UnCropTop();
		void CropBottom();
		void UnCropBottom();
		void CropLeft();
		void UnCropLeft();
		void CropRight();
		void UnCropRight();
		void NextDvdTrack();
		void PreviousDvdTrack();
		void NextDvdChapter();
		void PreviousDvdChapter();
		TrackPosition Shuttle(int offsetSeconds);
		void ClearPlayList();
		int AddToPlayList(String fileName, String title, String[] options);
		void PlayItem(int index);
		void Stop();
	}

	[ComVisible(true)]
	public interface IPlayer2 : IPlayer
	{
		String DeinterlaceMode { get; set; }
		String AspectRatio { get; set; }
		String CropMode { get; set; }
		int CroppingLeft { get; set; }
		int CroppingRight { get; set; }
		int CroppingTop { get; set; }
		int CroppingBottom { get; set; }
		int AudioTrack { get; set; }
		int SubTitleTrack { get; set; }
		// in ms
		int AudioDelay { get; set; }
		int SubTitleDelay { get; set; }
		int ChapterCount { get; }
		int Chapter { get; set; }
		int Program { get; set; }

		void DeinterlaceModes(out String[] choices, out String[] choiceText);
		void AspectRatios(out String[] choices, out String[] choiceText);
		void CropModes(out String[] choices, out String[] choiceText);
		void AudioTracks(out int[] trackIds, out String[] trackNames);
		void SubTitleTracks(out int[] trackIds, out String[] trackNames);
		void Programs(out int[] trackIds, out String[] trackNames);
		void DisplayMessage(String message);
		bool SetConfigVariable(String name, String value);
		void PrecomputeCrop(Size videoSize, int cropLeft, int cropRight, int cropTop, int cropBottom);
		bool ComputeCrop();
	}
}