Lines Matching defs:opd
130 static uint16_t adjust_u16(uint16_t val, PTPObjectPropDesc *opd);
131 static uint32_t adjust_u32(uint32_t val, PTPObjectPropDesc *opd);
774 static uint16_t adjust_u16(uint16_t val, PTPObjectPropDesc *opd)
776 switch (opd->FormFlag) {
778 if (val < opd->FORM.Range.MinimumValue.u16) {
779 return opd->FORM.Range.MinimumValue.u16;
781 if (val > opd->FORM.Range.MaximumValue.u16) {
782 return opd->FORM.Range.MaximumValue.u16;
785 if (val % opd->FORM.Range.StepSize.u16 != 0) {
786 return val - (val % opd->FORM.Range.StepSize.u16);
793 uint16_t bestfit = opd->FORM.Enum.SupportedValue[0].u16;
795 for (i=0; i<opd->FORM.Enum.NumberOfValues; i++) {
796 if (val == opd->FORM.Enum.SupportedValue[i].u16) {
800 if (opd->FORM.Enum.SupportedValue[i].u16 < val) {
801 bestfit = opd->FORM.Enum.SupportedValue[i].u16;
819 static uint32_t adjust_u32(uint32_t val, PTPObjectPropDesc *opd)
821 switch (opd->FormFlag) {
823 if (val < opd->FORM.Range.MinimumValue.u32) {
824 return opd->FORM.Range.MinimumValue.u32;
826 if (val > opd->FORM.Range.MaximumValue.u32) {
827 return opd->FORM.Range.MaximumValue.u32;
830 if (val % opd->FORM.Range.StepSize.u32 != 0) {
831 return val - (val % opd->FORM.Range.StepSize.u32);
838 uint32_t bestfit = opd->FORM.Enum.SupportedValue[0].u32;
840 for (i=0; i<opd->FORM.Enum.NumberOfValues; i++) {
841 if (val == opd->FORM.Enum.SupportedValue[i].u32) {
845 if (opd->FORM.Enum.SupportedValue[i].u32 < val) {
846 bestfit = opd->FORM.Enum.SupportedValue[i].u32;
889 PTPObjectPropDesc opd;
892 ret = ptp_mtp_getobjectpropdesc(device->params, map_libmtp_property_to_ptp_property(property), map_libmtp_type_to_ptp_type(filetype), &opd);
898 if (opd.FormFlag == PTP_OPFF_Enumeration) {
902 allowed_vals->num_entries = opd.FORM.Enum.NumberOfValues;
904 switch (opd.DataType)
907 allowed_vals->i8vals = malloc(sizeof(int8_t) * opd.FORM.Enum.NumberOfValues);
911 allowed_vals->u8vals = malloc(sizeof(uint8_t) * opd.FORM.Enum.NumberOfValues);
915 allowed_vals->i16vals = malloc(sizeof(int16_t) * opd.FORM.Enum.NumberOfValues);
919 allowed_vals->u16vals = malloc(sizeof(uint16_t) * opd.FORM.Enum.NumberOfValues);
923 allowed_vals->i32vals = malloc(sizeof(int32_t) * opd.FORM.Enum.NumberOfValues);
927 allowed_vals->u32vals = malloc(sizeof(uint32_t) * opd.FORM.Enum.NumberOfValues);
931 allowed_vals->i64vals = malloc(sizeof(int64_t) * opd.FORM.Enum.NumberOfValues);
935 allowed_vals->u64vals = malloc(sizeof(uint64_t) * opd.FORM.Enum.NumberOfValues);
940 for (i = 0; i < opd.FORM.Enum.NumberOfValues; i++) {
941 switch (opd.DataType)
944 allowed_vals->i8vals[i] = opd.FORM.Enum.SupportedValue[i].i8;
947 allowed_vals->u8vals[i] = opd.FORM.Enum.SupportedValue[i].u8;
950 allowed_vals->i16vals[i] = opd.FORM.Enum.SupportedValue[i].i16;
953 allowed_vals->u16vals[i] = opd.FORM.Enum.SupportedValue[i].u16;
956 allowed_vals->i32vals[i] = opd.FORM.Enum.SupportedValue[i].i32;
959 allowed_vals->u32vals[i] = opd.FORM.Enum.SupportedValue[i].u32;
962 allowed_vals->i64vals[i] = opd.FORM.Enum.SupportedValue[i].i64;
965 allowed_vals->u64vals[i] = opd.FORM.Enum.SupportedValue[i].u64;
969 ptp_free_objectpropdesc(&opd);
971 } else if (opd.FormFlag == PTP_OPFF_Range) {
974 switch (opd.DataType)
977 allowed_vals->i8min = opd.FORM.Range.MinimumValue.i8;
978 allowed_vals->i8max = opd.FORM.Range.MaximumValue.i8;
979 allowed_vals->i8step = opd.FORM.Range.StepSize.i8;
983 allowed_vals->u8min = opd.FORM.Range.MinimumValue.u8;
984 allowed_vals->u8max = opd.FORM.Range.MaximumValue.u8;
985 allowed_vals->u8step = opd.FORM.Range.StepSize.u8;
989 allowed_vals->i16min = opd.FORM.Range.MinimumValue.i16;
990 allowed_vals->i16max = opd.FORM.Range.MaximumValue.i16;
991 allowed_vals->i16step = opd.FORM.Range.StepSize.i16;
995 allowed_vals->u16min = opd.FORM.Range.MinimumValue.u16;
996 allowed_vals->u16max = opd.FORM.Range.MaximumValue.u16;
997 allowed_vals->u16step = opd.FORM.Range.StepSize.u16;
1001 allowed_vals->i32min = opd.FORM.Range.MinimumValue.i32;
1002 allowed_vals->i32max = opd.FORM.Range.MaximumValue.i32;
1003 allowed_vals->i32step = opd.FORM.Range.StepSize.i32;
1007 allowed_vals->u32min = opd.FORM.Range.MinimumValue.u32;
1008 allowed_vals->u32max = opd.FORM.Range.MaximumValue.u32;
1009 allowed_vals->u32step = opd.FORM.Range.StepSize.u32;
1013 allowed_vals->i64min = opd.FORM.Range.MinimumValue.i64;
1014 allowed_vals->i64max = opd.FORM.Range.MaximumValue.i64;
1015 allowed_vals->i64step = opd.FORM.Range.StepSize.i64;
1019 allowed_vals->u64min = opd.FORM.Range.MinimumValue.u64;
1020 allowed_vals->u64max = opd.FORM.Range.MaximumValue.u64;
1021 allowed_vals->u64step = opd.FORM.Range.StepSize.u64;
1760 PTPObjectPropDesc opd;
1765 &opd) != PTP_RC_OK) {
1769 if (opd.DataType == PTP_DTC_UINT32) {
1778 } else if (opd.DataType == PTP_DTC_UINT64) {
1790 "awkward object size data type: %04x\n", opd.DataType);
2919 PTPObjectPropDesc opd;
2924 ret = ptp_mtp_getobjectpropdesc(params, props[j], params->deviceinfo.ImageFormats[i], &opd);
2931 if (opd.DataType == PTP_DTC_STR) {
2933 switch (opd.FormFlag) {
2947 if (opd.DataType & PTP_DTC_ARRAY_MASK) {
2951 switch (opd.DataType & (~PTP_DTC_ARRAY_MASK)) {
2959 switch (opd.FormFlag) {
2962 opd.FORM.Range.MinimumValue.i8,
2963 opd.FORM.Range.MaximumValue.i8,
2964 opd.FORM.Range.StepSize.i8);
2968 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
2969 printf("%d, ", opd.FORM.Enum.SupportedValue[k].i8);
2983 switch (opd.FormFlag) {
2986 opd.FORM.Range.MinimumValue.u8,
2987 opd.FORM.Range.MaximumValue.u8,
2988 opd.FORM.Range.StepSize.u8);
2992 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
2993 printf("%d, ", opd.FORM.Enum.SupportedValue[k].u8);
3007 switch (opd.FormFlag) {
3010 opd.FORM.Range.MinimumValue.i16,
3011 opd.FORM.Range.MaximumValue.i16,
3012 opd.FORM.Range.StepSize.i16);
3016 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
3017 printf("%d, ", opd.FORM.Enum.SupportedValue[k].i16);
3028 switch (opd.FormFlag) {
3031 opd.FORM.Range.MinimumValue.u16,
3032 opd.FORM.Range.MaximumValue.u16,
3033 opd.FORM.Range.StepSize.u16);
3037 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
3038 printf("%d, ", opd.FORM.Enum.SupportedValue[k].u16);
3049 switch (opd.FormFlag) {
3052 opd.FORM.Range.MinimumValue.i32,
3053 opd.FORM.Range.MaximumValue.i32,
3054 opd.FORM.Range.StepSize.i32);
3058 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
3059 printf("%d, ", opd.FORM.Enum.SupportedValue[k].i32);
3070 switch (opd.FormFlag) {
3073 opd.FORM.Range.MinimumValue.u32,
3074 opd.FORM.Range.MaximumValue.u32,
3075 opd.FORM.Range.StepSize.u32);
3081 for (k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
3082 if (opd.FORM.Enum.SupportedValue[k].u32 == 0) {
3086 fourcc[0] = (opd.FORM.Enum.SupportedValue[k].u32 >> 24) & 0xFFU;
3087 fourcc[1] = (opd.FORM.Enum.SupportedValue[k].u32 >> 16) & 0xFFU;
3088 fourcc[2] = (opd.FORM.Enum.SupportedValue[k].u32 >> 8) & 0xFFU;
3089 fourcc[3] = opd.FORM.Enum.SupportedValue[k].u32 & 0xFFU;
3097 for(k=0;k<opd.FORM.Enum.NumberOfValues;k++) {
3098 printf("%d, ", opd.FORM.Enum.SupportedValue[k].u32);
3129 if (opd.GetSet) {
3135 ptp_free_objectpropdesc(&opd);
5695 PTPObjectPropDesc opd;
5697 ret = ptp_mtp_getobjectpropdesc(params, properties[i], of, &opd);
5701 } else if (opd.GetSet) {
5750 ptp_free_objectpropdesc(&opd);
5848 PTPObjectPropDesc opd;
5850 ret = ptp_mtp_getobjectpropdesc(params, properties[i], map_libmtp_type_to_ptp_type(metadata->filetype), &opd);
5854 } else if (opd.GetSet) {
5906 prop->propval.u32 = adjust_u32(metadata->duration, &opd);
5913 prop->propval.u16 = adjust_u16(metadata->tracknumber, &opd);
5929 prop->propval.u32 = adjust_u32(metadata->samplerate, &opd);
5936 prop->propval.u16 = adjust_u16(metadata->nochannels, &opd);
5943 prop->propval.u32 = adjust_u32(metadata->wavecodec, &opd);
5950 prop->propval.u32 = adjust_u32(metadata->bitrate, &opd);
5957 prop->propval.u16 = adjust_u16(metadata->bitratetype, &opd);
5967 prop->propval.u16 = adjust_u16(metadata->rating, &opd);
5974 prop->propval.u32 = adjust_u32(metadata->usecount, &opd);
5990 ptp_free_objectpropdesc(&opd);
6010 PTPObjectPropDesc opd;
6012 ret = ptp_mtp_getobjectpropdesc(params, properties[i], map_libmtp_type_to_ptp_type(metadata->filetype), &opd);
6016 } else if (opd.GetSet) {
6061 ret = set_object_u32(device, metadata->item_id, PTP_OPC_Duration, adjust_u32(metadata->duration, &opd));
6071 ret = set_object_u16(device, metadata->item_id, PTP_OPC_Track, adjust_u16(metadata->tracknumber, &opd));
6090 ret = set_object_u32(device, metadata->item_id, PTP_OPC_SampleRate, adjust_u32(metadata->samplerate, &opd));
6100 ret = set_object_u16(device, metadata->item_id, PTP_OPC_NumberOfChannels, adjust_u16(metadata->nochannels, &opd));
6110 ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioWAVECodec, adjust_u32(metadata->wavecodec, &opd));
6120 ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioBitRate, adjust_u32(metadata->bitrate, &opd));
6130 ret = set_object_u16(device, metadata->item_id, PTP_OPC_BitRateType, adjust_u16(metadata->bitratetype, &opd));
6141 ret = set_object_u16(device, metadata->item_id, PTP_OPC_Rating, adjust_u16(metadata->rating, &opd));
6150 ret = set_object_u32(device, metadata->item_id, PTP_OPC_UseCount, adjust_u32(metadata->usecount, &opd));
6175 ptp_free_objectpropdesc(&opd);
6231 PTPObjectPropDesc opd;
6236 ret = ptp_mtp_getobjectpropdesc(params, PTP_OPC_ObjectFileName, ptp_type, &opd);
6243 if (!opd.GetSet) {
6244 ptp_free_objectpropdesc(&opd);
6277 ptp_free_objectpropdesc(&opd);
6285 ptp_free_objectpropdesc(&opd);
6292 ptp_free_objectpropdesc(&opd);
6296 ptp_free_objectpropdesc(&opd);
7096 PTPObjectPropDesc opd;
7098 ret = ptp_mtp_getobjectpropdesc(params, properties[i], objectformat, &opd);
7102 } else if (opd.GetSet) {
7185 ptp_free_objectpropdesc(&opd);
7247 PTPObjectPropDesc opd;
7249 ret = ptp_mtp_getobjectpropdesc(params, properties[i], objectformat, &opd);
7253 } else if (opd.GetSet) {
7311 ptp_free_objectpropdesc(&opd);
7377 PTPObjectPropDesc opd;
7379 ret = ptp_mtp_getobjectpropdesc(params, properties[i], objectformat, &opd);
7383 } else if (opd.GetSet) {
7443 ptp_free_objectpropdesc(&opd);