3
‡Œði  ã               @   s”   d dl mZ d dlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZ dd„ Zeƒ dd„ ƒZeƒ d	d
„ ƒZeƒ dd„ ƒZeƒ dd„ ƒZdddd
gZdS )é    )Úunicode_literals)Ú
basestringé   )Úfilter_operatorÚ
GlobalNodeÚ	InputNodeÚMergeOutputsNodeÚ
OutputNodeÚoutput_operatorc             K   sB   | |d< |j ddƒ}|r0d|kr(tdƒ‚||d< ttj|d�jƒ S )a>  Input file URL (ffmpeg ``-i`` option)

    Any supplied kwargs are passed to ffmpeg verbatim (e.g. ``t=20``,
    ``f='mp4'``, ``acodec='pcm'``, etc.).

    To tell ffmpeg to read from stdin, use ``pipe:`` as the filename.

    Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
    ÚfilenameÚfNÚformatz*Can't specify both `format` and `f` kwargs)Úkwargs)ÚpopÚ
ValueErrorr   ÚinputÚ__name__Ústream)r   r   Úfmt© r   ú7/tmp/pip-build-6m2fasei/ffmpeg-python/ffmpeg/_ffmpeg.pyr      s    
r   c             G   s   t | tj|ƒjƒ S )zCAdd extra global command-line argument(s), e.g. ``-progress``.
    )r   Úglobal_argsr   r   )r   Úargsr   r   r   r   #   s    r   c             C   s   t | tjdgƒjƒ S )z�Overwrite output files without asking (ffmpeg ``-y`` option)

    Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
    z-y)r   Úoverwrite_outputr   r   )r   r   r   r   r   *   s    r   c              G   s   t | tjƒjƒ S )z9Include all given outputs in one ffmpeg command line
    )r   Úmerge_outputsr   r   )Ústreamsr   r   r   r   3   s    r   c              O   st   t | ƒ} d|kr4t| d	 tƒs&tdƒ‚| jd
ƒ|d< | }|jddƒ}|r`d|krXtdƒ‚||d< t|tj|d�jƒ S )a?  Output file URL

    Syntax:
        `ffmpeg.output(stream1[, stream2, stream3...], filename, **ffmpeg_args)`

    Any supplied keyword arguments are passed to ffmpeg verbatim (e.g.
    ``t=20``, ``f='mp4'``, ``acodec='pcm'``, ``vcodec='rawvideo'``,
    etc.).  Some keyword-arguments are handled specially, as shown below.

    Args:
        video_bitrate: parameter for ``-b:v``, e.g. ``video_bitrate=1000``.
        audio_bitrate: parameter for ``-b:a``, e.g. ``audio_bitrate=200``.
        format: alias for ``-f`` parameter, e.g. ``format='mp4'``
            (equivalent to ``f='mp4'``).

    If multiple streams are provided, they are mapped to the same
    output.

    To tell ffmpeg to write to stdout, use ``pipe:`` as the filename.

    Official documentation: `Synopsis <https://ffmpeg.org/ffmpeg.html#Synopsis>`__
    r   r   zA filename must be providedr   Nr   z*Can't specify both `format` and `f` kwargs)r   éÿÿÿÿr   )	ÚlistÚ
isinstancer   r   r   r	   Úoutputr   r   )Zstreams_and_filenamer   r   r   r   r   r   r   :   s    r   N)Ú
__future__r   Zpast.builtinsr   Ú_utilsZnodesr   r   r   r   r	   r
   r   r   r   r   r   Ú__all__r   r   r   r   Ú<module>   s    
	'