使用GStreamer进行分段错误

时间:2014-06-12 11:28:15

标签: gstreamer mpeg

我使用gst_mpegts_section_get_pat来读取PAT表,但它会引发分段错误。我通过ts文件阅读。我使用了所有的逻辑和我能想到的一切,但我无法找到它。代码段如下。顺便说一下,我把大部分代码形式都放在了the code i have taken from

static void dump_pat (GstMpegTsSection * section)
{
 printf ("dumb_pet \n");
 int i, len;
 GPtrArray *pat;

         pat = gst_mpegts_section_get_pat (section);
         len = pat->len;
         g_printf (" %d program(s):\n", len);

         for (i = 0; i < len; i++) {
             GstMpegTsPatProgram *patp = g_ptr_array_index (pat, i);

             g_print
                 (" program_number:%6d (0x%04x), network_or_program_map_PID:0x%04x\n",
                  patp->program_number, patp->program_number,
                  patp->network_or_program_map_PID);
         }

         g_ptr_array_unref (pat);

}

1 个答案:

答案 0 :(得分:0)

您确定正确使用API​​吗? dump_pat期望将定义的结构作为参数,而不是TS文件,参见gst-libs/gst/mpegts/gstmpegtssection.h

typedef struct _GstMpegTsSection GstMpegTsSection;

查看Gstreamer的FAQDocumentation