Git Product home page Git Product logo

ijkplayer-track's People

Contributors

lm3515 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ijkplayer-track's Issues

对于切换音轨里面调用ffp_set_stream_selected()函数的解释有疑问

对于这个代码的解释有疑问:
//传递两个参数tracksNum:音轨的个数,stream_index:第几个音轨
ffp_set_stream_selected(ffp, tracksNum, stream_index);

我的理解:
//传递两个参数selected:切换为该音轨或者关闭该音轨,stream:第几个音轨
int ffp_set_stream_selected(FFPlayer *ffp, int stream, int selected)
{
VideoState *is = ffp->is;
AVFormatContext *ic = NULL;
AVCodecParameters *codecpar = NULL;
if (!is)
return -1;
ic = is->ic;
if (!ic)
return -1;

if (stream < 0 || stream >= ic->nb_streams) {
    av_log(ffp, AV_LOG_ERROR, "invalid stream index %d >= stream number (%d)\n", stream, ic->nb_streams);
    return -1;
}

codecpar = ic->streams[stream]->codecpar;
if (selected) {

//如果选择该sream,则会先关闭当前的音轨,并打开stream指向的音轨,然后返回打开音轨函数的返回值
switch (codecpar->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (stream != is->video_stream && is->video_stream >= 0)
stream_component_close(ffp, is->video_stream);
break;
case AVMEDIA_TYPE_AUDIO:
if (stream != is->audio_stream && is->audio_stream >= 0)
stream_component_close(ffp, is->audio_stream);
break;
case AVMEDIA_TYPE_SUBTITLE:
if (stream != is->subtitle_stream && is->subtitle_stream >= 0)
stream_component_close(ffp, is->subtitle_stream);
break;
default:
av_log(ffp, AV_LOG_ERROR, "select invalid stream %d of video type %d\n", stream, codecpar->codec_type);
return -1;
}
return stream_component_open(ffp, stream);
} else {
//如果没有选择,则会执行以下代码关闭该音轨,并返回0
switch (codecpar->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (stream == is->video_stream)
stream_component_close(ffp, is->video_stream);
break;
case AVMEDIA_TYPE_AUDIO:
if (stream == is->audio_stream)
stream_component_close(ffp, is->audio_stream);
break;
case AVMEDIA_TYPE_SUBTITLE:
if (stream == is->subtitle_stream)
stream_component_close(ffp, is->subtitle_stream);
break;
default:
av_log(ffp, AV_LOG_ERROR, "select invalid stream %d of audio type %d\n", stream, codecpar->codec_type);
return -1;
}
return 0;
}
}

Compiling

Hi friend, thank you for this, but i have a question : Do I need to recompile again with ./compile-ffmpeg.sh ? Or just ./compile-ijk.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.