@@ -982,6 +982,9 @@ static PyObject* topy(
982
982
PyObject * subtitles = NULL ;
983
983
PyObject * closed_captions = NULL ;
984
984
PyObject * size = NULL ;
985
+ PyObject * version = NULL ;
986
+ PyObject * value = NULL ;
987
+ PyObject * data_id = NULL ;
985
988
986
989
PyObject * result = NULL ;
987
990
@@ -996,6 +999,128 @@ static PyObject* topy(
996
999
}
997
1000
998
1001
switch (item -> type ) {
1002
+ case M3U8_STREAM_SESSION_DATA : {
1003
+ const struct M3U8SessionData * const session_data = item -> item ;
1004
+
1005
+ /* Data ID */
1006
+ Py_XDECREF (data_id );
1007
+
1008
+ data_id = get_string (session_data -> data_id );
1009
+
1010
+ if (data_id == NULL ) {
1011
+ return NULL ;
1012
+ }
1013
+
1014
+ /* Value */
1015
+ Py_XDECREF (value );
1016
+
1017
+ value = get_string (session_data -> value );
1018
+
1019
+ if (value == NULL ) {
1020
+ return NULL ;
1021
+ }
1022
+
1023
+ /* URI */
1024
+ Py_XDECREF (uri );
1025
+
1026
+ err = m3u8uri_resolve (base_uri , session_data -> uri , & resolved_uri );
1027
+
1028
+ uri = get_string ((err == M3U8ERR_SUCCESS ) ? resolved_uri : session_data -> uri );
1029
+
1030
+ if (uri == NULL ) {
1031
+ return NULL ;
1032
+ }
1033
+
1034
+ /* Language */
1035
+ Py_XDECREF (language );
1036
+
1037
+ language = get_string (session_data -> language );
1038
+
1039
+ if (language == NULL ) {
1040
+ return NULL ;
1041
+ }
1042
+
1043
+ /* Tag */
1044
+ Py_XDECREF (tag );
1045
+
1046
+ tag = PyLong_FromLongLong ((uintptr_t ) session_data -> tag );
1047
+
1048
+ if (tag == NULL ) {
1049
+ return NULL ;
1050
+ }
1051
+
1052
+ Py_XDECREF (args );
1053
+
1054
+ args = Py_BuildValue (
1055
+ "(OOOOO)" ,
1056
+ data_id ,
1057
+ value ,
1058
+ uri ,
1059
+ language ,
1060
+ tag
1061
+ );
1062
+
1063
+ if (args == NULL ) {
1064
+ return NULL ;
1065
+ }
1066
+
1067
+ Py_XDECREF (class );
1068
+
1069
+ class = PyObject_GetAttrString (module , "M3U8SessionData" );
1070
+
1071
+ if (class == NULL ) {
1072
+ return NULL ;
1073
+ }
1074
+
1075
+ result = PyObject_Call (class , args , NULL );
1076
+
1077
+ break ;
1078
+ }
1079
+ case M3U8_STREAM_VERSION : {
1080
+ const struct M3U8Version * const ver = item -> item ;
1081
+
1082
+ /* Version */
1083
+ Py_XDECREF (version );
1084
+
1085
+ version = PyLong_FromLongLong (ver -> version );
1086
+
1087
+ if (version == NULL ) {
1088
+ return NULL ;
1089
+ }
1090
+
1091
+ /* Tag */
1092
+ Py_XDECREF (tag );
1093
+
1094
+ tag = PyLong_FromLongLong ((uintptr_t ) ver -> tag );
1095
+
1096
+ if (tag == NULL ) {
1097
+ return NULL ;
1098
+ }
1099
+
1100
+ Py_XDECREF (args );
1101
+
1102
+ args = Py_BuildValue (
1103
+ "(OO)" ,
1104
+ version ,
1105
+ tag
1106
+ );
1107
+
1108
+ if (args == NULL ) {
1109
+ return NULL ;
1110
+ }
1111
+
1112
+ Py_XDECREF (class );
1113
+
1114
+ class = PyObject_GetAttrString (module , "M3U8Version" );
1115
+
1116
+ if (class == NULL ) {
1117
+ return NULL ;
1118
+ }
1119
+
1120
+ result = PyObject_Call (class , args , NULL );
1121
+
1122
+ break ;
1123
+ }
999
1124
case M3U8_STREAM_MEDIA : {
1000
1125
const struct M3U8Media * const media = item -> item ;
1001
1126
@@ -1479,11 +1604,9 @@ static PyObject* _m3u8stream_getstream(
1479
1604
const struct M3U8StreamItem * const item = & stream -> items [index ];
1480
1605
1481
1606
switch (item -> type ) {
1482
- case M3U8_STREAM_MEDIA : {
1483
- kitem = topy (stream , item );
1484
- PyList_Append (items , kitem );
1485
- break ;
1486
- }
1607
+ case M3U8_STREAM_SESSION_DATA :
1608
+ case M3U8_STREAM_MEDIA :
1609
+ case M3U8_STREAM_VERSION :
1487
1610
case M3U8_STREAM_VARIANT_STREAM : {
1488
1611
kitem = topy (stream , item );
1489
1612
PyList_Append (items , kitem );
0 commit comments