Debian Codegraph @

doc/spec/source/snippets/appnd_b.c

raw
1 /*############################################################################
2 # Copyright (C) 2020 Intel Corporation
3 #
4 # SPDX-License-Identifier: MIT
5 ############################################################################*/
6
7 #include "mfxdefs.h"
8 #include "mfxvideo.h"
9
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
13
14 /* These macro required for code compilation. */
15 #define sps_buffer NULL
16 #define sps_buffer_length 0
17 #define pps_buffer NULL
18 #define pps_buffer_length 0
19 mfxSession session;
20 /* end of internal stuff */
21
22 /*beg*/
23 mfxStatus init_encoder() {
24 mfxExtCodingOptionSPSPPS option, *option_array;
25
26 /* configure mfxExtCodingOptionSPSPPS */
27 memset(&option,0,sizeof(option));
28 option.Header.BufferId=MFX_EXTBUFF_CODING_OPTION_SPSPPS;
29 option.Header.BufferSz=sizeof(option);
30 option.SPSBuffer=sps_buffer;
31 option.SPSBufSize=sps_buffer_length;
32 option.PPSBuffer=pps_buffer;
33 option.PPSBufSize=pps_buffer_length;
34
35 /* configure mfxVideoParam */
36 mfxVideoParam param;
37 //...
38 param.NumExtParam=1;
39 option_array=&option;
40 param.ExtParam=(mfxExtBuffer**)&option_array;
41
42 /* encoder initialization */
43 mfxStatus status;
44 status=MFXVideoENCODE_Init(session, &param);
45 if (status==MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) {
46 printf("Initialization failed.\n");
47 } else {
48 printf("Initialized.\n");
49 }
50 return status;
51 }
52 /*end*/