Ticket #4925: remove_audio_streams_v2.diff

File remove_audio_streams_v2.diff, 5.7 KB (added by skamithi, 16 years ago)
  • libs/libmythtv/avformatdecoder.cpp

     
    14431443    map<int,uint> lang_sub_cnt;
    14441444    map<int,uint> lang_aud_cnt;
    14451445
     1446    if (ringBuffer->isDVD() &&
     1447        ringBuffer->DVD()->AudioStreamsChanged())
     1448    {
     1449        ringBuffer->DVD()->AudioStreamsChanged(false);
     1450        RemoveAudioStreams();
     1451    }
     1452
    14461453    for (uint i = 0; i < ic->nb_streams; i++)
    14471454    {
    14481455        AVCodecContext *enc = ic->streams[i]->codec;
     
    18581865    {
    18591866        GetNVP()->SetAudioParams(-1, -1, -1, false /* AC3/DTS pass-through */);
    18601867        GetNVP()->ReinitAudio();
     1868        audioIn = AudioInfo();
    18611869    }
    18621870
    18631871    // if we don't have a video stream we still need to make sure some
     
    19911999        else
    19922000            i++;
    19932001    }
    1994     av_read_frame_flush(ic);
    19952002}
    19962003
    19972004void release_avf_buffer(struct AVCodecContext *c, AVFrame *pic)
     
    30203027                if ((storedPackets.count() > 10 && !decodeStillFrame) ||
    30213028                    decodeStillFrame)
    30223029                {
    3023                     RemoveAudioStreams();
    30243030                    storevideoframes = false;
    30253031                    dvdTitleChanged = false;
    3026                     ScanStreams(true);
    30273032                }
    30283033                else
    30293034                    storevideoframes = true;
  • libs/libmythtv/DVDRingBuffer.cpp

     
    3434      lastNav(NULL),    part(0),
    3535      title(0),         titleParts(0),
    3636      gotStop(false),
    37       cellHasStillFrame(false), dvdWaiting(false),
     37      cellHasStillFrame(false), audioStreamsChanged(false),
     38      dvdWaiting(false),
    3839      titleLength(0), hl_startx(0), hl_width(0),
    3940      hl_starty(0), hl_height(0),
    4041      menuBuflength(0),
     
    446447                            break;
    447448                    }
    448449                }
     450               
     451                audioStreamsChanged = true;
    449452
    450453                if (blockBuf != dvdBlockWriteBuf)
    451454                {
  • libs/libmythtv/DVDRingBuffer.h

     
    4141    void GetPartAndTitle(int &_part, int &_title) const
    4242        { _part  = part; _title = title; }
    4343    uint GetTotalTimeOfTitle(void);
    44     uint GetChapterLength(void) { return pgLength / 90000; }
     44    uint GetChapterLength(void) const { return pgLength / 90000; }
    4545    uint GetCellStart(void);
    46     bool InStillFrame(void) { return cellHasStillFrame; }
    47     bool IsWaiting(void) { return dvdWaiting; }
    48     int  NumPartsInTitle(void) { return titleParts; }
     46    bool InStillFrame(void) const { return cellHasStillFrame; }
     47    bool AudioStreamsChanged(void) const { return audioStreamsChanged; }
     48    bool IsWaiting(void) const { return dvdWaiting; }
     49    int  NumPartsInTitle(void) const { return titleParts; }
    4950    void GetMenuSPUPkt(uint8_t *buf, int len, int stream_id);
    5051
    5152    AVSubtitleRect *GetMenuButton(void);
     
    9798    int NumMenuButtons(void) const;
    9899    void IgnoreStillOrWait(bool skip) { skipstillorwait = skip; }
    99100    void InStillFrame(bool change) { cellHasStillFrame = change; }
     101    void AudioStreamsChanged(bool change) { audioStreamsChanged = change; }
    100102    uint GetCurrentTime(void) { return (currentTime / 90000); }
    101103    uint TitleTimeLeft(void);
    102104    void  SetTrack(uint type, int trackNo);
     
    129131    bool           gotStop;
    130132
    131133    bool           cellHasStillFrame;
     134    bool           audioStreamsChanged;
    132135    bool           dvdWaiting;
    133136    long long      titleLength;
    134137    MythTimer      stillFrameTimer;
  • libs/libavformat/utils.c

     
    580580
    581581    *pnum = 0;
    582582    *pden = 0;
     583
     584    if (!st || !st->codec)
     585        return;
     586   
    583587    switch(st->codec->codec_type) {
    584588    case CODEC_TYPE_VIDEO:
    585589        if(st->time_base.num*1000LL > st->time_base.den){
     
    792796    for(;;) {
    793797        /* select current input stream component */
    794798        st = s->cur_st;
    795         if (st) {
     799        if (st && st->codec) {
    796800            if (!st->need_parsing || !st->parser) {
    797801                /* no parsing needed: we just output the packet as is */
    798802                /* raw data support */
     
    867871                s->cur_pkt.pos = startpos;
    868872
    869873            st = s->streams[s->cur_pkt.stream_index];
    870             if(st->codec->debug & FF_DEBUG_PTS)
     874            if(st && st->codec && st->codec->debug & FF_DEBUG_PTS)
    871875                av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
    872876                    s->cur_pkt.stream_index,
    873877                    s->cur_pkt.pts,
     
    877881            s->cur_st = st;
    878882            s->cur_ptr = s->cur_pkt.data;
    879883            s->cur_len = s->cur_pkt.size;
    880             if (st->need_parsing && !st->parser) {
     884            if (st && st->need_parsing && !st->parser) {
    881885                st->parser = av_parser_init(st->codec->codec_id);
    882886                if (!st->parser) {
    883887                    /* no parser available : just output the raw packets */
     
    892896            }
    893897        }
    894898    }
    895     if(st->codec->debug & FF_DEBUG_PTS)
     899    if(st->codec && st->codec->debug & FF_DEBUG_PTS)
    896900        av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
    897901            pkt->stream_index,
    898902            pkt->pts,