Skip to content

sample code for using callbacks #1

@mohaps

Description

@mohaps

Awesome library! :) using it for a "toy" project to build my son a present for xmas.

I'm trying to use sinks=['callbacks'] in the constructor, but when I do camera.snap_picture() I get an error:

File "cam_capture.py", line 103, in capture_from_camera
    f = self.camera.snap_picture(blocking=blocking)
  File "/src/avf.pyx", line 244, in pyavfcam.AVFCam.snap_picture (src/avf.cpp:3125)
ValueError: image video sink not initialized

My camera class is constructed as

class Camera (pyavfcam.AVFCam): 
    def __init__(self, sinks = ['callback'], *args, **kwargs):
        pyavfcam.AVFCam.__init__(self, sinks, *args, **kwargs)
    def file_output_done(self, errorOccured):
        logging.info('file output done : %s' % errorOccured)
    def video_output(self, frame):
        logging.info('video output done : %s' % frame)
    def image_output(self, frame):
        logging.info('image output done : %s' % frame)

Would really appreciate a sample for using callbacks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions