with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLMediaElement_Interface is

   procedure Initialize (This : in out IHTMLMediaElement_Type) is
   begin
      Set_IID (This, IID_IHTMLMediaElement);
   end Initialize;

   function Pointer (This : IHTMLMediaElement_Type)
     return Pointer_To_IHTMLMediaElement
   is
   begin
      return To_Pointer_To_IHTMLMediaElement (Address (This));
   end Pointer;

   procedure Attach (This    : in out IHTMLMediaElement_Type;
                     Pointer : in     Pointer_To_IHTMLMediaElement)
   is
   begin
      Attach (This, GNATCOM.IInterface.To_Pointer_To_IUnknown
              (Pointer.all'Address));
   end Attach;

   function Get_error
     (This : IHTMLMediaElement_Type)
     return Pointer_To_IHTMLMediaError
   is
       RetVal : aliased Pointer_To_IHTMLMediaError;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_error
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_error;

   procedure Put_src
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.BSTR;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_src
         (Pointer (This),
          p));

      if Free then
               GNATCOM.IInterface.Free (p);
      
      end if;

   end Put_src;

   function Get_src
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_src
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_src;

   function Get_currentSrc
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_currentSrc
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_currentSrc;

   function Get_networkState
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.unsigned_short
   is
       RetVal : aliased Interfaces.C.unsigned_short;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_networkState
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_networkState;

   procedure Put_preload
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.BSTR;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_preload
         (Pointer (This),
          p));

      if Free then
               GNATCOM.IInterface.Free (p);
      
      end if;

   end Put_preload;

   function Get_preload
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_preload
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_preload;

   function Get_buffered
     (This : IHTMLMediaElement_Type)
     return Pointer_To_IHTMLTimeRanges
   is
       RetVal : aliased Pointer_To_IHTMLTimeRanges;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_buffered
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_buffered;

   procedure load
     (This : IHTMLMediaElement_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.load
         (Pointer (This)));

   end load;

   function canPlayType
     (This    : IHTMLMediaElement_Type;
      utype   : GNATCOM.Types.BSTR;
      Free    : Boolean := True)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.canPlayType
         (Pointer (This),
          utype,
          RetVal'Unchecked_Access));

      if Free then
               GNATCOM.IInterface.Free (utype);
      
      end if;

      return RetVal;
   end canPlayType;

   function Get_seeking
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_seeking
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_seeking;

   procedure Put_currentTime
     (This : IHTMLMediaElement_Type;
      p    : Interfaces.C.C_float)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_currentTime
         (Pointer (This),
          p));

   end Put_currentTime;

   function Get_currentTime
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_currentTime
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_currentTime;

   function Get_initialTime
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_initialTime
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_initialTime;

   function Get_duration
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_duration
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_duration;

   function Get_paused
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_paused
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_paused;

   procedure Put_defaultPlaybackRate
     (This : IHTMLMediaElement_Type;
      p    : Interfaces.C.C_float)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_defaultPlaybackRate
         (Pointer (This),
          p));

   end Put_defaultPlaybackRate;

   function Get_defaultPlaybackRate
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_defaultPlaybackRate
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_defaultPlaybackRate;

   procedure Put_playbackRate
     (This : IHTMLMediaElement_Type;
      p    : Interfaces.C.C_float)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_playbackRate
         (Pointer (This),
          p));

   end Put_playbackRate;

   function Get_playbackRate
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_playbackRate
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_playbackRate;

   function Get_played
     (This : IHTMLMediaElement_Type)
     return Pointer_To_IHTMLTimeRanges
   is
       RetVal : aliased Pointer_To_IHTMLTimeRanges;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_played
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_played;

   function Get_seekable
     (This : IHTMLMediaElement_Type)
     return Pointer_To_IHTMLTimeRanges
   is
       RetVal : aliased Pointer_To_IHTMLTimeRanges;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_seekable
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_seekable;

   function Get_ended
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_ended
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_ended;

   procedure Put_autoplay
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_autoplay
         (Pointer (This),
          p));

   end Put_autoplay;

   function Get_autoplay
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_autoplay
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_autoplay;

   procedure Put_loop
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_loop
         (Pointer (This),
          p));

   end Put_loop;

   function Get_loop
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_loop
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_loop;

   procedure play
     (This : IHTMLMediaElement_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.play
         (Pointer (This)));

   end play;

   procedure pause
     (This : IHTMLMediaElement_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.pause
         (Pointer (This)));

   end pause;

   procedure Put_controls
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_controls
         (Pointer (This),
          p));

   end Put_controls;

   function Get_controls
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_controls
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_controls;

   procedure Put_volume
     (This : IHTMLMediaElement_Type;
      p    : Interfaces.C.C_float)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_volume
         (Pointer (This),
          p));

   end Put_volume;

   function Get_volume
     (This : IHTMLMediaElement_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_volume
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_volume;

   procedure Put_muted
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_muted
         (Pointer (This),
          p));

   end Put_muted;

   function Get_muted
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_muted
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_muted;

   procedure Put_autobuffer
     (This : IHTMLMediaElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_autobuffer
         (Pointer (This),
          p));

   end Put_autobuffer;

   function Get_autobuffer
     (This : IHTMLMediaElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_autobuffer
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_autobuffer;

end MSHTML.IHTMLMediaElement_Interface;

