>> Hi,
>>
>> On Tue, Jun 28, 2011 at 4:06 AM, Luis Díaz Más <[email protected]> wrote:
>>> I have solved the problem related with the order of DATA packets. I
>>> forgot
>>> to stablish the pts values in the packets. Now I receive image frames
>>> and
>>> medatada in the way desired when I save the MPEG-2 TS in a video file.
>>> However when I send the streams over UDP, the reception doesn't work in
>>> my
>>> program using libav neither with ffplay application. But with VLC I can
>>> receive perfectly the video stream ... As I explained in the previous
>>> email, if I remove the data stream my application works perfectly.
>>>
>>> The code in the "receptor" app is very simple ...
>>>
>>> AVFormatContext * _ifc;
>>> // path = "udp://localhost?localport=1234";
>>> av_open_input_file(&_ifc, path, NULL, 0, NULL);
>>> av_find_stream_info(_ifc);  // The application is blocked here ...
>>>
>>> Is there any way to specify what kind of streams are going to be
>>> received
>>> in the "receptor" app to avoid to call av_find_stream_info ?
>>
>> Where is it hanging? You didn't set a remote port in UDP, so that may
>> be a problem i.e. it may not be receiving any data because it doesn't
>> know where to listen.
>>
>> Ronald
>>
>
> I don't think that's the problem. As I explained previously, if I remove
> the data stream, the my application works perfectly (it doesn't hang in
> the av_find_stream_info() function). I'm seeing the code of
> av_find_stream_info() in order to try to initialize the AVFormatContext
> structure on my own, knowing that I only am going to recieve a MPEG-2
> video stream and other data stream.
>
> Nonetheless, I'm interested in your suggestion. For establishing the
> remote port in UDP I have to use the function udp_set_remote_url ? I was
> seeing the ffmpeg and ffplay code, and none of them uses this function :S.
>
> If anyone has other suggestions I'd love to listem them ^^.
>
> Regards,
>
> Luis.
>
>

I finally have solved the problem and now I'm able to receive the video
and data streams separately :D.

I removed the av_find_stream_info call because of the app hanged itself at
this point. But the av_open_input_file call give you enough information
about the number of streams and their types. So, I only need to fill the
information retrieved by av_find_stream_info into the AVCodecContexts.
More specifically, for the video AVCodecContext I fill the next fields:

- pix_fmt
- width
- height
- bit_rate
- time-base

and then I find the codec, open it, and do other traditional AV things.

For the data AVCodecContext i do the next things:

- avcodec_get_context_default2(_dCC, CODEC_TYPE_DATA);
- Fill time_base of _dCC
- Fill codec_id of _dCC  (I think that's not necessary)

Finally with av_read_frame() I can receive packets from the two streams.
Checking the packet stream_index field you can differentiate between them.

Regards!

Luis.

_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to