Ticket #2170: toCheck.txt

File toCheck.txt, 887 bytes (added by trynitron, 4 years ago)

The way i'm doing the extradata add.

Line 
1//// Encoding part begin ////
2
3AVPacket pkt;
4av_init_packet(&pkt);
5pkt.data=nullptr;
6pkt.size=0;
7
8avcodec_encode_video2(c, &pkt, m_pictureYUV, &gotPacketPtr);
9
10uint8_t mydata[10];
11
12uint8_t * currentDataFrame=av_packet_new_side_data(&fm_pkt, AV_PKT_DATA_NEW_EXTRADATA, 10*sizeof(uint8_t));
13
14memcpy(currentDataFrame, mydata[10], 10*sizeof(uint8_t));
15
16av_packet_merge_side_data(&fm_pkt);
17
18av_interleaved_write_frame(m_avFormatContext, &fm_pkt);
19
20//// Encoding part end ////
21
22//// Decoding part begin ////
23
24AVPacket pkt;
25av_init_packet(&pkt);
26
27av_packet_split_side_data(&fm_pkt)
28
29uint8_t *currentDataFrame=av_packet_get_side_data(&fm_pkt, AV_PKT_DATA_NEW_EXTRADATA, &size);
30
31uint8_t mydata=new uint8_t[size*sizeof(uint8_t);
32
33memcpy(mydata, currentDataFrame, size*sizeof(uint8_t));
34
35avcodec_decode_video2(m_videoCodecContext, m_currentFrame, &gotPacketPtr, &pkt);
36
37//// Decoding part end ////