Revision cb2c971d ffmpeg.c

View differences:

ffmpeg.c
2284 2284
        ost = ost_table[i];
2285 2285
        if (ost->encoding_needed) {
2286 2286
            AVCodec *codec = i < nb_output_codecs ? output_codecs[i] : NULL;
2287
            AVCodecContext *dec = ist_table[ost->source_index]->st->codec;
2287 2288
            if (!codec)
2288 2289
                codec = avcodec_find_encoder(ost->st->codec->codec_id);
2289 2290
            if (!codec) {
......
2292 2293
                ret = AVERROR(EINVAL);
2293 2294
                goto dump_format;
2294 2295
            }
2296
            if (dec->subtitle_header) {
2297
                ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size);
2298
                if (!ost->st->codec->subtitle_header) {
2299
                    ret = AVERROR(ENOMEM);
2300
                    goto dump_format;
2301
                }
2302
                memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size);
2303
                ost->st->codec->subtitle_header_size = dec->subtitle_header_size;
2304
            }
2295 2305
            if (avcodec_open(ost->st->codec, codec) < 0) {
2296 2306
                snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
2297 2307
                        ost->file_index, ost->index);
......
2690 2700
                }
2691 2701
                av_fifo_free(ost->fifo); /* works even if fifo is not
2692 2702
                                             initialized but set to zero */
2703
                av_freep(&ost->st->codec->subtitle_header);
2693 2704
                av_free(ost->pict_tmp.data[0]);
2694 2705
                av_free(ost->forced_kf_pts);
2695 2706
                if (ost->video_resample)

Also available in: Unified diff