在FFMPEG中播放多个在线视频

时间:2014-07-04 05:07:39

标签: android video ffmpeg video-streaming

我正在尝试制作一个使用FFMPEG播放在线视频流的Android Applicaion。我经历了海豚播放器源代码,在此帮助下我实现了在Android中播放udp流。现在我想在我的播放器中播放多个流。例如,我有一个列表活动,其中包含10个名称,并且通过单击每个名称,应播放相应的视频。我怎样才能在avformat_open_input中实现这一点。我对ffmpeg很新。请帮我解决这个问题。提前谢谢。

我的c代码如下:

static int decode_module_init(void *arg) 
{
    VideoState *is = (VideoState *)arg;
    AVFormatContext *pFormatCtx;

    int err;
    int ret = -1;

    int i;

    int video_index = -1;
    int audio_index = -1;


    is->videoStream=-1;
    is->audioStream=-1;

    char* Filename = "udp://.....";

    global_video_state = is;

    pFormatCtx = avformat_alloc_context();
    pFormatCtx->interrupt_callback.callback = decode_interrupt_cb;
    pFormatCtx->interrupt_callback.opaque = is;


    **err = avformat_open_input(&pFormatCtx, Filename , NULL, NULL);**

    if (err < 0) {
        __android_log_print(ANDROID_LOG_INFO, "message", "File open failed");
        ret = -1;
        goto decode_module_init_fail;

    }

    __android_log_print(ANDROID_LOG_INFO, "message", "File open successful");
}

0 个答案:

没有答案