Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6718087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:55:42+00:00 2026-05-26T08:55:42+00:00

I´m trying to make a library for iPhone, so I´m trying to init the

  • 0

I´m trying to make a library for iPhone, so I´m trying to init the camera just with a call.
The problem comes when I call “self” in this declaration:

"[captureOutput setSampleBufferDelegate:self queue:queue];"

because the compiler says:” self was not declared in this scope”, what Do I need to do to set the same class as a “AVCaptureVideoDataOutputSampleBufferDelegate”?. At least point me in the right direction :P.

Thank you !!!

here is the complete function:

bool VideoCamera_Init(){


    //Init Capute from the camera and show the camera


    /*We setup the input*/
    AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput 
                                          deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] 
                                          error:nil];
    /*We setupt the output*/
    AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init];
    /*While a frame is processes in -captureOutput:didOutputSampleBuffer:fromConnection: delegate methods no other frames are added in the queue.
     If you don't want this behaviour set the property to NO */
    captureOutput.alwaysDiscardsLateVideoFrames = YES; 
    /*We specify a minimum duration for each frame (play with this settings to avoid having too many frames waiting
     in the queue because it can cause memory issues). It is similar to the inverse of the maximum framerate.
     In this example we set a min frame duration of 1/10 seconds so a maximum framerate of 10fps. We say that
     we are not able to process more than 10 frames per second.*/
    captureOutput.minFrameDuration = CMTimeMake(1, 20);

    /*We create a serial queue to handle the processing of our frames*/
    dispatch_queue_t queue;
    queue = dispatch_queue_create("cameraQueue", NULL);
    variableconnombrealeatorio= [[VideoCameraThread alloc] init];
    [captureOutput setSampleBufferDelegate:self queue:queue];


    dispatch_release(queue);
    // Set the video output to store frame in BGRA (It is supposed to be faster)
    NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey; 
    NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA]; 
    NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key]; 
    [captureOutput setVideoSettings:videoSettings]; 
    /*And we create a capture session*/
    AVCaptureSession * captureSession = [[AVCaptureSession alloc] init];
    captureSession.sessionPreset= AVCaptureSessionPresetMedium;
    /*We add input and output*/
    [captureSession addInput:captureInput];
    [captureSession addOutput:captureOutput];
    /*We start the capture*/
    [captureSession startRunning];


    return TRUE;
}

I also did the next class, but the buffer is empty:

“

#import “VideoCameraThread.h”

CMSampleBufferRef bufferCamara;

@implementation VideoCameraThread

  • (void)captureOutput:(AVCaptureOutput *)captureOutput
    didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
    fromConnection:(AVCaptureConnection *)connection
    {
    bufferCamera=sampleBuffer;

    }
    “

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:55:43+00:00Added an answer on May 26, 2026 at 8:55 am

    You are writing a C function, which has no concept of Objective C classes, objects or the self identifier. You will need to modify your function to take a parameter to accept the sampleBufferDelegate that you want to use:

    bool VideoCamera_Init(id<AVCaptureAudioDataOutputSampleBufferDelegate> sampleBufferDelegate) {
        ...
        [captureOutput setSampleBufferDelegate:sampleBufferDelegate queue:queue];
        ...
    }
    

    Or you could write your library with an Objective C object-oriented interface rather than a C-style interface.

    You also have problems with memory management in this function. For instance, you are allocating an AVCaptureSession and assigning it to a local variable. After this function returns you will have no way of retrieving that AVCaptureSession so that you can release it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a python binding for the this library: http://code.google.com/p/hosterslib/ . I'm
I am trying to make use of a C library in an iPhone project.
Trying to make a web service call to an HTTPS endpoint in my Silverlight
trying to make a page which will recursively call a function until a limit
I just started programming in Xcode and I'm trying to write an iphone application.
I am trying to make an iPhone-app that does the Monte Carlo simulation on
I am trying to make the installation of boost library a little bit slower,
I'm trying to make the BASS 2.4.4 library for my Linux Ubuntu Hardy Heron,
I've been trying to make some applications which all rely on the same library,
I have an abstract class in a library. I'm trying to make it as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.