AxisCommunications / acap3-examples

Example code for APIs and features in AXIS Camera Application Platform (ACAP) version 3
Apache License 2.0
55 stars 20 forks source link

set width and height for vdostream incorrectly #197

Closed vuhailongkl97 closed 1 year ago

vuhailongkl97 commented 1 year ago

Describe your changes

I use your example vdostream, I tried to change width and height for vdostream but it didn't work I found that your code made the setting incorrect order

Checklist before requesting a review

pataxis commented 1 year ago

Hi @vuhailongkl97 , thanks for your suggestion!

The suggestion is however not doing anything. The VdoMap object

VdoMap *settings = vdo_map_new();

can hold various fields where width and height are only two of them. See ACAP 3 API documentation for VDO.

If you follow function set_format you will see that it also sets settings object instance.

static gboolean
set_format(VdoMap *settings, gchar *format, GError **error)
{
    if (g_strcmp0(format, "h264") == 0) {
        vdo_map_set_uint32(settings, "format", VDO_FORMAT_H264);

In this example you can also read that there are only three options that can be set.

If you want to be able to set the width and height from command-line you need to add them as input options. See the file for how the other options are set.

vuhailongkl97 commented 1 year ago

@pataxis I know what the set_format doing, however when I tried to change width and height with other values the program didn't work as I expected ( it was still 640x360 as default configuration). I assume that maybe width and height should be set before other attributes in memory ( I don't have time to check how your parser APIs work )

pataxis commented 1 year ago

I guess you set the new height and width values in vdoencodeclient.c, rebuild and reinstall the example.

I gave it a quick run for an Q1615-MKIII that has 800x600 as one of the supported resolutions

  vdo_map_set_uint32(settings, "width",  800);
  vdo_map_set_uint32(settings, "height", 600);

and the fetching seems to work according to application log

[ INFO    ] vdoencodeclient[29222]: Starting stream: h264, 800x600, 30 fps
[ INFO    ] vdoencodeclient[29222]: frame =    0, type = I, size = 18506
[ INFO    ] vdoencodeclient[29222]: frame =    1, type = P, size = 27
[ INFO    ] vdoencodeclient[29222]: frame =    2, type = P, size = 25
vuhailongkl97 commented 1 year ago

@pataxis Thank you for your support. it seems like I set unsupported resolutions