mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
dvbsrc: rework set_pids()
- Reflow to avoid unneeded nesting - Free aux pids array earlier - Adjust debug output to deliver more meaningful information
This commit is contained in:
parent
13efbf35d9
commit
1824703c81
1 changed files with 32 additions and 31 deletions
|
@ -1096,45 +1096,46 @@ gst_dvbsrc_init (GstDvbSrc * object)
|
||||||
static void
|
static void
|
||||||
gst_dvbsrc_set_pids (GstDvbSrc * dvbsrc, const gchar * pid_string)
|
gst_dvbsrc_set_pids (GstDvbSrc * dvbsrc, const gchar * pid_string)
|
||||||
{
|
{
|
||||||
|
int pid = 0;
|
||||||
|
int pid_count;
|
||||||
|
gchar **pids;
|
||||||
|
char **tmp;
|
||||||
|
|
||||||
if (!strcmp (pid_string, "8192")) {
|
if (!strcmp (pid_string, "8192")) {
|
||||||
/* get the whole TS */
|
/* get the whole TS */
|
||||||
dvbsrc->pids[0] = 8192;
|
dvbsrc->pids[0] = 8192;
|
||||||
dvbsrc->pids[1] = G_MAXUINT16;
|
dvbsrc->pids[1] = G_MAXUINT16;
|
||||||
} else {
|
goto done;
|
||||||
int pid = 0;
|
|
||||||
int pid_count;
|
|
||||||
gchar **pids;
|
|
||||||
char **tmp;
|
|
||||||
|
|
||||||
tmp = pids = g_strsplit (pid_string, ":", MAX_FILTERS);
|
|
||||||
|
|
||||||
/* always add the PAT and CAT pids */
|
|
||||||
dvbsrc->pids[0] = 0;
|
|
||||||
dvbsrc->pids[1] = 1;
|
|
||||||
|
|
||||||
pid_count = 2;
|
|
||||||
while (*pids != NULL && pid_count < MAX_FILTERS) {
|
|
||||||
pid = strtol (*pids, NULL, 0);
|
|
||||||
if (pid > 1 && pid <= 8192) {
|
|
||||||
GST_INFO_OBJECT (dvbsrc, "Parsed PID: %d", pid);
|
|
||||||
dvbsrc->pids[pid_count] = pid;
|
|
||||||
pid_count++;
|
|
||||||
}
|
|
||||||
pids++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pid_count < MAX_FILTERS)
|
|
||||||
dvbsrc->pids[pid_count] = G_MAXUINT16;
|
|
||||||
|
|
||||||
g_strfreev (tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_INFO_OBJECT (dvbsrc, "checking if playing for setting PES filters");
|
/* always add the PAT and CAT pids */
|
||||||
if (GST_ELEMENT (dvbsrc)->current_state == GST_STATE_PLAYING ||
|
dvbsrc->pids[0] = 0;
|
||||||
GST_ELEMENT (dvbsrc)->current_state == GST_STATE_PAUSED) {
|
dvbsrc->pids[1] = 1;
|
||||||
|
pid_count = 2;
|
||||||
|
|
||||||
|
tmp = pids = g_strsplit (pid_string, ":", MAX_FILTERS);
|
||||||
|
|
||||||
|
while (*pids != NULL && pid_count < MAX_FILTERS) {
|
||||||
|
pid = strtol (*pids, NULL, 0);
|
||||||
|
if (pid > 1 && pid <= 8192) {
|
||||||
|
GST_INFO_OBJECT (dvbsrc, "Parsed PID: %d", pid);
|
||||||
|
dvbsrc->pids[pid_count] = pid;
|
||||||
|
pid_count++;
|
||||||
|
}
|
||||||
|
pids++;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (tmp);
|
||||||
|
|
||||||
|
if (pid_count < MAX_FILTERS)
|
||||||
|
dvbsrc->pids[pid_count] = G_MAXUINT16;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (GST_ELEMENT (dvbsrc)->current_state > GST_STATE_READY) {
|
||||||
GST_INFO_OBJECT (dvbsrc, "Setting PES filters now");
|
GST_INFO_OBJECT (dvbsrc, "Setting PES filters now");
|
||||||
gst_dvbsrc_set_pes_filters (dvbsrc);
|
gst_dvbsrc_set_pes_filters (dvbsrc);
|
||||||
}
|
} else
|
||||||
|
GST_INFO_OBJECT (dvbsrc, "Not setting PES filters because state < PAUSED");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue