Via opencore decoding H.264 es stream (RTP) from net

Source: Internet
Author: User

Done.

/*********************************** <Br /> * a FIFO queue for encoded data <br/> * and RTP sender. <br/> * encoder write, RTP sender read. <br/> * Author: norz. <br/> * Date: 2011.02.21 <br/> * version: 1.01 <br/> *********************************** **/<br/> # ifndef _ rtp_1_o_h _ <br/> # DEFINE _ rtp_1_o_h _ <br/> # include <stdio. h> <br/> # include <stdlib. h> <br/> # include <stdint. h> <br/> # include <string. H> <br/> # include "rtperrorinfo. H "<br/> const int readsize = 1360; // each RTP packet own 1360 bytes payload <br/> const int max_data_size = 20*1024; <br/> class rtpfifo; <br/>/******************************** <br /> * the node class for the FIFO <br/> *************************** * ***/<br/> class rtpfifonode <br/> {<br/> public: <br/> uint8_t * data; // a buffer for encoded data <br/> size_t size ;// Available size of the buffer <br/> unsigned int offset; // offset of this node, probale read once cannot read out this buffer <br/> void * next; // a pointer point to next position, void type is smaller-_-| <br/> rtpfifonode (); <br/> rtpfifonode (uint8_t * D, size_t Len ); <br/> ~ Rtpfifonode (); <br/> size_t getremainingsize (); // return remaining buffer size (size-offset) <br/> void setoffset (int ofs ); // set Offset equal to offset + OFS <br/> }; <br/>/************************ <br/> * The FIFO control class <br/> ************************/<br/> class rtpfifo <br/> {< br/> public: <br/> rtpfifo (); <br/> ~ Rtpfifo (); <br/> rtpfifostatus write (uint8_t * item, size_t size); // public method for enqueue <br/> rtpfifostatus read (uint8_t * pbuf, size_t size ); // public method for dequeue, deal some conditions <br/> uint8_t * getfrontdata (); // get front node's buffer <br/> size_t getfrontsize (); // get front node's size <br/> size_t getfrontremainingsize (); // get front remaing size <br/> rtpfifostatus isempty (); // Return Current FIFO status <br/> PRIVATE: <br/> rtpfifostatus enqueue (uint8_t * item, size_t size); <br/> void dequeue (); <br/> rtpfifonode * front; // front node always point to the head <br/> rtpfifonode * rear; // rear node always point to the tail <br/> }; <br/> # endif // _ rtp_1_o_h _ <br/> 

 


 

To do list:

1. Interaction with the upper layer, including obtaining the surface and signaling negotiation results

2. Time Synchronization or cache mechanism

 

At present, time synchronization is not considered... but why can't we draw images from surface, surfacecontrol, and isurface on the Java layer...

Is it a dynamic library problem? Okay... it turned out to be a Java-layer student who didn't set the surface type when processing surfaceholder... the problem of surface was solved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.