summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2021-02-14 15:29:30 +0100
committerMarcus Meissner <marcus@jet.franken.de>2021-02-14 15:29:30 +0100
commitcb15cce1a1588ca99ba78ee740cacff2cfb5a9c0 (patch)
tree99fe3bd33d929674ecde324676c9d11895e28e45
parent65b090e7d4e95a7ee21426aaa10d7bf57e38abc2 (diff)
downloadlibgphoto2-cb15cce1a1588ca99ba78ee740cacff2cfb5a9c0.tar.gz
added movie recording for panasonic lumix
fixes https://github.com/gphoto/libgphoto2/issues/429
-rw-r--r--camlibs/ptp2/config.c30
-rw-r--r--camlibs/ptp2/library.c7
-rw-r--r--camlibs/ptp2/ptp.h43
3 files changed, 66 insertions, 14 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 23aa88b6d..c5d4fc61d 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -8127,7 +8127,6 @@ _put_Nikon_Bulb(CONFIG_PUT_ARGS)
}
}
-
static int
_get_OpenCapture(CONFIG_GET_ARGS) {
int val;
@@ -8294,6 +8293,34 @@ _put_Sony_Bulb(CONFIG_PUT_ARGS)
}
static int
+_get_Panasonic_Movie(CONFIG_GET_ARGS) {
+ int val;
+
+ gp_widget_new (GP_WIDGET_TOGGLE, _(menu->label), widget);
+ gp_widget_set_name (*widget,menu->name);
+ val = 2; /* always changed */
+ gp_widget_set_value (*widget, &val);
+ return GP_OK;
+}
+
+static int
+_put_Panasonic_Movie(CONFIG_PUT_ARGS)
+{
+ PTPParams *params = &(camera->pl->params);
+ int val;
+
+ CR (gp_widget_get_value(widget, &val));
+ if (val) {
+ C_PTP_MSG (ptp_panasonic_movierec (params, 1), "failed to start movie capture");
+ return GP_OK;
+ } else {
+ C_PTP_MSG (ptp_panasonic_movierec (params, 0), "failed to stop movie capture");
+ return GP_OK;
+ }
+}
+
+
+static int
_put_Panasonic_Shutter(CONFIG_PUT_ARGS)
{
PTPParams *params = &(camera->pl->params);
@@ -9622,6 +9649,7 @@ static struct submenu camera_actions_menu[] = {
{ N_("Movie Capture"), "movie", 0, PTP_VENDOR_NIKON, PTP_OC_NIKON_StartMovieRecInCard, _get_Nikon_Movie, _put_Nikon_Movie },
{ N_("Movie Capture"), "movie", 0, PTP_VENDOR_SONY, PTP_OC_SONY_SDIOConnect, _get_Sony_Movie, _put_Sony_Movie },
{ N_("Movie Capture"), "movie", 0, PTP_VENDOR_SONY, PTP_OC_SONY_QX_Connect, _get_Sony_QX_Movie, _put_Sony_QX_Movie },
+ { N_("Movie Capture"), "movie", 0, PTP_VENDOR_PANASONIC,PTP_OC_PANASONIC_MovieRecControl, _get_Panasonic_Movie, _put_Panasonic_Movie },
{ N_("Movie Mode"), "eosmoviemode", 0, PTP_VENDOR_CANON, 0, _get_Canon_EOS_MovieModeSw, _put_Canon_EOS_MovieModeSw },
{ N_("PTP Opcode"), "opcode", 0, 0, PTP_OC_GetDeviceInfo, _get_Generic_OPCode, _put_Generic_OPCode },
{ 0,0,0,0,0,0,0 },
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index d3d8bc7f7..3311ecf90 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -250,14 +250,17 @@ fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
(camera->port->type == GP_PORT_USB) &&
(a.usb_product == 0x2382)
) {
- C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 6)));
+ C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 9)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_PANASONIC_GetProperty;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_PANASONIC_SetProperty;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_PANASONIC_ListProperty;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_PANASONIC_InitiateCapture;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_PANASONIC_Liveview;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_PANASONIC_LiveviewImage;
- di->OperationsSupported_len += 6;
+ di->OperationsSupported[di->OperationsSupported_len+6] = PTP_OC_PANASONIC_MovieRecControl;
+ di->OperationsSupported[di->OperationsSupported_len+7] = PTP_OC_PANASONIC_GetLiveViewParameters;
+ di->OperationsSupported[di->OperationsSupported_len+8] = PTP_OC_PANASONIC_SetLiveViewParameters;
+ di->OperationsSupported_len += 9;
}
/* Panasonic hack */
diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h
index 07abb2c5f..89a5eff01 100644
--- a/camlibs/ptp2/ptp.h
+++ b/camlibs/ptp2/ptp.h
@@ -929,7 +929,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_PANASONIC_9409 0x9409 /* 1 arg */
#define PTP_OC_PANASONIC_GetCaptureTarget 0x940A /* 1 arg, e.g. 0x08000010 */
#define PTP_OC_PANASONIC_SetCaptureTarget 0x940B /* 1 arg, e.g. 0x08000010 */
-#define PTP_OC_PANASONIC_MoveRecControl 0x940C /* 07000011 start, 07000012 stop, 0700013 still capture */
+#define PTP_OC_PANASONIC_MovieRecControl 0x940C /* 07000011 start, 07000012 stop, 0700013 still capture */
#define PTP_OC_PANASONIC_PowerControl 0x940D /* 1 arg: 0x0A000011 power off, 0x0a00012 device reset, 0x0a00013 device restart */
#define PTP_OC_PANASONIC_PlayControl 0x940E /* 2 arg? 0x05000011 current=0, next=1, prev=0xffffffff */
#define PTP_OC_PANASONIC_PlayControlPlay 0x940F /* 0x05000020 */
@@ -3327,16 +3327,36 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_PANASONIC_GetFreeSpaceInImages 0x12000010
/*
-0000 98 00 00 00 02 00 14 94-04 00 00 00 11 00 00 12 ................
-0010 04 00 00 00 4e 00 00 00-12 00 00 12 04 00 00 00 ....N...........
-0020 00 00 00 00 13 00 00 12-02 00 00 00 00 00 14 00 ................
-0030 00 12 04 00 00 00 00 00-00 00 15 00 00 12 06 00 ................
-0040 00 00 02 00 01 00 00 00-16 00 00 12 3a 00 00 00 ............:...
-0050 02 00 4e 00 00 00 00 00-00 00 4e 00 00 00 ff ff ..N.......N.....
-0060 ff ff 00 00 00 00 ff ff-ff ff 00 00 00 00 00 00 ................
-0070 00 00 00 00 00 00 ff ff-ff ff 00 00 00 00 ff ff ................
-0080 ff ff 00 00 00 00 00 00-00 00 17 00 00 12 06 00 ................
-0090 00 00 00 00 00 00 00 00- ........
+11 00 00 12
+04 00 00 00
+4e 00 00 00
+
+12 00 00 12
+04 00 00 00
+00 00 00 00
+
+13 00 00 12
+02 00 00 00
+00 00
+
+14 00 00 12
+04 00 00 00
+00 00 00 00
+
+15 00 00 12
+06 00 00 00
+02 00 01 00 00 00
+
+16 00 00 12
+3a 00 00 00
+02 00 4e 00 00 00 00 00 00 00 4e 00 00 00 ff ff
+ff ff 00 00 00 00 ff ff ff ff 00 00 00 00 00 00
+00 00 00 00 00 00 ff ff ff ff 00 00 00 00 ff ff
+ff ff 00 00 00 00 00 00 00 00
+
+17 00 00 12
+06 00 00 00
+00 00 00 00 00 00
*/
#define PTP_DPC_PANASONIC_GetBatteryInfo 0x16000010
/*
@@ -4718,6 +4738,7 @@ uint16_t ptp_fuji_getdeviceinfo (PTPParams* params, uint16_t **props, unsigned i
#define ptp_panasonic_liveview(params,enable) ptp_generic_no_data(params,PTP_OC_PANASONIC_Liveview,1,enable?0xD000010:0xD000011)
uint16_t ptp_panasonic_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size);
+#define ptp_panasonic_movierec(params,enable) ptp_generic_no_data(params,PTP_OC_PANASONIC_MovieRecControl,1,enable?0x07000011:0x07000012)
uint16_t ptp_panasonic_setdeviceproperty (PTPParams* params, uint32_t propcode, unsigned char *value, uint16_t valuesize);
uint16_t ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue);