RDK Documentation (Open Sourced RDK Components)
AampGstUtils.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2021 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file AampGstUtils.cpp
22  * @brief Impl for utility functions defined in AampGstUtils.h
23  */
24 
25 #include "AampGstUtils.h"
26 #include "priv_aamp.h" // Included for AAMPLOG
27 //TODO: Fix cyclic dependency btw GlobalConfig and AampLogManager
28 
29 /**
30  * @brief Parse format to generate GstCaps
31  */
33 {
34  GstCaps * caps = NULL;
35  switch (format)
36  {
37  case FORMAT_MPEGTS:
38  caps = gst_caps_new_simple ("video/mpegts",
39  "systemstream", G_TYPE_BOOLEAN, TRUE,
40  "packetsize", G_TYPE_INT, 188, NULL);
41  break;
42  case FORMAT_ISO_BMFF:
43  caps = gst_caps_new_simple("video/quicktime", NULL, NULL);
44  break;
46  caps = gst_caps_new_simple ("audio/mpeg",
47  "mpegversion", G_TYPE_INT, 2,
48  "stream-format", G_TYPE_STRING, "adts", NULL);
49  break;
51  caps = gst_caps_new_simple ("audio/x-ac3", NULL, NULL);
52  break;
53 
55  caps = gst_caps_new_simple ("audio/x-ac4", NULL, NULL);
56  break;
57 
59  caps = gst_caps_new_simple("application/ttml+xml", NULL, NULL);
60  break;
62  caps = gst_caps_new_simple("text/vtt", NULL, NULL);
63  break;
65  caps = gst_caps_new_simple("application/mp4", NULL, NULL);
66  break;
68  // Todo :: a) Test with all platforms if atmos works
69  // b) Test to see if x-eac3 config is enough for atmos stream.
70  // if x-eac3 is enough then both switch cases can be combined
71  caps = gst_caps_new_simple ("audio/x-eac3", NULL, NULL);
72  break;
74  caps = gst_caps_new_simple ("audio/x-eac3", NULL, NULL);
75  break;
77 #ifdef INTELCE
78  caps = gst_caps_new_simple ("video/x-h264",
79  "stream-format", G_TYPE_STRING, "avc",
80  "width", G_TYPE_INT, 1920,
81  "height", G_TYPE_INT, 1080,
82  NULL);
83 #elif (defined(RPI) || defined(__APPLE__) || defined(UBUNTU))
84  caps = gst_caps_new_simple ("video/x-h264",
85  "alignment", G_TYPE_STRING, "au",
86  "stream-format", G_TYPE_STRING, "avc",
87  NULL);
88 #elif (defined(REALTEKCE))
89  caps = gst_caps_new_simple ("video/x-h264", "enable-fastplayback", G_TYPE_STRING, "true", NULL);
90 #else
91  caps = gst_caps_new_simple ("video/x-h264", NULL, NULL);
92 #endif
93  break;
95 #if (defined(RPI) || defined(__APPLE__) || defined(UBUNTU))
96  caps = gst_caps_new_simple ("video/x-h265",
97  "alignment", G_TYPE_STRING, "au",
98  "stream-format", G_TYPE_STRING, "hev1",
99  NULL);
100 #elif (defined(REALTEKCE))
101  caps = gst_caps_new_simple ("video/x-h265", "enable-fastplayback", G_TYPE_STRING, "true", NULL);
102 #else
103  caps = gst_caps_new_simple ("video/x-h265", NULL, NULL);
104 #endif
105  break;
107  caps = gst_caps_new_simple ("video/mpeg",
108  "mpegversion", G_TYPE_INT, 2,
109  "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
110  break; //CID:81305 - Using break statement
111  case FORMAT_UNKNOWN:
112  AAMPLOG_WARN("Unknown format %d", format);
113  break;
114  case FORMAT_INVALID:
115  default:
116  AAMPLOG_WARN("Unsupported format %d", format);
117  break;
118  }
119  return caps;
120 }
121 
FORMAT_VIDEO_ES_HEVC
@ FORMAT_VIDEO_ES_HEVC
Definition: main_aamp.h:117
StreamOutputFormat
StreamOutputFormat
Media output format.
Definition: main_aamp.h:106
FORMAT_SUBTITLE_WEBVTT
@ FORMAT_SUBTITLE_WEBVTT
Definition: main_aamp.h:119
FORMAT_AUDIO_ES_AAC
@ FORMAT_AUDIO_ES_AAC
Definition: main_aamp.h:111
FORMAT_INVALID
@ FORMAT_INVALID
Definition: main_aamp.h:108
FORMAT_ISO_BMFF
@ FORMAT_ISO_BMFF
Definition: main_aamp.h:110
FORMAT_AUDIO_ES_AC3
@ FORMAT_AUDIO_ES_AC3
Definition: main_aamp.h:112
FORMAT_UNKNOWN
@ FORMAT_UNKNOWN
Definition: main_aamp.h:122
FORMAT_AUDIO_ES_AC4
@ FORMAT_AUDIO_ES_AC4
Definition: main_aamp.h:115
FORMAT_AUDIO_ES_EC3
@ FORMAT_AUDIO_ES_EC3
Definition: main_aamp.h:113
FORMAT_MPEGTS
@ FORMAT_MPEGTS
Definition: main_aamp.h:109
FORMAT_VIDEO_ES_H264
@ FORMAT_VIDEO_ES_H264
Definition: main_aamp.h:116
AampGstUtils.h
Header for utility functions for AAMP's GST impl.
FORMAT_SUBTITLE_TTML
@ FORMAT_SUBTITLE_TTML
Definition: main_aamp.h:120
priv_aamp.h
Private functions and types used internally by AAMP.
FORMAT_SUBTITLE_MP4
@ FORMAT_SUBTITLE_MP4
Definition: main_aamp.h:121
FORMAT_AUDIO_ES_ATMOS
@ FORMAT_AUDIO_ES_ATMOS
Definition: main_aamp.h:114
FORMAT_VIDEO_ES_MPEG2
@ FORMAT_VIDEO_ES_MPEG2
Definition: main_aamp.h:118
GetGstCaps
GstCaps * GetGstCaps(StreamOutputFormat format)
Parse format to generate GstCaps.
Definition: AampGstUtils.cpp:32
TRUE
#define TRUE
Defines for TRUE/FALSE/ENABLE flags.
Definition: wifi_common_hal.h:199