Ñò
•µSJc           @   s  d  Z  d d k l Z l Z d d k l Z d d d „  ƒ  YZ d „  Z e d j oº d d k	 Z	 d d k Z e
 e	 i ƒ d	 j  o! d
 e	 i d GHe	 i d ƒ n xh e	 i d D]U Z e i e ƒ Z e d j o* d e e i e i d e i d f GHq² d e GHq² Wn d S(   s7   This small library load and identify some image format iÿÿÿÿ(   t	   QuickTimet   AVI(   t	   randranget   Videoc           B   sG   e  Z d Z d Z d Z d Z d Z d Z d „  Z	 d „  Z
 d „  Z RS(   i    c         C   s   d  S(   N(    (   t   self(    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyt   __init__   s    c         C   st   t  d |  i ƒ } |  i d j o t i |  i |  i | | ƒ S|  i d j o t i |  i |  i | | ƒ Sd  Sd  S(   Ni    R    R   (	   R   t   framest   pluginR    t   extract_jpeg_filet	   moviefilet   privatedataR   t   None(   R   t   pictfilet   frame(    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyt   get_random_frame   s    c         C   sb   |  i  d j o t i |  i |  i | | ƒ S|  i  d j o t i |  i |  i | | ƒ Sd  Sd  S(   NR    R   (   R   R    R   R	   R
   R   R   (   R   R   R   (    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyt	   get_frame"   s    N(   i    i    (   t   __name__t
   __module__R   t   formatt   sizet   modeR   R	   R
   R   R   R   (    (    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyR      s   		c         C   s.  t  i |  ƒ } | d  j oT t ƒ  } | | _ d | d | _ | d | _ | d | _ d | _ |  | _	 | St
 i |  ƒ } | d  j o’ t ƒ  } | | _ d | d d ?d @| d d	 ?d @| d d
 ?d @| d d @f | _ | d | d f | _ | d | _ d | _ |  | _	 | St d ƒ ‚ d  S(   Ns   AVI (%s)R   t
   video_sizeR   R   s   QuickTime (%c%c%c%c)i   iÿ   i   i   t   widtht   heightR    s   Format not recognized(   R   t   identifyR   R   R
   R   R   R   R   R	   R    t   IOError(   t   filenamet   infot   video(    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyR   1   s*    						E		t   __main__Ni   s   Usage: %s files...
i    i   s$   %s (format=%s  size <%dx%d> mode=%s)s   %s is not recognized(    (   t   __doc__t   PhotonR    R   t   randomR   R   R   R   t   syst   lent   argvt   exitR   t   opent   imR   R   R   (    (    (    sW   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/Video.pyt   <module>   s    *	 *
