Ticket #7454: mythtv_ffmpeg_19621_19622_matroskadec.diff

File mythtv_ffmpeg_19621_19622_matroskadec.diff, 1.9 KB (added by tralph11@…, 16 years ago)

FFmpeg backport to fix MKV playback

  • libs/libavformat/matroskadec.c

     
    241241typedef struct {
    242242    uint64_t duration;
    243243    int64_t  reference;
     244    uint64_t  non_simple;
    244245    EbmlBin  bin;
    245246} MatroskaBlock;
    246247
     
    479480    { MATROSKA_ID_SIMPLEBLOCK,    EBML_BIN,  0, offsetof(MatroskaBlock,bin) },
    480481    { MATROSKA_ID_BLOCKDURATION,  EBML_UINT, 0, offsetof(MatroskaBlock,duration), {.u=AV_NOPTS_VALUE} },
    481482    { MATROSKA_ID_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) },
     483    { 1,                          EBML_UINT, 0, offsetof(MatroskaBlock,non_simple), {.u=1} },
    482484    { 0 }
    483485};
    484486
     
    13741376                      st->codec->height * track->video.display_width,
    13751377                      st->codec-> width * track->video.display_height,
    13761378                      255);
     1379            if (st->codec->codec_id != CODEC_ID_H264)
    13771380            st->need_parsing = AVSTREAM_PARSE_HEADERS;
    13781381        } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
    13791382            st->codec->codec_type = CODEC_TYPE_AUDIO;
     
    17441747    blocks_list = &cluster.blocks;
    17451748    blocks = blocks_list->elem;
    17461749    for (i=0; i<blocks_list->nb_elem; i++)
    1747         if (blocks[i].bin.size > 0)
     1750        if (blocks[i].bin.size > 0) {
     1751            int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
    17481752            res=matroska_parse_block(matroska,
    17491753                                     blocks[i].bin.data, blocks[i].bin.size,
    17501754                                     blocks[i].bin.pos,  cluster.timecode,
    1751                                      blocks[i].duration, !blocks[i].reference,
     1755                                     blocks[i].duration, is_keyframe,
    17521756                                     pos);
     1757        }
    17531758    ebml_free(matroska_cluster, &cluster);
    17541759    if (res < 0)  matroska->done = 1;
    17551760    return res;