chcat wrote:
>
> what is relation between the data written into "buffer" and AVPacket data
> type?
>
buffer contains raw data (bytestream), which are suitable only for writing
to the storage.
AVPacket contains a valid frame (or one or several audio samples) plus some
information, which libav*
has retrieved from the input file, or guessed, or something like.
chcat wrote:
>
> To be more specific: can I get pts from that data , like
> (AVPacket*)buffer->pts , or
>
Generally, no.
However, your function has the opaque pointer, which can point to your
specific data, which your application can fill in any desired way. For
example this can be a pointer to the class instance.
chcat wrote:
>
> does the "buffer" correspond to AVPacket->data , buffer_size =
> AVpacket->size
>
Generally, no.
chcat wrote:
>
> and all other data is lost?
>
Something is stored in the libav* internals, but generally, there is no
public API to get or set these data.
chcat wrote:
>
> I have to re- mux data in "buffer" into different container format and
> wonder how to obtain pts value....
>
Probably, you're misunderstanding this function purpose. The ByteIOContext
functions are on the bottom layer, they are used in place of usual read() or
write(), which simply put data to disk.
If you want to remux your data, you should set up another AVFormatContext
for output, create the streams with av_new_stream() and use
av_interleaved_write_frame.
Your application skeleton should look like the following.
AVPacket pkt;
AVFormatContext *input;
AVFormatContext *output;
init_input();
init_output();
while(!exiting()){
av_read_frame(input, &pkt);
do_something_with_pkt_pts_and_dts(&pkt);
if(packet_to_be_written(&)){
reassign_pkt_stream_index(&pkt); //pkt.stream_index should be in [0 ..
nb_streams from your output -1 ]
av_interleaved_write_frame(output,&pkt);
}
av_free_packet(&pkt);
}
--
View this message in context:
http://n4.nabble.com/custom-IO-routine-and-pts-tp1461671p1470006.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user