Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
201 views
in Technique[技术] by (71.8m points)

c - ffmpeg - missing avformat headers

I follow the steps here to compile FFmpeg. And there is no problem. Its working well. But i did not understand something. There are two folders under my home directory. --ffmpeg_sources --ffmpeg_build

insede of ffmpeg_sources/libavformat i have number of headers

aiff.h
apetag.h
argo_asf.h
asfcrypt.h
asf.h
ast.h
av1.h
avc.h
avformat.h
avi.h
avio.h
avio_internal.h
avlanguage.h
ogg.h
...

but ffmpeg_build/avformat has 3 header.

avformat.h
avio.h
version.h

btw this is my usr/include/x86_64-linux-gnu/libavformat

avformat.h
avio.h
version.h

Why aren't all headers in these other two files? For ex: i want to use "ogg_read_packet" but when i try to include <libavformat/oggdec.h> i get cannot open source file "libavformat/oggdec.h"C/C++(1696) error.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Building and using the library aren't the same things.

Have a look at libavformat/oggdec.h and libavformat/oggdec.c. You should have realized, that there is no way to directly use the ogg_read_packet function.

  1. there is no declaration in the header file
  2. the function is declared static in the source file

If you want to encode/decode with a specific codec (here ogg), you have to find an encoder (avcodec_find_encoder or avcodec_find_encoder_by_name) or a decoder (avcodec_find_decoder or avcodec_find_decoder_by_name) and link it to a AVCodecContext via avcodec_open2.

Then for encoding use the 'encode' functions described here and for decoding the 'decode' functions described here.

For more info:

In short, use the public Interface. Only 'God' knows the internals of FFmpeg.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...