~ppsspp/ppsspp/ffmpeg-upstream

« back to all changes in this revision

Viewing changes to ffmpeg.c

  • Committer: Sérgio Benjamim
  • Date: 2015-07-20 03:55:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150720035505-i1jj1zcjcnd0mc7w
Updated to 2.7.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
    /* close files */
457
457
    for (i = 0; i < nb_output_files; i++) {
458
458
        OutputFile *of = output_files[i];
459
 
        AVFormatContext *s = of->ctx;
 
459
        AVFormatContext *s;
 
460
        if (!of)
 
461
            continue;
 
462
        s = of->ctx;
460
463
        if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
461
464
            avio_closep(&s->pb);
462
465
        avformat_free_context(s);
466
469
    }
467
470
    for (i = 0; i < nb_output_streams; i++) {
468
471
        OutputStream *ost = output_streams[i];
469
 
        AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
 
472
        AVBitStreamFilterContext *bsfc;
 
473
 
 
474
        if (!ost)
 
475
            continue;
 
476
 
 
477
        bsfc = ost->bitstream_filters;
470
478
        while (bsfc) {
471
479
            AVBitStreamFilterContext *next = bsfc->next;
472
480
            av_bitstream_filter_close(bsfc);
650
658
            if (!new_pkt.buf)
651
659
                exit_program(1);
652
660
        } else if (a < 0) {
 
661
            new_pkt = *pkt;
653
662
            av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s",
654
663
                   bsfc->filter->name, pkt->stream_index,
655
664
                   avctx->codec ? avctx->codec->name : "copy");
1176
1185
    if (!ost->last_frame)
1177
1186
        ost->last_frame = av_frame_alloc();
1178
1187
    av_frame_unref(ost->last_frame);
1179
 
    if (next_picture)
 
1188
    if (next_picture && ost->last_frame)
1180
1189
        av_frame_ref(ost->last_frame, next_picture);
1181
1190
    else
1182
1191
        av_frame_free(&ost->last_frame);
1865
1874
        ret = AVERROR_INVALIDDATA;
1866
1875
    }
1867
1876
 
1868
 
    if (*got_output || ret<0 || pkt->size)
 
1877
    if (*got_output || ret<0)
1869
1878
        decode_error_stat[ret<0] ++;
1870
1879
 
 
1880
    if (ret < 0 && exit_on_error)
 
1881
        exit_program(1);
 
1882
 
1871
1883
    if (!*got_output || ret < 0) {
1872
1884
        if (!pkt->size) {
1873
1885
            for (i = 0; i < ist->nb_filters; i++)
2010
2022
            );
2011
2023
    }
2012
2024
 
2013
 
    if (*got_output || ret<0 || pkt->size)
 
2025
    if (*got_output || ret<0)
2014
2026
        decode_error_stat[ret<0] ++;
2015
2027
 
 
2028
    if (ret < 0 && exit_on_error)
 
2029
        exit_program(1);
 
2030
 
2016
2031
    if (*got_output && ret >= 0) {
2017
2032
        if (ist->dec_ctx->width  != decoded_frame->width ||
2018
2033
            ist->dec_ctx->height != decoded_frame->height ||
2128
2143
    int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
2129
2144
                                          &subtitle, got_output, pkt);
2130
2145
 
2131
 
    if (*got_output || ret<0 || pkt->size)
 
2146
    if (*got_output || ret<0)
2132
2147
        decode_error_stat[ret<0] ++;
2133
2148
 
 
2149
    if (ret < 0 && exit_on_error)
 
2150
        exit_program(1);
 
2151
 
2134
2152
    if (ret < 0 || !*got_output) {
2135
2153
        if (!pkt->size)
2136
2154
            sub2video_flush(ist);