Gst RTSP服务器编程

时间:2011-08-22 05:42:43

标签: rtsp gstreamer

我安装了gst-rtsp-server,我想尝试一个简单的代码。但是在编译时我遇到了以下错误:

In function `main':
test-launch01.c:(.text+0x64): undefined reference to `gst_rtsp_server_new'
test-launch01.c:(.text+0x74): undefined reference to `gst_rtsp_server_get_media_mapping'
test-launch01.c:(.text+0x7d): undefined reference to `gst_rtsp_media_factory_new'
test-launch01.c:(.text+0x95): undefined reference to `gst_rtsp_media_factory_set_shared'
test-launch01.c:(.text+0xad): undefined reference to `gst_rtsp_media_factory_set_launch'
test-launch01.c:(.text+0xc9): undefined reference to `gst_rtsp_media_mapping_add_factory'
test-launch01.c:(.text+0xe9): undefined reference to `gst_rtsp_server_attach'
collect2: ld returned 1 exit status

我已经包含了两个标题。我错过了什么?

4 个答案:

答案 0 :(得分:2)

您似乎没有链接到lib。 “未定义的引用”通常意味着您已包含必要的头文件,但链接器尚未找到定义。

尝试添加:

`pkg-config gstreamer-rtsp-0.10 --libs` 

到您的链接器调用。

答案 1 :(得分:1)

将gstreamer-rtsp-server-1.0添加到pkg-config。

答案 2 :(得分:0)

运行后

$(document).ready(function() 
{
    var videoId;
    $(function() 
    {
        if($.cookie("title") != null && $.cookie("id") != null)
        {
            var data = '<div class="video"><iframe height="' + vidHeight + '" width="' + vidWidth + '" src=\"//www.youtube.com/embed/' + $.cookie("id") + '\"></iframe></div><div class="title">' + $.cookie("title") + '</div><div class="desc">' + $.cookie("desc") + '</div><div class="duration">Length: ' + $.cookie("dur") + '</div><div class="stats">View Count: ' + $.cookie("views") + '</div>';

            $("#video-display").html(data);
            $("#tab1").html($.cookie("desc"));

            videoId = $.cookie("id");
            //vidDuration = $.cookie("dur"); works but prints out the same value for each
            //viewCount = $.cookie("views"); works but prints out the same value for each
            debugger;
            relatedVids(videoId); // called here


            console.log("from single-vid.html globalPlaylistId: ", $.cookie("playlistId"));


            // remove cookies after transferring it to this page for display
            $.removeCookie("title");
            $.removeCookie("id");
            $.removeCookie("desc");
            $.removeCookie("views");
            $.removeCookie("dur");
            $.removeCookie("tags");
            $.removeCookie("playlistId");
        }
    });
});

命令

apt-get install libgstrtspserver-0.10-dev

返回

pkg-config --libs gstreamer-rtsp-0.10

但是

-pthread -lgstrtsp-0.10 -lgstreamer-0.10 -lgstsdp-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 

返回

ls /usr/lib/libgstrtsp*

所以,用 -lgstrtspserver-0.10 替换标志 -lgstrtsp-0.10 解决了这个问题。

答案 3 :(得分:0)

最初,当我也遇到类似的错误时,我使用下面的命令进行编译

    for each in teachers:
        if created and teachers.exists():
            StudentsEnrolledSubject.objects.update_or_create(
                    pk=each.id,
                    Students_Enrollment_Records=instance,
                    Subject_Section_Teacher=each,
                )

在阅读了上面的评论后,似乎没有链接到<?php // Save a new user password in DB $username = 'Max User'; $password = 'My_Secr3t_Pa5sw0rd'; $passwordHash = password_hash($password, PASSWORD_BCRYPT); $stmt = $mysqli->prepare("INSERT INTO `users` (`username`, `password`) VALUES(?, ?)"); $stmt->bind_param("ss", $username, $passwordHash); $stmt->execute(); // Check user password $stmt = $mysqli->prepare("SELECT `password` FROM `users` WHERE `username`=?"); $stmt->bind_param("s", $username); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); if (password_verify($password, $row['password']) { echo "Password correct"; } else { echo "Password incorrect!"; } ?> lib是问题所在,因此我如下更改了命令

gcc -Wall test-server.c -o test-server $(pkg-config --cflags --libs gstreamer-1.0)

注意:我的构建环境是Ubuntu 19.04