ó
È4ec           @   sš   d  d l  m Z m Z m Z d  d l m Z d Z d „  Z d „  Z	 d e j
 f d „  ƒ  YZ e j e j e	 ƒ e j e j d ƒ e j e j d	 ƒ d
 S(   i   (   t   Imaget	   ImageFilet   JpegImagePlugin(   t   i16bes   0.1c         C   s   t  j |  ƒ S(   N(   R   t   _accept(   t   prefix(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR      s    c         C   s   t  j |  | | ƒ S(   N(   R   t   _save(   t   imt   fpt   filename(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR   !   s    t   MpoImageFilec           B   sƒ   e  Z d  Z d Z e Z d „  Z d d „ Z d „  Z	 e
 d „  ƒ Z e
 d „  ƒ Z d „  Z d „  Z d	 „  Z e d d
 „ ƒ Z RS(   t   MPOs   MPO (CIPA DC-007)c         C   s.   |  j  j d ƒ t j j |  ƒ |  j ƒ  d  S(   Ni    (   R   t   seekR   t   JpegImageFilet   _opent   _after_jpeg_open(   t   self(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR   0   s    c         C   sÚ   | d  k	 r | n	 |  j ƒ  |  _ |  j d |  _ g  |  j d D] } | d |  j d ^ q? |  _ d |  j d <|  j t |  j ƒ k sŽ t ‚ |  j d =|  j |  _	 |  j	 j
 |  j d ƒ d |  _ d |  _ d |  _ d  S(   Ni°  i°  t
   DataOffsett   mpoffseti    i   (   t   Nonet   _getmpt   mpinfot   _MpoImageFile__framecountt   infot   _MpoImageFile__mpoffsetst   lent   AssertionErrorR   t   _MpoImageFile__fpR   t   _MpoImageFile__framet   offsett   readonly(   R   t   mpheadert   mpent(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR   5   s    !2
		c         C   s   |  j  j | ƒ d  S(   N(   R   R   (   R   t   pos(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt	   load_seekG   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt   n_framesJ   s    c         C   s   |  j  d k S(   Ni   (   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt   is_animatedN   s    c         C   s1  |  j  | ƒ s d  S|  j |  _ |  j | |  _ |  j j |  j d ƒ t |  j j d ƒ ƒ d k rÝ t |  j j d ƒ ƒ d } t j	 |  j | ƒ |  j
 d <|  j ƒ  } d | k rù d | k rù | d | d f |  _ qù n d |  j
 k rù |  j
 d =n  d d	 |  j |  j |  j d f f g |  _ | |  _ d  S(
   Ni   iáÿ  t   exifi   i   t   jpegi    t    (   i    i    (   t   _seek_checkR   R   R   R   R   t   i16t   readR   t
   _safe_readR   t   getexift   _sizet   sizet   modet   tileR   (   R   t   framet   nR%   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR   R   s    +c         C   s   |  j  S(   N(   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt   tellf   s    c         C   sO   z> y& |  j  |  j k r( |  j  j ƒ  n  Wn t k
 r< n XWd  d  |  _  Xd  S(   N(   R   R   t   closet   AttributeErrorR   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt
   _close__fpi   s     c         C   s   t  |  _ |  j | ƒ |  S(   sC  
        Transform the instance of JpegImageFile into
        an instance of MpoImageFile.
        After the call, the JpegImageFile is extended
        to be an MpoImageFile.

        This is essentially useful when opening a JPEG
        file that reveals itself as an MPO, to avoid
        double call to _open.
        (   R
   t	   __class__R   (   t   jpeg_instanceR   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt   adoptr   s    	N(   t   __name__t
   __module__t   formatt   format_descriptiont   Falset!   _close_exclusive_fp_after_loadingR   R   R   R"   t   propertyR#   R$   R   R3   R6   t   staticmethodR9   (    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyR
   *   s   						s   .mpos	   image/mpoN(   R'   R    R   R   t   _binaryR   R)   t   __version__R   R   R   R
   t   register_saveR<   t   register_extensiont   register_mime(    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MpoImagePlugin.pyt   <module>   s   			`