[Interest] Is it possible to have video files bundled as an app resource and have them played by Qml?

Sean Harmer sh at theharmers.co.uk
Tue Nov 8 12:21:07 CET 2016



On 08/11/2016 11:11, Nuno Santos wrote:
> Sean,
>
> Thanks for your feedback.
>
> Where do I put that option? CONFIG?

I use a .pro snippet something like this:

RCC_BINARY_SOURCES += ../assets/opengl-assets.qrc
asset_builder.commands = $$[QT_HOST_BINS]/rcc -binary ${QMAKE_FILE_IN} 
-o ${QMAKE_FILE_OUT}
asset_builder.depend_command = $$[QT_HOST_BINS]/rcc -list 
$$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
asset_builder.input = RCC_BINARY_SOURCES
asset_builder.output = $$OUT_PWD/../assets/${QMAKE_FILE_IN_BASE}.qrb
asset_builder.CONFIG += no_link target_predeps
QMAKE_EXTRA_COMPILERS += asset_builder

Just add your qrc files to the RCC_BINARY_SOURCES variable. Then in your 
C++ application you can load the binary resource file with:

bool success = QResource::registerResource( assetPath );

 From then on, use it as normal.

Cheers,

Sean

>
> Thanks!
>
> Nuno Santos
> Founder / CEO / CTO
> www.imaginando.pt <http://www.imaginando.pt>
> +351 91 621 69 62
>
>> On 08 Nov 2016, at 11:01, Sean Harmer <sean.harmer at kdab.com
>> <mailto:sean.harmer at kdab.com>> wrote:
>>
>> Hi,
>>
>> On 07/11/2016 08:40, Alexandru Croitor wrote:
>>> Hi,
>>>
>>> from Qt 5.4.0 changes file:
>>>
>>> rcc now supports an optional, two-pass compilation that improves build
>>> times for large resource bundles. This feature can be enabled by adding
>>> "CONFIG += resources_big" to your .pro file. Note that this feature may
>>> interfere with builds that enable link-time code generation or other
>>> optimization techniques.
>>
>> Or you can use the -binary option of rcc to keep the resource file
>> separate from your application. Comes in handy if you need to ship
>> different resource sets for different configurations/customers/themes
>> etc. I use this a lot with HDR environment maps for e.g.
>>
>> Cheers,
>>
>> Sean
>>
>>>
>>>
>>>
>>>> On 06 Nov 2016, at 23:57, Nuno Santos <nunosantos at imaginando.pt
>>>> <mailto:nunosantos at imaginando.pt>
>>>> <mailto:nunosantos at imaginando.pt>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I was trying to make a Qt mobile app to reproduce a video but I
>>>> couldn’t add the video as a resource to be used by qml. The resource
>>>> compiler failed with an error related with file size and I wasn’t even
>>>> able to reproduce it.
>>>>
>>>> Is is possible to add big video files as a resource without being
>>>> processed by the resource compiler to be used by qml?
>>>>
>>>> Thanks,
>>>>
>>>> Regards,
>>>>
>>>> Nuno
>>>>
>>>> _______________________________________________
>>>> Interest mailing list
>>>> Interest at qt-project.org
>>>> <mailto:Interest at qt-project.org> <mailto:Interest at qt-project.org>
>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>>
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>
>> --
>> Dr Sean Harmer | sean.harmer at kdab.com <mailto:sean.harmer at kdab.com> |
>> Managing Director UK
>> KDAB (UK) Ltd, a KDAB Group company
>> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
>> Mobile: +44 (0)7545 140604
>> KDAB - Qt Experts
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list