Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program selection #12

Open
GoogleCodeExporter opened this issue May 25, 2015 · 0 comments
Open

Program selection #12

GoogleCodeExporter opened this issue May 25, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
Canot select a spécific program id.

What is the expected output? What do you see instead?
Implement a QVideoDecoder method :selectProgram(int programId)
which set the videoStream on programId stream_index.

What version of the product are you using? On what operating system?
version: 23 09 2011
os: win7

Please provide any additional information below.
   void QVideoDecoder::setProgram(int programId)
   {
        int index = -1;

        for(int i=0; i<this->pFormatCtx->nb_programs; i++)
        {
            ffmpeg::AVProgram *program = this->pFormatCtx->programs[i];
            if(program->id != programId)
                continue;
            for(int j=0; j<program->nb_stream_indexes; j++)
            {
                int sidx1 = program->stream_index[j];
                int sidx2 = *program->stream_index;
                int ris = sidx2 + j;

                ffmpeg::AVStream *avs = this->pFormatCtx->streams[ris];
                ffmpeg::AVDiscard avd = avs->discard;
                ffmpeg::AVCodecContext *avc = avs->codec;
                ///ffmpeg::CodecType typ = avc->codec_type;

                /*if(/*this->pFormatCtx->streams[ris]->discard
                        &&* this->pFormatCtx->streams[ris]->codec->codec_type == type)*/
                {
                    index = ris;
                    break;
                }
            }

            qDebug() << "QVideoDecoder.setProgram(): Program Index=" << program->id;
            //qDebug() << "QVideoDecoder.setProgram(): Program Index=" << program->provider_name;
            //qDebug() << "QVideoDecoder.setProgram(): Program Name=" << program->name;
            qDebug() << "QVideoDecoder.setProgram(): Program Index=" << index;

        }

        if (index != -1)
        {
            videoStream=index; // OCA

            // Get a pointer to the codec context for the video stream
            pCodecCtx=pFormatCtx->streams[videoStream]->codec;

            // Find the decoder for the video stream
            pCodec=avcodec_find_decoder(pCodecCtx->codec_id);

            if(pCodec!=NULL)
            {
                avcodec_open(pCodecCtx, pCodec);
            }
        }
  }



Original issue reported on code.google.com by [email protected] on 30 Nov 2011 at 9:03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant