Re: [Redbutton-devel] Small changes to rb for Fedora 9
Brought to you by:
skilvington
|
From: Simon K. <s.k...@er...> - 2008-06-11 13:40:48
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
thanks for the patch - I've applied the default alsa device and the
decode_audio2 parts - at the moment I'm changing the remaining
img_convert (in MHEGDisplay.c) to use swscale instead, so I'll commit
your fix for videoout_xshm at the same time - unless you beat me to it!
regarding the other questions:
aspect ratio - I have some hooks in the code to deal with it, but have
not implemented anything yet - at the moment it either uses exactly
720x756 pixels for its display, or the full size of your screen - but
it does not take the aspect ratio into account
not sure why the audio does not play in News Multiscreen - it works for
me - the error you get seems to suggest it is trying to open an audio
stream that does not exist - if you run rb-browser with the -v flag and
send me a log of the output, I'll see if I can work out what is going
wrong
xvideo output - this has been on my todo list for a long time - if you
want to implement it I would be very pleased ;-) you should be able to
base the code on videoout_xshm - I've been thinking it may be better to
also have a function in the videoout_* codes to overlay the MHEG scene
on the video - if we can feed YUV frames to xvideo rather than having to
convert them to RGB first, then it may turn out better to convert the
MHEG scene to YUV and composite that on the YUV video then feed the
result to xvideo - the scene will change a lot less often than the video
so there should be a lot less RGB->YUV conversion going on
so we would basically have a function in videoout_* called something
like "set_overlay" that gets called each time the MHEG scene changes -
then each time we show a video frame we composite the current overlay
on to it
Andrea wrote:
> Andrea wrote:
>> Hi,
>>
>> I've recently moved to Fedora 9 and I've just tried to run
>> redbutton-browser.
>> I had a few small of issues:
>>
>> 1) the alsa output device "plughw" is not good when using pulseaudio,
>> and in general I would use "default". Or one could allow for a command
>> line option
>>
>> 2) redbutton still uses img_convert and other deprecated functions
>> from ffmpeg. The recommended funtions are swscale. I managed to
>> convert videoout_xshm.c to the new framework.
>> There are still 2 more occurencies which I have not converted.
>>
>> 3) avcodec_decode_audio should be replaced by avcodec_decode_audio2
>> which requires af->item.size to be initialized.
>>
>> 4) aspect-ratio: BBC broadcasts in 16:9, while redbutton shows
>> everything 4:3. I have not yet found how to change it
>>
>> 5) audio in Multiscreen. No audio is played while in News Multiscreen.
>> I get those warnings:
>> Unable to open MPEG stream (16768, 53, 0)
>>
>> 6) xvideo: I am trying to change to xvideo. Any suggestions?
>>
>> Andrea
>>
> I forgot the patch.
>
> Andrea
>
>
>
> ------------------------------------------------------------------------
>
> Index: videoout_xshm.h
> ===================================================================
> --- videoout_xshm.h (revision 485)
> +++ videoout_xshm.h (working copy)
> @@ -9,6 +9,7 @@
> #include <X11/Xlib.h>
> #include <X11/extensions/XShm.h>
> #include <ffmpeg/avcodec.h>
> +#include <ffmpeg/swscale.h>
>
> typedef struct
> {
> @@ -22,11 +23,9 @@
> XShmSegmentInfo shm; /* shared memory used by current_frame */
> AVPicture rgb_frame; /* ffmpeg wrapper for current_frame SHM data */
> enum PixelFormat out_format; /* rgb_frame ffmpeg pixel format */
> - ImgReSampleContext *resize_ctx; /* NULL if we do not need to resize the frame */
> + struct SwsContext *sws_ctx;
> FrameSize resize_in; /* resize_ctx input dimensions */
> FrameSize resize_out; /* resize_ctx output dimensions */
> - AVPicture resized_frame; /* resized output frame */
> - uint8_t *resized_data; /* resized_frame data buffer */
> } vo_xshm_ctx;
>
> extern MHEGVideoOutputMethod vo_xshm_fns;
> Index: MHEGStreamPlayer.c
> ===================================================================
> --- MHEGStreamPlayer.c (revision 485)
> +++ MHEGStreamPlayer.c (working copy)
> @@ -102,7 +102,7 @@
>
> af->item.pts = AV_NOPTS_VALUE;
>
> - af->item.size = 0;
> + af->item.size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
>
> return af;
> }
> @@ -433,7 +433,8 @@
> {
> audio_frame = new_AudioFrameListItem();
> af = &audio_frame->item;
> - used = avcodec_decode_audio(audio_codec_ctx, af->data, &af->size, data, size);
> +
> + used = avcodec_decode_audio2(audio_codec_ctx, af->data, &af->size, data, size);
> data += used;
> size -= used;
> if(af->size > 0)
> Index: MHEGAudioOutput.h
> ===================================================================
> --- MHEGAudioOutput.h (revision 485)
> +++ MHEGAudioOutput.h (working copy)
> @@ -15,7 +15,7 @@
> } MHEGAudioOutput;
>
> /* default ALSA device */
> -#define ALSA_AUDIO_DEVICE "plughw"
> +#define ALSA_AUDIO_DEVICE "default"
>
> bool MHEGAudioOutput_init(MHEGAudioOutput *);
> void MHEGAudioOutput_fini(MHEGAudioOutput *);
> Index: videoout_xshm.c
> ===================================================================
> --- videoout_xshm.c (revision 485)
> +++ videoout_xshm.c (working copy)
> @@ -38,8 +38,7 @@
>
> v->current_frame = NULL;
>
> - v->resize_ctx = NULL;
> - v->resized_data = NULL;
> + v->sws_ctx = NULL;
>
> return v;
> }
> @@ -49,10 +48,9 @@
> {
> vo_xshm_ctx *v = (vo_xshm_ctx *) ctx;
>
> - if(v->resize_ctx != NULL)
> + if(v->sws_ctx != NULL)
> {
> - img_resample_close(v->resize_ctx);
> - safe_free(v->resized_data);
> + sws_freeContext(v->sws_ctx);
> }
>
> if(v->current_frame != NULL)
> @@ -67,8 +65,6 @@
> vo_xshm_prepareFrame(void *ctx, VideoFrame *f, unsigned int out_width, unsigned int out_height)
> {
> vo_xshm_ctx *v = (vo_xshm_ctx *) ctx;
> - AVPicture *yuv_frame;
> - int resized_size;
>
> /* have we created the output frame yet */
> if(v->current_frame == NULL)
> @@ -79,41 +75,34 @@
> vo_xshm_resize_frame(v, out_width, out_height);
>
> /* see if the input size is different than the output size */
> - if(f->width != out_width || f->height != out_height)
> + // if(f->width != out_width || f->height != out_height)
> {
> /* have the resize input or output dimensions changed */
> - if(v->resize_ctx == NULL
> + if(v->sws_ctx == NULL
> || v->resize_in.width != f->width || v->resize_in.height != f->height
> || v->resize_out.width != out_width || v->resize_out.height != out_height)
> {
> /* get rid of any existing resize context */
> - if(v->resize_ctx != NULL)
> - img_resample_close(v->resize_ctx);
> - if((v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height)) == NULL)
> + if(v->sws_ctx != NULL)
> + sws_freeContext(v->sws_ctx);
> + // if((v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height)) == NULL)
> + // fatal("Out of memory");
> + if((v->sws_ctx = sws_getContext(f->width, f->height, f->pix_fmt, out_width, out_height, v->out_format, SWS_FAST_BILINEAR, NULL, NULL, NULL)) == NULL)
> fatal("Out of memory");
> +
> + printf("%d, %d, %d, %d, %d %d\n", f->width, f->height, f->pix_fmt, out_width, out_height, v->out_format );
> +
> /* remember the resize input and output dimensions */
> v->resize_in.width = f->width;
> v->resize_in.height = f->height;
> v->resize_out.width = out_width;
> v->resize_out.height = out_height;
> - /* somewhere to store the resized frame */
> - if((resized_size = avpicture_get_size(f->pix_fmt, out_width, out_height)) < 0)
> - fatal("vo_xshm_prepareFrame: invalid frame size");
> - v->resized_data = safe_realloc(v->resized_data, resized_size);
> - avpicture_fill(&v->resized_frame, v->resized_data, f->pix_fmt, out_width, out_height);
> }
> /* resize it */
> - img_resample(v->resize_ctx, &v->resized_frame, &f->frame);
> - yuv_frame = &v->resized_frame;
> + sws_scale(v->sws_ctx, &f->frame.data, f->frame.linesize, 0, f->height, &v->rgb_frame.data, v->rgb_frame.linesize);
> +
> }
> - else
> - {
> - yuv_frame = &f->frame;
> - }
>
> - /* convert the frame to RGB */
> - img_convert(&v->rgb_frame, v->out_format, yuv_frame, f->pix_fmt, out_width, out_height);
> -
> return;
> }
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Redbutton-devel mailing list
> Red...@li...
> https://lists.sourceforge.net/lists/listinfo/redbutton-devel
- --
Simon Kilvington
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIT9XRmt9ZifioJSwRAoobAJ0fokuzWDdIV8KWHSv8kuCqDyGi4ACdFWqx
XNlvnn60Dgb3BdyQACJUYn4=
=ICie
-----END PGP SIGNATURE-----
|