On Thu, Jul 16, 2015 at 7:56 PM, Anton Khirnov <[email protected]> wrote:
> ---
>  avconv.c | 101 
> ++++++++++++++++++++++++++++++++++-----------------------------
>  1 file changed, 55 insertions(+), 46 deletions(-)
>
> diff --git a/avconv.c b/avconv.c
> index 87b120f..13bf54c 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1549,6 +1549,58 @@ static InputStream *get_input_stream(OutputStream *ost)
>      return NULL;
>  }
>
> +static int init_output_stream(OutputStream *ost, char *error, int error_len)
> +{
> +    int ret = 0;
> +
> +    if (ost->encoding_needed) {
> +        AVCodec      *codec = ost->enc;
> +        AVCodecContext *dec = NULL;
> +        InputStream *ist;
> +
> +        if ((ist = get_input_stream(ost)))
> +            dec = ist->dec_ctx;
> +        if (dec && dec->subtitle_header) {
> +            ost->enc_ctx->subtitle_header = 
> av_malloc(dec->subtitle_header_size);
> +            if (!ost->enc_ctx->subtitle_header)
> +                return AVERROR(ENOMEM);
> +            memcpy(ost->enc_ctx->subtitle_header, dec->subtitle_header, 
> dec->subtitle_header_size);
> +            ost->enc_ctx->subtitle_header_size = dec->subtitle_header_size;
> +        }
> +        if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
> +            av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
> +        av_dict_set(&ost->encoder_opts, "side_data_only_packets", "1", 0);
> +
> +        if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 
> 0) {
> +            if (ret == AVERROR_EXPERIMENTAL)
> +                abort_codec_experimental(codec, 1);
> +            snprintf(error, error_len, "Error while opening encoder for 
> output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, 
> width or height",

nit: care to split this long line while moving the code?
-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to